Skip to content

Latest commit

 

History

History
63 lines (47 loc) · 2.92 KB

README.md

File metadata and controls

63 lines (47 loc) · 2.92 KB

Ohm

Go Report Card

Ohm is a minimal app that helps break the cycle of endless scrolling. Ohm works by blocking domain fragments using NextDNS Denylist feature. It works best with websites but may also work with some apps.

Ohm gives you allowances which can be configured by domain. Each allowance can be configured with a session duration and a lockout period once the allowance is exhausted. An optional "cooldown" period can also be provided.

If cooldown is not provided, Ohm is activated for a domain when you first query the domain (usually visiting the website). Once it's activated, it starts a timer for that domain. Once the timer expires, it enables the corresponding Denylist entry.

If cooldown is provided, Ohm will monitor DNS query logs for the domain. If no requests are made for the time specified by cooldown, the block will not be inserted.

Note that browsers maintain very long-lived connections and typically systems have at least 2 layers of DNS caching. You may need to spend some time configuring Ohm for your system, or your system for Ohm.

Configuration

See example-config.yaml for an example of how to configure Ohm. You'll need to place a configuration file at cmd/ohm/config.yaml for it to be used.

Deployment

The easiest way to deploy Ohm is with Fly.

Prerequisites

  1. A NextDNS account (free).
    1. Add a NextDNS configuration profile for yourself.
      1. Enable query logging (Settings -> Logs). Ohm uses these logs to function.
        1. You may disable Log clients IPs if you like, and retention can be dropped to 1h.
      2. Create a Denylist entry for each site you wish to block.
      3. Note your profile's ID. This can be found in the URL when configuring your profile or from the Setup page.
      4. Retrieve your API token from your Account page.
    2. Configure any device (computer, phone etc.) That you'd like to use Ohm with to use the NextDNS profile created above.
  2. A Fly.io account (also free).
    1. Create an org for yourself
    2. Install and configure flyctl

Setup & Deployment

  1. Clone this repository.
  2. Create a configuration file. See Configuration for details.
  3. Deploy Ohm to Fly
    cd ohm/
    flyctl apps create ohm
    flyctl secrets set OHM_NEXTDNS_KEY=<API token from above> OHM_NEXTDNS_PROFILE=<your profile ID from above>
    flyctl deploy
  4. Monitor logs.
    flyctl logs
  5. Try visiting sites you've configured Ohm to monitor.

Instrumentation

Ohm produces some metrics concerning its operation. You can query them by using Fly's built-in metrics stack. See: https://fly.io/docs/reference/metrics/#querying