* feat: recursive resolution + full DNSSEC validation Numa becomes a true DNS resolver — resolves from root nameservers with complete DNSSEC chain-of-trust verification. Recursive resolution: - Iterative RFC 1034 from configurable root hints (13 default) - CNAME chasing (depth 8), referral following (depth 10) - A+AAAA glue extraction, IPv6 nameserver support - TLD priming: NS + DS + DNSKEY for 34 gTLDs + EU ccTLDs - Config: mode = "recursive" in [upstream], root_hints, prime_tlds DNSSEC (all 4 phases): - EDNS0 OPT pseudo-record (DO bit, 1232 payload per DNS Flag Day 2020) - DNSKEY, DS, RRSIG, NSEC, NSEC3 record types with wire read/write - Signature verification via ring: RSA/SHA-256, ECDSA P-256, Ed25519 - Chain-of-trust: zone DNSKEY → parent DS → root KSK (key tag 20326) - DNSKEY RRset self-signature verification (RRSIG(DNSKEY) by KSK) - RRSIG expiration/inception time validation - NSEC: NXDOMAIN gap proofs, NODATA type absence, wildcard denial - NSEC3: SHA-1 iterated hashing, closest encloser proof, hash range - Authority RRSIG verification for denial proofs - Config: [dnssec] enabled/strict (default false, opt-in) - AD bit on Secure, SERVFAIL on Bogus+strict - DnssecStatus cached per entry, ValidationStats logging Performance: - TLD chain pre-warmed on startup (root DNSKEY + TLD DS/DNSKEY) - Referral DS piggybacking from authority sections - DNSKEY prefetch before validation loop - Cold-cache validation: ~1 DNSKEY fetch (down from 5) - Benchmarks: RSA 10.9µs, ECDSA 174ns, DS verify 257ns Also: - write_qname fix for root domain "." (was producing malformed queries) - write_record_header() dedup, write_bytes() bulk writes - DnsRecord::domain() + query_type() accessors - UpstreamMode enum, DEFAULT_EDNS_PAYLOAD const - Real glue TTL (was hardcoded 3600) - DNSSEC restricted to recursive mode only Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: TCP fallback, query minimization, UDP auto-disable Transport resilience for restrictive networks (ISPs blocking UDP:53): - DNS-over-TCP fallback: UDP fail/truncation → automatic TCP retry - UDP auto-disable: after 3 consecutive failures, switch to TCP-first - IPv6 → TCP directly (UDP socket binds 0.0.0.0, can't reach IPv6) - Network change resets UDP detection for re-probing - Root hint rotation in TLD priming Privacy: - RFC 7816 query minimization: root servers see TLD only, not full name Code quality: - Merged find_starting_ns + find_starting_zone → find_closest_ns - Extracted resolve_ns_addrs_from_glue shared helper - Removed overall timeout wrapper (per-hop timeouts sufficient) - forward_tcp for DNS-over-TCP (RFC 1035 §4.2.2) Testing: - Mock TCP-only DNS server for fallback tests (no network needed) - tcp_fallback_resolves_when_udp_blocked - tcp_only_iterative_resolution - tcp_fallback_handles_nxdomain - udp_auto_disable_resets - Integration test suite (4 suites, 51 tests) - Network probe script (tests/network-probe.sh) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: DNSSEC verified badge in dashboard query log - Add dnssec field to QueryLogEntry, track validation status per query - DnssecStatus::as_str() for API serialization - Dashboard shows green checkmark next to DNSSEC-verified responses - Blog post: add "How keys get there" section, transport resilience section, trim code blocks, update What's Next Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use SVG shield for DNSSEC badge, update blog HTML Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: NS cache lookup from authorities, UDP re-probe, shield alignment - find_closest_ns checks authorities (not just answers) for NS records, fixing TLD priming cache misses that caused redundant root queries - Periodic UDP re-probe every 5min when disabled — re-enables UDP after switching from a restrictive network to an open one - Dashboard DNSSEC shield uses fixed-width container for alignment - Blog post: tuck key-tag into trust anchor paragraph Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: TCP single-write, mock server consistency, integration tests - TCP single-write fix: combine length prefix + message to avoid split segments that Microsoft/Azure DNS servers reject - Mock server (spawn_tcp_dns_server) updated to use single-write too - Tests: forward_tcp_wire_format, forward_tcp_single_segment_write - Integration: real-server checks for Microsoft/Office/Azure domains Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: recursive bar in dashboard, special-use domain interception Dashboard: - Add Recursive bar to resolution paths chart (cyan, distinct from Override) - Add RECURSIVE path tag style in query log Special-use domains (RFC 6761/6303/8880/9462): - .localhost → 127.0.0.1 (RFC 6761) - Private reverse PTR (10.x, 192.168.x, 172.16-31.x) → NXDOMAIN - _dns.resolver.arpa (DDR) → NXDOMAIN - ipv4only.arpa (NAT64) → 192.0.0.170/171 - mDNS service discovery for private ranges → NXDOMAIN Eliminates ~900ms SERVFAILs for macOS system queries that were hitting root servers unnecessarily. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: move generated blog HTML to site/blog/posts/, gitignore - Generated HTML now in site/blog/posts/ (gitignored) - CI workflow runs pandoc + make blog before deploy - Updated all internal blog links to /blog/posts/ path - blog/*.md remains the source of truth Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: review feedback — memory ordering, RRSIG time, NS resolution - Ordering::Relaxed → Acquire/Release for UDP_DISABLED/UDP_FAILURES (ARM correctness for cross-thread coordination) - RRSIG time validation: serial number arithmetic (RFC 4034 §3.1.5) + 300s clock skew fudge factor (matches BIND) - resolve_ns_addrs_from_glue collects addresses from ALL NS names, not just the first with glue (improves failover) - is_special_use_domain: eliminate 16 format! allocations per .in-addr.arpa query (parse octet instead) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: API endpoint tests, coverage target - 8 new axum handler tests: health, stats, query-log, overrides CRUD, cache, blocking stats, services CRUD, dashboard HTML - Tests use tower::oneshot — no network, no server startup - test_ctx() builds minimal ServerCtx for isolated testing - `make coverage` target (cargo-tarpaulin), separate from `make all` - 82 total tests (was 74) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
175 lines
8.1 KiB
Markdown
175 lines
8.1 KiB
Markdown
# Numa
|
|
|
|
[](https://github.com/razvandimescu/numa/actions)
|
|
[](https://crates.io/crates/numa)
|
|
[](LICENSE)
|
|
|
|
**DNS you own. Everywhere you go.** — [numa.rs](https://numa.rs)
|
|
|
|
A portable DNS resolver in a single binary. Block ads on any network, name your local services (`frontend.numa`), and override any hostname with auto-revert — all from your laptop, no cloud account or Raspberry Pi required.
|
|
|
|
Built from scratch in Rust. Zero DNS libraries. RFC 1035 wire protocol parsed by hand. Recursive resolution from root nameservers with full DNSSEC validation (chain-of-trust + NSEC/NSEC3 denial proofs). One ~8MB binary, no PHP, no web server, no database — everything is embedded.
|
|
|
|

|
|
|
|
## Quick Start
|
|
|
|
```bash
|
|
# Install (pick one)
|
|
brew install razvandimescu/tap/numa
|
|
cargo install numa
|
|
curl -fsSL https://raw.githubusercontent.com/razvandimescu/numa/main/install.sh | sh
|
|
|
|
# Run (port 53 requires root)
|
|
sudo numa
|
|
|
|
# Try it
|
|
dig @127.0.0.1 google.com # ✓ resolves normally
|
|
dig @127.0.0.1 ads.google.com # ✗ blocked → 0.0.0.0
|
|
```
|
|
|
|
Open the dashboard: **http://numa.numa** (or `http://localhost:5380`)
|
|
|
|
Or build from source:
|
|
```bash
|
|
git clone https://github.com/razvandimescu/numa.git && cd numa
|
|
cargo build --release
|
|
sudo ./target/release/numa
|
|
```
|
|
|
|
## Why Numa
|
|
|
|
- **Local service proxy** — `https://frontend.numa` instead of `localhost:5173`. Auto-generated TLS certs, WebSocket support for HMR. Like `/etc/hosts` but with auto TLS, a REST API, LAN discovery, and auto-revert.
|
|
- **Path-based routing** — `app.numa/api → :5001`, `app.numa/auth → :5002`. Route URL paths to different backends with optional prefix stripping. Like nginx location blocks, zero config files.
|
|
- **LAN service discovery** — Numa instances on the same network find each other automatically via mDNS. Access a teammate's `api.numa` from your machine. Opt-in via `[lan] enabled = true`.
|
|
- **Developer overrides** — point any hostname to any IP, auto-reverts after N minutes. Full REST API for scripting. Built-in diagnostics: `curl localhost:5380/diagnose/example.com` tells you exactly how any domain resolves.
|
|
- **DNS-over-HTTPS** — upstream queries encrypted via DoH. Your ISP sees HTTPS traffic, not DNS queries. Set `address = "https://9.9.9.9/dns-query"` in `[upstream]` or any DoH provider.
|
|
- **Ad blocking that travels with you** — 385K+ domains blocked via [Hagezi Pro](https://github.com/hagezi/dns-blocklists). Works on any network: coffee shops, hotels, airports.
|
|
- **Sub-microsecond caching** — 691ns cached round-trip, ~2.0M queries/sec throughput, zero heap allocations in the I/O path. [Benchmarks](bench/).
|
|
- **Live dashboard** — real-time stats, query log, blocking controls, service management. LAN accessibility badges show which services are reachable from other devices.
|
|
- **macOS, Linux, and Windows** — `numa install` configures system DNS, `numa service start` runs as launchd/systemd service.
|
|
|
|
## Local Service Proxy
|
|
|
|
Name your local dev services with `.numa` domains:
|
|
|
|
```bash
|
|
curl -X POST localhost:5380/services \
|
|
-H 'Content-Type: application/json' \
|
|
-d '{"name":"frontend","target_port":5173}'
|
|
|
|
open http://frontend.numa # → proxied to localhost:5173
|
|
```
|
|
|
|
- **HTTPS with green lock** — auto-generated local CA + per-service TLS certs
|
|
- **WebSocket** — Vite/webpack HMR works through the proxy
|
|
- **Health checks** — dashboard shows green/red status per service
|
|
- **LAN sharing** — services bound to `0.0.0.0` are automatically discoverable by other Numa instances on the network. Dashboard shows "LAN" or "local only" per service.
|
|
- **Path-based routing** — route URL paths to different backends:
|
|
```toml
|
|
[[services]]
|
|
name = "app"
|
|
target_port = 3000
|
|
routes = [
|
|
{ path = "/api", port = 5001 },
|
|
{ path = "/auth", port = 5002, strip = true },
|
|
]
|
|
```
|
|
`app.numa/api/users → :5001/api/users`, `app.numa/auth/login → :5002/login` (stripped)
|
|
- **Persistent** — services survive restarts
|
|
- Or configure in `numa.toml`:
|
|
|
|
```toml
|
|
[[services]]
|
|
name = "frontend"
|
|
target_port = 5173
|
|
```
|
|
|
|
## LAN Service Discovery
|
|
|
|
Run Numa on multiple machines. They find each other automatically:
|
|
|
|
```
|
|
Machine A (192.168.1.5) Machine B (192.168.1.20)
|
|
┌──────────────────────┐ ┌──────────────────────┐
|
|
│ Numa │ mDNS │ Numa │
|
|
│ services: │◄───────────►│ services: │
|
|
│ - api (port 8000) │ discovery │ - grafana (3000) │
|
|
│ - frontend (5173) │ │ │
|
|
└──────────────────────┘ └──────────────────────┘
|
|
```
|
|
|
|
From Machine B:
|
|
```bash
|
|
dig @127.0.0.1 api.numa # → 192.168.1.5
|
|
curl http://api.numa # → proxied to Machine A's port 8000
|
|
```
|
|
|
|
Enable LAN discovery:
|
|
```bash
|
|
numa lan on
|
|
```
|
|
Or in `numa.toml`:
|
|
```toml
|
|
[lan]
|
|
enabled = true
|
|
```
|
|
Uses standard mDNS (`_numa._tcp.local` on port 5353) — compatible with Bonjour/Avahi, silently dropped by corporate firewalls instead of triggering IPS alerts.
|
|
|
|
**Hub mode** — don't want to install Numa on every machine? Run one instance as a shared DNS server and point other devices to it:
|
|
|
|
```bash
|
|
# On the hub machine, bind to LAN interface
|
|
[server]
|
|
bind_addr = "0.0.0.0:53"
|
|
|
|
# On other devices, set DNS to the hub's IP
|
|
# They get .numa resolution, ad blocking, caching — zero install
|
|
```
|
|
|
|
## How It Compares
|
|
|
|
| | Pi-hole | AdGuard Home | NextDNS | Cloudflare | Numa |
|
|
|---|---|---|---|---|---|
|
|
| Local service proxy | No | No | No | No | `.numa` + HTTPS + WS |
|
|
| Path-based routing | No | No | No | No | Prefix match + strip |
|
|
| LAN service discovery | No | No | No | No | mDNS, opt-in |
|
|
| Developer overrides | No | No | No | No | REST API + auto-expiry |
|
|
| Recursive resolver | No | No | Cloud only | Cloud only | From root hints, DNSSEC |
|
|
| Encrypted upstream (DoH) | No (needs cloudflared) | Yes | Cloud only | Cloud only | Native, single binary |
|
|
| Portable (travels with laptop) | No (appliance) | No (appliance) | Cloud only | Cloud only | Single binary |
|
|
| Zero config | Complex | Docker/setup | Yes | Yes | Works out of the box |
|
|
| Ad blocking | Yes | Yes | Yes | Limited | 385K+ domains |
|
|
| Data stays local | Yes | Yes | Cloud | Cloud | 100% local |
|
|
|
|
## How It Works
|
|
|
|
```
|
|
Query → Overrides → .numa TLD → Blocklist → Local Zones → Cache → Recursive/Forward
|
|
```
|
|
|
|
Two resolution modes: **forward** (relay to upstream like Quad9/Cloudflare) or **recursive** (resolve from root nameservers — no upstream dependency). Set `mode = "recursive"` in `[upstream]` to resolve independently.
|
|
|
|
No DNS libraries — no `hickory-dns`, no `trust-dns`. The wire protocol — headers, labels, compression pointers, record types — is parsed and serialized by hand. Runs on `tokio` + `axum`, async per-query task spawning.
|
|
|
|
[Configuration reference](numa.toml)
|
|
|
|
## Roadmap
|
|
|
|
- [x] DNS proxy core — forwarding, caching, local zones
|
|
- [x] Developer overrides — REST API with auto-expiry
|
|
- [x] Ad blocking — 385K+ domains, live dashboard, allowlist
|
|
- [x] System integration — macOS + Linux, launchd/systemd, Tailscale/VPN auto-discovery
|
|
- [x] Local service proxy — `.numa` domains, HTTP/HTTPS proxy, auto TLS, WebSocket
|
|
- [x] Path-based routing — URL prefix routing with optional strip, REST API
|
|
- [x] LAN service discovery — mDNS auto-discovery (opt-in), cross-machine DNS + proxy
|
|
- [x] DNS-over-HTTPS — encrypted upstream via DoH (Quad9, Cloudflare, any provider)
|
|
- [x] Recursive resolution — resolve from root nameservers, no upstream dependency
|
|
- [x] DNSSEC validation — chain-of-trust, NSEC/NSEC3 denial proofs, AD bit (RSA, ECDSA, Ed25519)
|
|
- [ ] pkarr integration — self-sovereign DNS via Mainline DHT (15M nodes)
|
|
- [ ] Global `.numa` names — self-publish, DHT-backed, first-come-first-served
|
|
|
|
## License
|
|
|
|
MIT
|