Rudimentary DNS server implementation in Rust with support for the most common DNS record types. Written with the help of Emil Hernvall's DNS guide. Non-exhaustive tests are also provided.
The aim of this project was to learn about Rust and DNS protocols.
Rust (stable or nightly) needs to be installed. Then, run:
cargo build
For automated pre-commit/pre-push checks, a Lefthook script is included. Run lefthook install
to initialize it.
Run the server:
cargo run
Then, while the server is running, send a DNS query to port 2053:
dig @127.0.0.1 -p 2053 www.google.com
To run the provided tests:
cargo test
I've achieved what I wanted to with this project, but there are some further improvements that could be made:
- Support replies larger than 512B (TCP connection support is necessary for this)
- Concurrency
- Start resolving using other servers than the A root server
- Add support for hosting zones
- Allow acting as an authoritative server
- DNSSEC
- Add support for more records (SOA, TXT, SRV, OPT)