Skip to content

Latest commit

 

History

History
69 lines (41 loc) · 1.36 KB

README.MD

File metadata and controls

69 lines (41 loc) · 1.36 KB

Custom DNS Server

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.

Features

  • Custom UDP packet parsing and building
  • Recursive DNS resolution
  • HTTP client interface for user queries
  • Support for various DNS record types

Getting Started

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/custom-dns-server.git
    cd custom-dns-server
  2. Install dependencies:

    pnpm install
  3. Copy the example environment variables file and set your own values:

    cp .env.example .env
  4. Setup your free redis at upstash

Running the Server

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.

Running Tests

To execute the test suite, run:

pnpm test

Usage

HTTP API

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.