Skip to content
Back to the catalog
Project dns-resolverNetworkingIntermediateBeta

A DNS resolver

Build and parse UDP packets bit by bit. Resolve names by walking the hierarchy from the root servers.

Build it in your language

The tester treats your program as a black box: any language works. These are just the most convenient ones for this project.

Guide language

The stage guides read in this language. Only languages this project is fully translated into show up here; the interface language does not change.

What this project is about

Every time you type a URL, something translates a name into an IP address by walking a worldwide hierarchy of servers. That something fits in a few hundred lines.

Here you build DNS packets bit by bit, send them over UDP and parse the response, including the name compression that trips everyone up. You'll finish resolving real domains starting from the root servers, without leaning on the system resolver.

Roadmap

8 stages across 4 phases. Every stage comes with its guide and its tests: you move on when they pass.

  1. Phase 12 stages

    Writing a packet

    Build a DNS query byte by byte and send it over UDP.

    1. 01DNS header
    2. 02Question and UDP transport
  2. Phase 23 stages

    Reading the response

    Parse the header and sections, and decompress pointer-based names.

    1. 01Response validation
    2. 02Resource records
    3. 03Name compression
  3. Phase 32 stages

    Resolving for real

    Iterative walk from the root servers, CNAMEs and several record types.

    1. 01Iterative resolution
    2. 02CNAME and common types
  4. Phase 41 stage

    Caching

    Honour TTLs and avoid repeated lookups.

    1. 01TTL cache

Before you start

A complete DNS resolver: packet serialization and parsing per RFC 1035, queries over UDP, support for the common record types (A, AAAA, CNAME, MX, NS, TXT), pointer-based name decompression, recursive resolution from the root servers, and caching that honours the TTL.

  • bittorrent
    Beta

    A BitTorrent client

    Bencode, trackers and the peer-to-peer protocol. Download a real file by talking to real peers.

    Advanced12 stages~20 hNetworking
    bencodep2pprotocolos+1

    Go · Python · Java

  • mcp-server
    Beta

    Build an MCP server

    Build a Model Context Protocol server from scratch with JSON-RPC, tools, and resources.

    Intermediate5 stages~12 hNetworking
    mcpjson rpcagentes+1

    TypeScript · Python · Go

  • http-server
    Beta

    An HTTP server from the socket up

    From raw bytes to a 200 response. Parse requests, manage connections and serve concurrent traffic.

    Intermediate10 stages~12 hNetworking
    socketstcphttp+1

    Go · Python · C · Rust