mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
875 B
30 lines
875 B
15 years ago
|
process.mixin(require("../common"));
|
||
|
var dns = require("dns");
|
||
15 years ago
|
|
||
15 years ago
|
for (var i = 2; i < process.ARGV.length; i++) {
|
||
|
var name = process.ARGV[i]
|
||
15 years ago
|
puts("looking up " + name);
|
||
15 years ago
|
var resolution = dns.resolve4(name);
|
||
15 years ago
|
|
||
|
resolution.addCallback(function (addresses, ttl, cname) {
|
||
|
puts("addresses: " + JSON.stringify(addresses));
|
||
|
puts("ttl: " + JSON.stringify(ttl));
|
||
|
puts("cname: " + JSON.stringify(cname));
|
||
|
|
||
|
for (var i = 0; i < addresses.length; i++) {
|
||
|
var a = addresses[i];
|
||
15 years ago
|
var reversing = dns.reverse(a);
|
||
15 years ago
|
reversing.addCallback( function (domains, ttl, cname) {
|
||
|
puts("reverse for " + a + ": " + JSON.stringify(domains));
|
||
|
});
|
||
|
reversing.addErrback( function (code, msg) {
|
||
|
puts("reverse for " + a + " failed: " + msg);
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
|
||
|
resolution.addErrback(function (code, msg) {
|
||
|
puts("error: " + msg);
|
||
|
});
|
||
|
}
|