This project is a fully functional DNS server built from scratch, featuring an HTTP client interface for querying specific domains and record types. The server includes custom logic for parsing and building UDP packets and can recursively resolve any domain of your choice.
- Custom UDP packet parsing and building
- Recursive DNS resolution
- HTTP client interface for user queries
- Support for various DNS record types
-
Clone the repository:
git clone https://github.com/yourusername/custom-dns-server.git cd custom-dns-server
-
Install dependencies:
pnpm install
-
Copy the example environment variables file and set your own values:
cp .env.example .env
-
Setup your free redis at upstash
To start the DNS server in dev, run:
pnpm dev
This will start both the UDP server for DNS queries and the HTTP server for user interactions.
To execute the test suite, run:
pnpm test
The HTTP server provides endpoints for querying DNS records. Here is an example of how to use it:
curl -X GET "http://localhost:8080/resolve?domain=www.ronit.dev&type=A"
This will return the A record for example.com
.