UNPKG

domainprobe

Version:

A Node.js package for retrieving detailed information about a domain including its IP address and location.

23 lines (16 loc) 415 B
const dns = require('dns'); let hostnamesfinal = []; function getHostname(ip, callback) { dns.reverse(ip, (err, hostnames) => { if (err) { console.error(err); return callback(err, null); } console.log(`Hostnames for ${ip}:`); hostnames.forEach((hostname) => { hostnamesfinal.push(hostname); }); callback(null, hostnamesfinal); }); } module.exports = getHostname;