peephole

API

The public endpoints of this node. No key needed. Everything public is delayed: a request shows up only 5 minutes plus a random 0–5 minutes after it arrived. Request contents, query strings and fingerprints are never public.

GET /api/blocklist

Threat intelligence for firewalls: the addresses that sent requests of a given severity in a time window, one address (or prefix) per line, as text/plain. Lines starting with # are comments. Recomputed at most once a minute per parameter set; the newest entries first, at most 50000.

ParameterValuesDefault
hours1–720: the window24
min_severity1–4: the least severity a request needs3
networks=1collapse a /24 (IPv6: /64) with 3 or more entries into one prefix, unless it holds a shared address (below)off

An unusable value means its default, so a typo never makes a firewall script fail open. Never listed: Tor exits, verified crawlers, the addresses of this project's own nodes, and the operator's own and excluded networks. In a cluster, the list is drawn from every member's trap.

Shared addresses. Where the operator's own naming calls an address a carrier-NAT or mobile pool, or a line that is reassigned (rules 2, 4, 5 and 6 of the shared reading), a comment line comes just before its entry, for example # shared 192.0.2.1 rule=4 v=3: shared pool, by the operator's naming; not verified by behaviour. rule is the reading's rule, v the evidence version. It is a cost warning, not a verdict: a block on such an address hits other people, and the address changes hands fast (75 % of mobile associations are gone within a day). Entries and membership are the same with or without it, and networks=1 never collapses a /24 or /64 that holds such an address, so its addresses are listed one by one.

curl -fsS 'https://<this host>/api/blocklist?hours=48&min_severity=3&networks=1'

# nginx
curl -fsS https://<this host>/api/blocklist | grep -v '^#' | sed 's/.*/deny &;/' > /etc/nginx/blocklist.conf \
  && nginx -t && systemctl reload nginx

# nftables (an IPv4 set "peephole" in table inet filter)
curl -fsS https://<this host>/api/blocklist | grep -v '^#' | grep -v : \
  | sed 's/.*/add element inet filter peephole { & }/' | nft -f -

GET /api/stats

The public dashboard's numbers as JSON: totals, unique IPs, countries, Tor exits, finished counter-scans, top IPs, countries and ASNs, the severity distribution, a timeline and a weekday × hour heatmap (always the last 7 days). Parameter range: 24h (default), 7d, 30d or all.

curl -fsS 'https://<this host>/api/stats?range=7d'

GET /api/map

Unique IPs per country (ISO 3166-1 alpha-2) as JSON, with the largest count. Parameter range as for /api/stats.

GET /api/countries

Country codes and their names as JSON; cached for a day.

GET /healthz

ok while the database answers, otherwise HTTP 503 unavailable. For load balancers and monitoring.

GET /api/v1/openapi.json

The OpenAPI 3.1 description of /api/v1, the machine API for the companion app and scripts. That API takes a device token or an API key an admin mints; the description itself needs none.