Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rtpa25/dns-server

A fully functional prototype DNS server built with NodeJS and Typescript
https://github.com/rtpa25/dns-server

dns nodejs typescript

Last synced: about 1 month ago
JSON representation

A fully functional prototype DNS server built with NodeJS and Typescript

Awesome Lists containing this project

README

        

# 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:

```sh
git clone https://github.com/yourusername/custom-dns-server.git
cd custom-dns-server
```

2. Install dependencies:

```sh
pnpm install
```

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

```sh
cp .env.example .env
```

4. Setup your free redis at [upstash](https://console.upstash.com/redis/)

### Running the Server

To start the DNS server in dev, run:

```sh
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:

```sh
pnpm test
```

## Usage

### HTTP API

The HTTP server provides endpoints for querying DNS records. Here is an example of how to use it:

```sh
curl -X GET "http://localhost:8080/resolve?domain=www.ronit.dev&type=A"
```

This will return the A record for `example.com`.