Skip to content
forked from wyhaya/updns

🚀 DNS proxy tools developed with node, you can intercept any domain name and return any ip you need

License

Notifications You must be signed in to change notification settings

ksteckert/updns

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Command Explain
updns start Start the DNS service
updns stop Stop the DNS services
updns config Using vim to edit the configuration file
updns restart Restart the dns service
updns log Using less to view log files
updns path Display the installation directory of updns
updns version View 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

About

🚀 DNS proxy tools developed with node, you can intercept any domain name and return any ip you need

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%