Skip to content

Instantly share code, notes, and snippets.

@primayudantra
Last active June 25, 2019 16:05
Show Gist options
  • Save primayudantra/28c9dfce3eb7f8d89bd9e2d9ac0b2fdf to your computer and use it in GitHub Desktop.
Save primayudantra/28c9dfce3eb7f8d89bd9e2d9ac0b2fdf to your computer and use it in GitHub Desktop.
test.js
var dns = require('dns');
function lookup(domain) {
return new Promise((resolve, reject) => {
dns.reverse(domain, (err, address, family) => {
if (err) {
reject(err)
} else {
resolve(address)
}
})
})
}
async function test() {
let ipAddress = await lookup('213.46.228.196');
console.log(ipAddress[0])
}
test()
var dns = require('dns');
function reverseLookup(ip, cb) {
dns.reverse(ip, function(err,domains){
if(err!=null) callback(err);
cb(domains)
});
}
reverseLookup('213.46.228.196', (data) =>{
var domains = data[0];
console.log(domains);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment