From 697c6820bd4f0fbfe890b2c47997f361d94f4a2a Mon Sep 17 00:00:00 2001 From: Matthew Zipkin Date: Thu, 3 Mar 2022 11:51:02 -0500 Subject: [PATCH 1/2] resolver: parse inet6 option in UnboundResolver --- lib/resolver/ub.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/resolver/ub.js b/lib/resolver/ub.js index c6b663b..175bc42 100644 --- a/lib/resolver/ub.js +++ b/lib/resolver/ub.js @@ -141,6 +141,11 @@ class UnboundResolver extends EventEmitter { this.minimize = options.minimize; } + if (options.inet6 != null) { + assert(typeof options.inet6 === 'boolean'); + this.inet6 = options.inet6; + } + return this; } From 4471dad0e0d47bafb0353f8aa355094f9dc4f201 Mon Sep 17 00:00:00 2001 From: Matthew Zipkin Date: Thu, 3 Mar 2022 12:59:39 -0500 Subject: [PATCH 2/2] Use less-restrictive method to determine default IPv6 status --- lib/internal/net.js | 2 +- lib/resolver/ub.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/net.js b/lib/internal/net.js index 4ad5ee0..fcfd894 100644 --- a/lib/internal/net.js +++ b/lib/internal/net.js @@ -13,7 +13,7 @@ const tcp = require('btcp'); const udp = require('budp'); const bio = require('bufio'); const util = require('../util'); -const hasIPv6 = IP.getPublic('ipv6').length > 0; +const hasIPv6 = IP.getInterfaces('ipv6').length > 0; /** * Base diff --git a/lib/resolver/ub.js b/lib/resolver/ub.js index 175bc42..e6eab93 100644 --- a/lib/resolver/ub.js +++ b/lib/resolver/ub.js @@ -44,7 +44,7 @@ class UnboundResolver extends EventEmitter { constructor(options) { super(); - this.inet6 = false; + this.inet6 = IP.getInterfaces('ipv6').length > 0;; this.tcp = false; this.forceTCP = false; this.maxAttempts = 3;