A simple DNS proxy that lets you intercept domains and route them to whatever IP you decide
A simple DNS proxy that lets you intercept domains and route them to whatever IP you decide.
It's available through npm:
npm install dnsjack
It's easy to use:
var jack = require'dnsjack'createServer;jackroute'www.google.com' '127.0.0.1'; // route all requests to www.google.com to localhostjacklisten; // it listens on the standard DNS port of 53 per default// now all requests to google.com should be routed localhostrequire'http'createServerreswriteHead200;resend'jack says hi!';listen80;
You probably need to run the above example with
sudo as we need to listen to port
Now change your local DNS server to
127.0.0.1 and visit
http://www.google.com in your browser.
DNSJack will forward all request that you don't route yourself to Google's DNS server or whatever DNS
you provide in
You can also use it to monitor your DNS resolutions which can be super useful for debugging:
var jack = require'dnsjack'createServer;jackon'resolve'console.log'Someone is resolving' domain;;jacklisten;