1.3.1 • Published 7 years ago

updns v1.3.1

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

updns

Build Status Download npm version node License codebeat


updns is a DNS server developed using node, only need a simple configuration to get started, you can intercept any domain name and return any ip you need.

Running as a Service

npm install -g updns

Config

We configure routing in the way of hosts

You can use updns config command and then call vim quick edit, or find the module's installation directory and edit the config/hosts file

The service can be bound to an IP and port, such as for a specific ethernet adapter or any valid loopback address (127.0.0.42)

You can specify standard domains, or utilize regular expressions for dynamic matching

bind              0.0.0.0:53     # address => port (requires restarting the service)
proxy             8.8.8.8        # proxy => DNS Server
google.com        1.1.1.1        # domain => IP
/goo+gle\.com/    2.2.2.2        # regex: gooooooooooogle.com => IP

Start to use

updns start

You may use sudo to run this command because you will use the 53 port, make sure you have sufficient permissions.

Now change your local DNS server to 127.0.0.1 🚀

Other

CommandExplain
updns startStart the DNS service
updns stopStop the DNS services
updns configUsing vim to edit the configuration file
updns restartRestart the dns service
updns logUsing less to view log files
updns pathDisplay the installation directory of updns
updns versionView version

Create DNS Server

You can also create your DNS server as a module

npm install updns

If an IP address is not specified, the port will be bound globally (0.0.0.0)

const updns = require('updns').createServer(53, '127.0.0.1')

updns.on('error', error => {
    console.log(error)
})

updns.on('listening', server => {
    console.log('DNS service has started')
})

updns.on('message', (domain, send, proxy) => {
    if(domain === 'google.com'){
        send('123.123.123.123')
    }else {
        proxy('8.8.8.8')
    }
})

License

MIT license

1.3.1

7 years ago

1.3.0

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.0.1

8 years ago

0.0.0

8 years ago