Socket
Socket
Sign inDemoInstall

@warren-bank/dns-server

Package Overview
Dependencies
2
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @warren-bank/dns-server

A tiny DNS server. Supports a 'hosts' JSON data file. Supports a fallback DNS server.


Version published
Weekly downloads
2
decreased by-83.33%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

dns-server

A tiny DNS server. Supports a 'hosts' JSON data file. Supports a fallback DNS server.


Installation:
npm install --global @warren-bank/dns-server
Usage:
dns-server <options>

========
options:
========
"--help"
    Print a summary of all command-line options.

"-v"
"--version"
    Print the current version.

"-d"
"--debug"
    Print a log of each request.

"-h" <filepath>
"--hosts-file" <filepath>
    Specify path to input 'hosts' JSON file.

"-H" <host [=] IP>
"--host" <host [=] IP>
    Specify a single 'hosts' key/value pair.
    [option can be used more than once]

"-p" <number>
"--port" <number>
    Specify port number for DNS server.
    [default: 53]

"-f" <IP>
"--fallback-server" <IP>
    Specify fallback DNS server
    to resolve hostnames not found in "--hosts-file".
    [default: "1.1.1.1"]
Input 'hosts' JSON file:
  • Object that maps host names (keys) to IP addresses (values)
  • both keys and values are strings
  • keys are not case sensitive
    • when a key begins with the ^ character
      • it is converted to a regular expression
      • all host names that match this regex key are resolved to its corresponding IP address value
    • otherwise
      • only host names that match this exact string value are resolved to its corresponding IP address value
Examples:
  • of specifying a hosts.json file
      dns-server \
        -h "/path/to/hosts.json"
    
  • of specifying 'hosts' mappings without a hosts.json file:
      dns-server \
        -H "foo.local = 192.168.0.101" \
        -H "bar.local = 192.168.0.102" \
        -H "baz.local = 192.168.0.103"
    

Credits:
  • dns2 by Liu Song
    • his library does absolutely all of the heavy lifting
    • his examples show how all of the necessary wiring is done
    • this library just adds a command-line interface and some very simple logic for processing the input 'hosts' JSON file

Keywords

FAQs

Last updated on 14 Oct 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc