Back to battles
legendaryupcoming

DNS Resolver

Build a recursive DNS resolver that queries root servers and caches results.

60 min limit0 participants
systemsnetworkingtypescript
PRD
# DNS Resolver PRD

## Overview
Build a recursive DNS resolver that constructs and parses DNS packets, performs iterative resolution starting from root nameservers, caches results with TTL expiration, and supports multiple record types.

## Requirements
- DNS packet parser handling header, question, answer, authority, and additional sections
- DNS packet builder to construct well-formed query packets
- Support record types: A, AAAA, CNAME, MX, NS, TXT, SOA
- Support query class IN (Internet)
- Recursive resolution starting at root servers and following NS referrals down the hierarchy
- Iterative query to each nameserver in the resolution chain
- Response caching with TTL-based expiration
- CNAME chain following to resolve aliases to final addresses
- Negative caching for NXDOMAIN responses
- UDP transport on port 53 for standard queries
- Handle truncated UDP responses by retrying with TCP
- Concurrent query resolution for parallel lookups
- Cache statistics: hit rate, total entries, eviction count
- Configurable upstream forwarders as alternative to root server resolution
- CLI tool: resolve <domain> [type] with pretty-printed DNS responses
- Pretty-print DNS responses showing all sections and record data
- Handle at least 100 queries per second

## Tech Stack
- TypeScript / Node.js
- dgram module for UDP, net module for TCP — no DNS libraries
- No external DNS resolution libraries — raw packet construction required

## Scoring Criteria
- **Functional (40%)**: Resolves real domain names correctly, caching works, multiple record types supported
- **Quality (20%)**: Correct packet format, proper error handling, clean resolver logic
- **Fidelity (25%)**: All features including CNAME chains, negative caching, TCP fallback, and concurrency
- **Speed (15%)**: Time bonus

Battle Stats

Time Limit60 min
Participants0
Statusupcoming

Rules

  • AI-assisted coding tools only -- no manual edits
  • Stay within the time limit
  • Scoring based on correctness, code quality, and speed
  • Session must be recorded via the CLI