Skip to content

Instantly share code, notes, and snippets.

@tjfontaine
Created June 23, 2013 00:19
Show Gist options
  • Save tjfontaine/5843209 to your computer and use it in GitHub Desktop.
Save tjfontaine/5843209 to your computer and use it in GitHub Desktop.
var dns = require('dns');
var net = require('net');
var _lookup = dns.lookup;
dns.lookup = function(name, cb) {
dns.resolve(name, function (err, ips) {
if (err)
return cb(err);
var rand = Math.floor((Math.random() * ips.length));
var ip = ips[rand];
cb(null, ip, net.isIP(ip));
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment