eventhorizon

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 27 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

CI Latest release MIT license Made by azathos.com

eventhorizon is a DNS sinkhole that blocks ads and trackers for every app on your machine or your whole network, and watches for malware while it does. It comes with telescope, a terminal dashboard where you see every query live and block or allow a domain with one key.

telescope

What it does

  • Blocks ads and trackers using any hosts style or plain domain list, downloaded by URL or read from a file. Blocking a domain also blocks its subdomains. Blocked names get 0.0.0.0 or ::, so apps fail fast instead of waiting.
  • Catches CNAME cloaking, where a tracker hides behind a harmless looking subdomain of the site you visit. If any name in the CNAME chain is blocked, the answer is blocked.
  • Encrypts your lookups with DNS over TLS to Cloudflare and Quad9 by default, so your ISP cannot read or tamper with them. Connections are reused, and a resolver that fails is skipped for 30 seconds while the next one takes over.
  • Detects malware behaviour. A model trained on real domain names flags random looking names made by DGA malware, and per client alerts fire when a device produces bursts of failed lookups (DGA) or streams of data shaped subdomains (DNS tunneling). Popular domains are never flagged.
  • Caches answers with proper TTL handling, including negative answers.
  • Your own rules win over every list. Add them from telescope or the API; they are saved to a file and survive restarts.
  • Safe on a network. Only loopback and private addresses may query by default, every client is rate limited, and strangers get no reply, so with the default settings it cannot be used to amplify attacks on others. The service runs sandboxed as a throwaway user.
  • No dependencies. The server is a single static binary using only the Go standard library.

Install

Download the archive for your system from the releases page and unpack it. Each archive holds eventhorizon, telescope, this README and the license; Linux archives also hold the systemd unit.

Every release file carries signed build provenance, so you can check it was built by this repository's release workflow and not swapped afterwards:

gh attestation verify eventhorizon_v0.1.0_linux_amd64.tar.gz --repo 0xAzathos/eventhorizon

Or build it with Go 1.24 or newer:

go install github.com/0xAzathos/eventhorizon@latest

telescope needs Go 1.26 and is built from a clone, since it uses the server's packages from the same repository:

git clone https://github.com/0xAzathos/eventhorizon
cd eventhorizon/telescope
go build -o telescope .

Quick start

eventhorizon -blocklist https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts

It listens on 127.0.0.1:5300. Try it from another terminal:

dig @127.0.0.1 -p 5300 doubleclick.net     # 0.0.0.0, blocked
dig @127.0.0.1 -p 5300 example.com         # a real answer

Then open the dashboard:

telescope

Use it for your whole machine (Linux with systemd)

  1. Install the binary and the service:

    sudo install eventhorizon /usr/local/bin/
    sudo install -m 644 eventhorizon.service /etc/systemd/system/
    sudo systemctl daemon-reload
    sudo systemctl enable --now eventhorizon
    

    The service runs as a throwaway unprivileged user in a systemd sandbox and keeps its state (downloaded lists and your rules) in /var/lib/eventhorizon. Edit the ExecStart line to change flags or lists.

  2. Point systemd-resolved at it by creating /etc/systemd/resolved.conf.d/eventhorizon.conf:

    [Resolve]
    DNS=127.0.0.1:5300
    Domains=~.
    
    sudo systemctl restart systemd-resolved
    resolvectl query doubleclick.net    # should give 0.0.0.0
    

sudo systemctl reload eventhorizon downloads the lists again without a restart. Lists also refresh every 24 hours, and if a download fails the last good copy is used.

Use it for your whole network

Run it on an always on machine such as a Raspberry Pi (use the linux_arm64 or linux_arm archive). In the service file:

  1. Change -listen to that machine's LAN address on port 53, for example -listen 192.168.1.10:53.
  2. Uncomment AmbientCapabilities=CAP_NET_BIND_SERVICE, which allows port 53 without root.
  3. Set your router's DHCP DNS server to that address.

Devices pick it up when they renew their lease. Only loopback and private addresses are served unless you change -allow-clients. Tailscale addresses are not in the private group; to serve your tailnet, use -allow-clients loopback,private,100.64.0.0/10.

Never use -allow-clients any on a machine with a public address, such as a VPS: that makes it an open resolver anyone can abuse.

telescope from another machine

By default the API only listens on loopback, so run telescope on the same machine (over SSH works fine). To reach it across the network, give the API a token:

eventhorizon -api 192.168.1.10:5380 -api-token-file /var/lib/eventhorizon/api.token ...

eventhorizon creates the token file on first start, readable only by itself. Copy it to the other machine and point telescope at it:

sudo cat /var/lib/eventhorizon/api.token          # on the server
telescope -addr 192.168.1.10:5380 -token-file api.token

The token is sent in plain HTTP, so only do this on a network you trust, or over Tailscale or an SSH tunnel. eventhorizon refuses to start with a non loopback -api and no token. On a shared machine, a token also keeps other local users out.

telescope

Run telescope on the machine running eventhorizon. Use -addr if you moved the API, and -token-file (or the EVENTHORIZON_API_TOKEN variable) if it needs a token.

Key Action
↑ ↓ or k j select a query (freezes the log)
pgup pgdn move a page
a / A allow the selected name / its whole registrable domain
b / B block the selected name / its whole registrable domain
esc back to the live log, or clear the search
/ search the log by name or client
f filter: all, blocked, suspicious
p pause the live log
c clear the log and alerts
r download the blocklists again
R your rules (d deletes one)
? help
q quit

The footer shows each upstream resolver's health, whether it is encrypted, the blocklist size and the cache size.

Flags

