summaryrefslogtreecommitdiff
path: root/lib/dns.js
diff options
context:
space:
mode:
authorPaul Querna <pquerna@apache.org>2010-09-16 14:58:04 -0700
committerRyan Dahl <ry@tinyclouds.org>2010-09-16 17:27:10 -0700
commitc8f9728de7510a539b4460b5280f90934b2fa9a5 (patch)
treed848c5cb97aa3bc2da007e3b27fb1de4923b877e /lib/dns.js
parent251d03197f05cc17ea35f811803f9acbfb30d016 (diff)
downloadnode-c8f9728de7510a539b4460b5280f90934b2fa9a5.tar.gz
Move dns.isIP to net.isIP
Add tests and docs.
Diffstat (limited to 'lib/dns.js')
-rw-r--r--lib/dns.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/dns.js b/lib/dns.js
index 532f15abb..8f9ce768b 100644
--- a/lib/dns.js
+++ b/lib/dns.js
@@ -1,4 +1,5 @@
var dns = process.binding('cares');
+var net = process.binding('net');
var watchers = {};
@@ -71,8 +72,6 @@ var channel = new dns.Channel({SOCK_STATE_CB: function (socket, read, write) {
updateTimer();
}});
-exports.isIP = dns.isIP;
-
exports.resolve = function (domain, type_, callback_) {
var type, callback;
if (typeof(type_) == 'string') {
@@ -133,7 +132,7 @@ exports.lookup = function (domain, family, callback) {
callback(null, null, family === 6 ? 6 : 4);
return;
}
- var matchedFamily = dns.isIP(domain);
+ var matchedFamily = net.isIP(domain);
if (matchedFamily) {
callback(null, domain, matchedFamily);
} else {
@@ -149,7 +148,7 @@ exports.lookup = function (domain, family, callback) {
var af = familyToSym(family);
channel.getHostByName(domain, af, function (err, domains) {
if (!err && domains && domains.length) {
- if (family !== dns.isIP(domains[0])) {
+ if (family !== net.isIP(domains[0])) {
callback(new Error('not found'), []);
} else {
callback(null, domains[0], family);