Last active
June 25, 2019 16:05
-
-
Save primayudantra/28c9dfce3eb7f8d89bd9e2d9ac0b2fdf to your computer and use it in GitHub Desktop.
test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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