diff --git a/lib/internal/dns/promises.js b/lib/internal/dns/promises.js index cd4607f4857927..2969721355adaa 100644 --- a/lib/internal/dns/promises.js +++ b/lib/internal/dns/promises.js @@ -10,7 +10,7 @@ const { } = require('internal/dns/utils'); const { codes, dnsException } = require('internal/errors'); const { toASCII } = require('internal/idna'); -const { isIP, isIPv4, isLegalPort } = require('internal/net'); +const { isIP, isLegalPort } = require('internal/net'); const { getaddrinfo, getnameinfo, @@ -34,7 +34,7 @@ function onlookup(err, addresses) { return; } - const family = this.family ? this.family : isIPv4(addresses[0]) ? 4 : 6; + const family = this.family ? this.family : isIP(addresses[0]); this.resolve({ address: addresses[0], family }); } @@ -51,7 +51,7 @@ function onlookupall(err, addresses) { addresses[i] = { address, - family: family ? family : isIPv4(addresses[i]) ? 4 : 6 + family: family ? family : isIP(addresses[i]) }; }