Riadh Chelbi
← All work

Apex

Role —
Author
Date —
June 6, 2026
Stack —
Rust, DNS, Networking

Apex is a DNS server that speaks RFC 1035 directly. No dependencies on system resolvers — it parses raw DNS packets off the wire, resolves queries recursively starting from root servers, and sends back responses.

The core is a zero-copy byte buffer parser that handles the full packet lifecycle: parsing question sections, resolving A, AAAA, NS, CNAME, and MX records, and serializing responses without allocating unnecessary memory.

What it does

  • Zero-copy wire format parser and serializer
  • Recursive resolution from root name servers
  • A, AAAA, NS, CNAME, MX record support with unknown record passthrough
  • TTL caching to avoid redundant upstream queries
  • Concurrent query handling for real-world load

Why it exists

Understanding DNS at the packet level changes how you debug everything upstream — split-horizon issues, TTL mismatches, CNAME chains that silently break. Building a resolver from scratch is the best way to internalize how name resolution actually works.

Run it with cargo run, test with dig @127.0.0.1 -p 2053 google.com.