Authoritative DNS server
A small authoritative DNS server in Go, written from the wire format up without a DNS library, serving a JSON-configured zone over UDP and TCP.
- Stack
- Go, Docker, GitHub Actions
The goal was a DNS server small enough to explain end to end: every byte of the protocol parsed and encoded by hand, every response code reachable from a test. It’s authoritative only. It deliberately doesn’t do recursive resolution, forwarding, or caching.
What it implements
| Area | Behavior |
|---|---|
| Wire format | Headers, flags, QNAME, QTYPE/QCLASS, resource records, EDNS OPT |
| Zone data | Validated JSON config with A, AAAA, SOA, and multi-record RRsets |
| Authority | Authoritative answers, NXDOMAIN, NODATA, REFUSED, negative SOA records |
| UDP | 512-byte classic responses, EDNS negotiation up to 1232 bytes, whole-record truncation |
| TCP | Length-prefixed framing, concurrent clients, connection reuse, read/write deadlines |
| Lifecycle | Graceful shutdown on SIGINT/SIGTERM, static non-root container image |
Measured
- queries per second, median of three trials at 30,000 offered
- 29,944
- queries lost
- 0
- median p99 latency bound
- 3.0 ms
- statement coverage across 130 test cases, race detector on
- 87.2%
Benchmarks ran on Apple M3 Pro loopback on October 27, 2026. They’re local baselines, not production or network-wide throughput. Raw logs are in the repository.