Skip to content

Pure JavaScript implementation of DNS authoritative server

Notifications You must be signed in to change notification settings

krtnio/dns-authoritative-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DNS Authoritative Server

Installation

$ yarn add @krtn/dns-authoritative-server

Usage

const { TCPServer, UDPServer } = require('@krtn/dns-authoritative-server')

// (optional) restrict responder to handle only specific DNS zone
const zone = 'myzone'

// resolve IP address for the DNS name being requested
async function resolver (name) {
  console.log(`Resolving ${name}`)
  return name === `example.${zone}` ? '1.1.1.1' : null
}

// start UDP listener
const udpServer = new UDPServer(resolver, zone)
udpServer.start(53)

// start TCP listener
const tcpServer = new TCPServer(resolver, zone)
tcpServer.start(53)

About

Pure JavaScript implementation of DNS authoritative server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published