Flag Default Meaning
-listen 127.0.0.1:5300 address for DNS over UDP and TCP
-upstream Cloudflare and Quad9 over TLS resolvers tried in order: IP[:port] for plain DNS, tls://IP[:port]#name for DNS over TLS; also used to look up blocklist downloads
-blocklist none comma separated files or http(s) URLs
-allowlist none file of domains that are never blocked
-rules state dir rules.txt where your own rules are saved
-list-cache-dir state dir last good copy of each downloaded list
-refresh 24h how often lists reload, 0 disables
-timeout 2s time per upstream attempt
-cache-size 10000 cached replies, 0 disables
-cache-max-ttl 1h longest time a reply is cached
-log-queries blocked all, blocked (includes suspicious) or none; all writes a full browsing history to the log
-detect true DGA and tunneling detection
-api 127.0.0.1:5380 local API for telescope, empty disables it
-api-token-file none require the token in this file on every API request; created if missing; needed for a non loopback -api
-allow-clients loopback,private CIDRs, addresses, or the groups loopback, private, any
-rate-limit 200 queries per second per client, bursts up to 5x, 0 disables
-version print the version and exit

Without systemd, the state dir is the current directory: lists go in .list-cache and rules in eventhorizon-rules.txt.

Rule order

  1. Your allow rules
  2. Your block rules
  3. The -allowlist file
  4. The blocklists

Every rule covers the domain and all of its subdomains.

API

The API shows every query and can change your rules, so it is locked down in layers:

  • Without a token it listens on loopback only and refuses requests whose Host is not loopback, which stops DNS rebinding attacks from web pages.
  • With -api-token-file, every request must send Authorization: Bearer <token>.
  • Requests that change something must send the header X-Eventhorizon-Change with any value, which a web page cannot do without permission.
Request Does
GET /api/stats totals, per second history, top domains and clients, upstream health
GET /api/events newline delimited JSON stream of queries and alerts
GET /api/rules your rules
POST /api/rules {"domain": "example.com", "action": "allow"} or "block"
DELETE /api/rules?domain=example.com remove a rule
POST /api/reload download the blocklists again

License

MIT, see LICENSE.


Made by 0xAzathos · azathos.com

Documentation

Overview

eventhorizon is a DNS sinkhole: it answers 0.0.0.0 for blocked domains and forwards everything else to an upstream resolver.

Directories

Path Synopsis
cmd
train command
Command train builds the detection data embedded in eventhorizon and measures how well it works.
Command train builds the detection data embedded in eventhorizon and measures how well it works.
internal
api
Package api serves eventhorizon's live data to local viewers like the TUI:
Package api serves eventhorizon's live data to local viewers like the TUI:
apiclient
Package apiclient talks to eventhorizon's local API (internal/api).
Package apiclient talks to eventhorizon's local API (internal/api).
cache
Package cache stores upstream replies and serves them again until their TTL runs out, counting TTLs down so clients see the true remaining time.
Package cache stores upstream replies and serves them again until their TTL runs out, counting TTLs down so clients see the true remaining time.
control
Package control owns the active policy: it combines the blocklists and allowlist file (rebuilt on reload) with the user's own rules (changed at any time), and installs the result.
Package control owns the active policy: it combines the blocklists and allowlist file (rebuilt on reload) with the user's own rules (changed at any time), and installs the result.
dash
Package dash holds the dashboard logic that does not depend on any terminal library: number formatting, the bar chart, and the event log.
Package dash holds the dashboard logic that does not depend on any terminal library: number formatting, the bar chart, and the event log.
detect
Package detect finds signs of malware in DNS traffic that no blocklist knows about yet.
Package detect finds signs of malware in DNS traffic that no blocklist knows about yet.
dnsmsg
Package dnsmsg parses DNS queries and builds the few responses a sinkhole needs.
Package dnsmsg parses DNS queries and builds the few responses a sinkhole needs.
events
Package events fans out what the server does (queries, alerts) to any number of live viewers, such as the TUI.
Package events fans out what the server does (queries, alerts) to any number of live viewers, such as the TUI.
guard
Package guard decides which clients may use the server: an allow list of networks, and a per client rate limit.
Package guard decides which clients may use the server: an allow list of networks, and a per client rate limit.
lists
Package lists builds a blocklist set from local files and URLs.
Package lists builds a blocklist set from local files and URLs.
policy
Package policy decides whether a domain is blocked.
Package policy decides whether a domain is blocked.
psl
Package psl finds the registrable part of a domain name using the Public Suffix List (https://publicsuffix.org/list/).
Package psl finds the registrable part of a domain name using the Public Suffix List (https://publicsuffix.org/list/).
punycode
Package punycode converts Unicode domain labels to the ASCII form used on the wire, e.g.
Package punycode converts Unicode domain labels to the ASCII form used on the wire, e.g.
rules
Package rules stores the user's own allow and block decisions, made from the TUI or the API, in a small text file that survives restarts:
Package rules stores the user's own allow and block decisions, made from the TUI or the API, in a small text file that survives restarts:
server
Package server answers DNS over UDP and TCP: parse, decide, then either answer from the sinkhole or forward the raw query upstream.
Package server answers DNS over UDP and TCP: parse, decide, then either answer from the sinkhole or forward the raw query upstream.
stats
Package stats keeps running totals for the dashboard: counters, a per second history for graphs, and top N lists, all in fixed memory.
Package stats keeps running totals for the dashboard: counters, a per second history for graphs, and top N lists, all in fixed memory.
upstream
Package upstream forwards queries to a list of resolvers with failover, over plain DNS or DNS over TLS.
Package upstream forwards queries to a list of resolvers with failover, over plain DNS or DNS over TLS.
version
Package version reports which build of eventhorizon is running.
Package version reports which build of eventhorizon is running.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL