|
@ -95,11 +95,21 @@ exports.getHostByName = function (domain, callback) { |
|
|
|
|
|
|
|
|
// Easy DNS A/AAAA look up
|
|
|
// Easy DNS A/AAAA look up
|
|
|
exports.lookup = function (domain, callback) { |
|
|
exports.lookup = function (domain, callback) { |
|
|
|
|
|
var addressType = dns.isIP(domain); |
|
|
|
|
|
if (addressType) { |
|
|
|
|
|
process.nextTick(function () { |
|
|
|
|
|
callback(null, domain, addressType); |
|
|
|
|
|
}); |
|
|
|
|
|
} else { |
|
|
|
|
|
sys.puts('AF_INET look up ' + domain); |
|
|
channel.getHostByName(domain, dns.AF_INET, function (err, domains4) { |
|
|
channel.getHostByName(domain, dns.AF_INET, function (err, domains4) { |
|
|
|
|
|
sys.puts('AF_INET result ' + domain + ' ' + sys.inspect(domains4)); |
|
|
if (domains4 && domains4.length) { |
|
|
if (domains4 && domains4.length) { |
|
|
callback(null, domains4[0], 4); |
|
|
callback(null, domains4[0], 4); |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
sys.puts('AF_INET6 look up ' + domain); |
|
|
channel.getHostByName(domain, dns.AF_INET6, function (err, domains6) { |
|
|
channel.getHostByName(domain, dns.AF_INET6, function (err, domains6) { |
|
|
|
|
|
sys.puts('AF_INET6 result ' + domain + ' ' + sys.inspect(domains6)); |
|
|
if (domains6 && domains6.length) { |
|
|
if (domains6 && domains6.length) { |
|
|
callback(null, domains6[0], 6); |
|
|
callback(null, domains6[0], 6); |
|
|
} else { |
|
|
} else { |
|
@ -108,6 +118,7 @@ exports.lookup = function (domain, callback) { |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|