Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions lib/dns.js
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
'use strict';

const net = require('net');
const util = require('util');

const cares = process.binding('cares_wrap');
Expand All@@ -11,7 +10,7 @@ const GetAddrInfoReqWrap = cares.GetAddrInfoReqWrap;
const GetNameInfoReqWrap = cares.GetNameInfoReqWrap;
const QueryReqWrap = cares.QueryReqWrap;

const isIp = net.isIP;
const isIP = cares.isIP;
const isLegalPort = internalNet.isLegalPort;


Expand DownExpand Up@@ -148,7 +147,7 @@ exports.lookup = function lookup(hostname, options, callback) {
return {};
}

var matchedFamily = net.isIP(hostname);
var matchedFamily = isIP(hostname);
if (matchedFamily) {
if (all) {
callback(null, [{address: hostname, family: matchedFamily}]);
Expand DownExpand Up@@ -188,7 +187,7 @@ exports.lookupService = function(host, port, callback) {
if (arguments.length !== 3)
throw new Error('Invalid arguments');

if (cares.isIP(host) === 0)
if (isIP(host) === 0)
throw new TypeError('"host" argument needs to be a valid IP address');

if (port == null || !isLegalPort(port))
Expand DownExpand Up@@ -290,7 +289,7 @@ exports.setServers = function(servers) {
var newSet = [];

servers.forEach(function(serv) {
var ver = isIp(serv);
var ver = isIP(serv);

if (ver)
return newSet.push([ver, serv]);
Expand All@@ -299,13 +298,13 @@ exports.setServers = function(servers) {

// we have an IPv6 in brackets
if (match) {
ver = isIp(match[1]);
ver = isIP(match[1]);
if (ver)
return newSet.push([ver, match[1]]);
}

var s = serv.split(/:\d+$/)[0];
ver = isIp(s);
ver = isIP(s);

if (ver)
return newSet.push([ver, s]);
Expand Down