A primitive DNS server written in Rust for fun.



A primitive DNS server written in Rust for fun.

@lucavallin ➜ /workspaces/vodo (main) $ ./target/debug/vodo -h
A primitive DNS server written in Rust for fun.

Usage: vodo [OPTIONS]

  -p, --port <PORT>  Port for the server to listen on [default: 5353]
  -h, --help         Print help
  -V, --version      Print version


# Build the server
$ cargo build --release

# Run the server (or use cargo run)
$ ./target/release/vodo -p 5353

# Query the server
$ dig @ -p 5353 cavall.in

; <<>> DiG 9.18.16-1~deb12u1-Debian <<>> @ -p 5353 cavall.in
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 8919
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 2, ADDITIONAL: 0

;cavall.in.                     IN      A

cavall.in.              1799    IN      A
cavall.in.              1799    IN      A
cavall.in.              1799    IN      A
cavall.in.              1799    IN      A

cavall.in.              1800    IN      NS      dns1.registrar-servers.com.
cavall.in.              1800    IN      NS      dns2.registrar-servers.com.

;; Query time: 120 msec
;; WHEN: Sun Jul 23 16:04:24 UTC 2023
;; MSG SIZE  rcvd: 225


I have included a Makefile to make it easier to build and run the server.

# Build the server
$ make build[-release|-debug]
# Run the server
$ make run [port=5353]
# Clean the build
$ make clean
# Query the server
$ make query [hostname=example.com]


  • There is no true concurrency in this server.
  • It does not support TCP, IPv6, EDNS or DNSSEC.
  • It cannot be used to host its own zones, and allow it to act as an authorative server.
  • There is no caching.
  • There are no automated tests or benchmarks.


  • Rename pb.rs and rc.rs to something more meaningful.
  • Pass SocketAddr as a command line argument (https://github.com/barafael/protohackers/blob/2cc81d7273206c08ca677a82e557bc26dc9cdbcc/netcrab/src/arguments.rs#L26-L28).
  • Consider removing #[macro_use] extern crate
  • Consider replacing BufferError::GenericError(String) with #[error("I/O error: {0}")] IoError(#[from] std::io::Error)
  • Consider tokio-rs/bytes for handling buffers.
  • Replace 0 | _ with _ in match statements.
  • Run cargo clippy -- -W clippy::pedantic for pedantic errors.
  • Consider async/await with tokio.rs (header.rs and packet.rs could use tokio_util::codec)
  • Consider replacing the as u16 casts with try_into() to reduce overflow risk.
  • Consider using Ipv4Addr::from(raw_addr.to_be_bytes()) to convert raw bytes to an IPv4 address (IPv6 might require more work).
  • Consider using crate bitvec for bit manipulation.
You might also like...
Utility for working with reverse DNS

RDNS RDNS is a small Rust CLI utility for performing single and bulk reverse DNS (PTR) lookups. Usage RDNS 0.1.0 Joe Banks [email protected] Utilities for

Implementation of algorithms for Domain Name System (DNS) Cookies construction

DNS Cookie RFC7873 left the construction of Server Cookies to the discretion of the DNS Server (implementer) which has resulted in a gallimaufry of di

A wrapper for the Google Cloud DNS API

cloud-dns is a crate providing a client to interact with Google Cloud DNS v1

Automatically updates your Cloudflare DNS records for specific zones. Especially useful if you have dynamic IP address

Cloudflare DNS updater What does it do? Cloudflare DNS updater updates specified dns records for specified zones effortlessly and automatically. It wa

Userspace libpcap-based tool to mirror your dns traffic

DNS traffic mirroring tool (dns-mirror) Description Userspace libpcap-based tool. dns-mirror sniffs dns packets on the given interface and proxies it

DNS resolver for split-horizon scenarios

polyresolver is a resolver for split-horizon scenarios polyresolver is used to root domain names to different nameservers for the purposes of resolvin

Command-line DNS client using bitvec, nom and RFC 1035

Dingo Domain INformation Gatherer, Obviously. Installation Install cargo, see instructions on the Rust website Run ./install.sh (it just does cargo bu

Flexible DNS hijacking and proxy tool.

kungfu Flexible DNS hijacking and proxy tool. Features Flexible rules e.g. glob pattern domain, static routes, response CIDR Host file include /etc/ho

Dns subdomain finding tool, based off of the c application of the same name

dnsmap-rs Tool for brute-forcing/scanning for existing subdomains in a domain. Based on dnsmap c application that is packaged in kali linux. Can query

Luca Cavallin
Software Engineer at GitHub. Passionate about Go, Rust, C, infrastructure and developer tooling. Also: 🚴🏻‍♂️ 🏃🏼 🍖 🎹 🔭 🎮 🐈 .
Luca Cavallin
Obtain (wildcard) certificates from let's encrypt using dns-01 without the need for API access to your DNS provider.

Agnos Presentation Agnos is a single-binary program allowing you to easily obtain certificates (including wildcards) from Let's Encrypt using DNS-01 c

Arthur Carcano 246 Dec 20, 2022
RDE1 (Rusty Data Exfiltrator) is client and server tool allowing auditor to extract files from DNS and HTTPS protocols written in Rust. 🦀

Information: RDE1 is an old personal project (end 2022) that I didn't continue development on. It's part of a list of projects that helped me to learn

Quentin Texier (g0h4n) 32 Oct 6, 2023
A Rust based DNS client, server, and resolver

Trust-DNS A Rust based DNS client, server, and Resolver, built to be safe and secure from the ground up. This repo consists of multiple crates: Librar

Benjamin Fry 2.7k Dec 30, 2022
Minimal DNS server built in Rust with rule system and logging.

MinDNS MinDNS is a minimal DNS server written in Rust. It is intended to be used as a firewall, black-hole or proxy DNS server. ⚡ Features Fully async

Sammwy 142 Oct 23, 2023
Resolved - a simple DNS server for home networks

resolved resolved (pronounced "resolved", not "resolved") is a simple DNS server for home networks. To that end, it supports: Recursive and non-recurs

Michael Walker 17 Sep 27, 2022
SOCKS5 implement library, with some useful utilities such as dns-query, socks5-server, dns2socks, udp-client, etc.

socks5-impl Fundamental abstractions and async read / write functions for SOCKS5 protocol and Relatively low-level asynchronized SOCKS5 server impleme

null 5 Aug 3, 2023
A Lightning-Fast DNS Resolver written in Rust 🦀

dnsresolver A Lightning-Fast DNS Resolver Table of Contents Installation Usage Basic Usage Resolving Hosts with Ports Virtual Host Enumeration Using U

zoidsec 47 Nov 8, 2023
Dropping GFW DNS contaminated packets based on Rust + eBPF

Dropping GFW DNS contaminated packets based on Rust + eBPF

ihc童鞋@提不起劲 1k Jan 3, 2023
Third party Google DNS client for rust.

google-dns-rs Documentation Install Add the following line to your Cargo.toml file: google-dns-rs = "0.3.0" Usage use google_dns_rs::api::{Dns, DoH, R

Eduardo Stuart 2 Nov 13, 2021
Library + CLI-Tool to measure the TTFB (time to first byte) of HTTP requests. Additionally, this crate measures the times of DNS lookup, TCP connect and TLS handshake.

TTFB: CLI + Lib to Measure the TTFB of HTTP/1.1 Requests Similar to the network tab in Google Chrome or Mozilla Firefox, this crate helps you find the

Philipp Schuster 24 Dec 1, 2022