Skip to content

Instantly share code, notes, and snippets.

@julien51
Created February 25, 2014 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julien51/9208115 to your computer and use it in GitHub Desktop.
Save julien51/9208115 to your computer and use it in GitHub Desktop.
var dns = require('dns');
var domains = require('./domains.json');
var times = [];
function solveOne(domains) {
var domain = domains.pop();
if(!domain && domain !== '') {
console.log(times);
process.exit();
}
else {
var start = new Date().getTime()
dns.resolve(domain, function (err, addresses) {
times.push(new Date().getTime() - start);
if (err)
console.error('ERROR WITH', domain)
solveOne(domains);
});
}
}
solveOne(domains);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment