Socket
Socket
Sign inDemoInstall

@warren-bank/dns-server

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@warren-bank/dns-server - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

11

bin/dns-server/help.js

@@ -20,6 +20,12 @@ const help = `

"-h" <filepath>
"--hosts-file" <filepath>
Specify path to input 'hosts' JSON file.
[required]
"-H" <host [=] IP>
"--host" <host [=] IP>
Specify a single 'hosts' key/value pair.
[option can be used more than once]
"-p" <number>
"--port" <number>

@@ -29,3 +35,4 @@ Specify port number for DNS server.

"--fallback-server" <IP[:port]>
"-f" <IP>
"--fallback-server" <IP>
Specify fallback DNS server

@@ -32,0 +39,0 @@ to resolve hostnames not found in "--hosts-file".

@@ -9,2 +9,3 @@ const process_argv = require('@warren-bank/node-process-argv')

"--hosts-file": {file: "json"},
"--host": {many: true},
"--port": {num: "int"},

@@ -18,5 +19,6 @@ "--fallback-server": {}

"--hosts-file": ["-h", "--hosts", "--file", "-j", "--json"],
"--hosts-file": ["-h"],
"--host": ["-H"],
"--port": ["-p"],
"--fallback-server": ["-f", "-s"]
"--fallback-server": ["-f"]
}

@@ -46,2 +48,18 @@

if (Array.isArray(argv_vals["--host"]) && argv_vals["--host"].length){
const split_token = /[\s:=]+/
for (let host of argv_vals["--host"]) {
const tokens = host.split(split_token).filter(t => !!t)
if (tokens.length === 2) {
if (!argv_vals["--hosts-file"]){
argv_vals["--hosts-file"] = {}
}
argv_vals["--hosts-file"][tokens[0]] = tokens[1]
}
}
}
if (!argv_vals["--hosts-file"]){

@@ -48,0 +66,0 @@ console.log("ERROR: 'hosts.json' file is required.")

2

package.json
{
"name": "@warren-bank/dns-server",
"version": "1.0.0",
"version": "2.0.0",
"main": "lib/process_cli.js",

@@ -5,0 +5,0 @@ "description": "A tiny DNS server. Supports a 'hosts' JSON data file. Supports a fallback DNS server.",

@@ -32,6 +32,12 @@ ### [`dns-server`](https://github.com/warren-bank/node-dns-server)

"-h" <filepath>
"--hosts-file" <filepath>
Specify path to input 'hosts' JSON file.
[required]
"-H" <host [=] IP>
"--host" <host [=] IP>
Specify a single 'hosts' key/value pair.
[option can be used more than once]
"-p" <number>
"--port" <number>

@@ -41,3 +47,4 @@ Specify port number for DNS server.

"--fallback-server" <IP[:port]>
"-f" <IP>
"--fallback-server" <IP>
Specify fallback DNS server

@@ -58,4 +65,18 @@ to resolve hostnames not found in "--hosts-file".

* only host names that match this exact string value are resolved to its corresponding IP address value
* [example](./tests/1a-start-dns-server/hosts.json)
#### Examples:
* of specifying a [`hosts.json`](./tests/1-hosts-file/1a-start-dns-server/hosts.json) file
```bash
dns-server \
-h "/path/to/hosts.json"
```
* of specifying 'hosts' mappings without a `hosts.json` file:
```bash
dns-server \
-H "foo.local = 192.168.0.101" \
-H "bar.local = 192.168.0.102" \
-H "baz.local = 192.168.0.103"
```
- - - -

@@ -62,0 +83,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc