#dns-server #toy #cache #weekend #port #server-port #testing

bin+lib dns_in_a_weekend

A toy implementation of a DNS server that implements caching

2 releases

0.1.1 May 14, 2023
0.1.0 May 14, 2023

#237 in Caching

38 downloads per month

Custom license

35KB
880 lines

DNS Server In A Weekend

This is a toy implementation of a DNS server that follows the Implement DNS in a weekend guide.

Usage

Start the DNS server at port 5354:

RUST_LOG=info dns-in-a-weekend --port 5354

Make a DNS request with dig to test that it is accessible:

dig @127.0.0.1 -p 5354 google.com

If dig prints the DNS response, it means everything is working.

Development

Install

Via cargo

cargo install dns-in-a-weekend

Build

Checkout the project and run if you have cargo already set up.

cargo build --release

Features

Caching

It implements caching of DNS resolutions so that we don't overwhelm the root name servers.

Caveat: The cache has no TTL so it could go stale (even though the DNSRecords themselves have TTLs we don't implement it here).

Dependencies

~4.5–6.5MB
~114K SLoC