npm install nslookup
nslookup('fxck.it')
.server('8.8.8.8') // default is 8.8.8.8
.type('mx') // default is 'a'
.timeout(10 * 1000) // default is 3 * 1000 ms
.end(function (err, addrs) {
console.log(addrs); // => ['66.6.44.4']
});
nslookup(domain)
and chain with methods
nslookup(domain, function (err, addrs))
. Simply query a
type and use 8.8.8.8
.
String or Object
String: .server(8.8.8.8)
Object: .server({ address: '8.8.8.8', port: 53, type: 'udp' })
here can be mx
or a
or ns
e.g.: .type('ns')
default is 3 * 1000 ms.
if timeout, then the NSLookupTimeoutError
error would be callback.
.timeout(3 * 1000)
callback = function (err, addrs)
addrs
is an Array