nodejs18/dns.patch

31 lines
747 B
Diff
Raw Normal View History

Index: node-v18.7.0/lib/net.js
===================================================================
--- node-v18.7.0.orig/lib/net.js
+++ node-v18.7.0/lib/net.js
@@ -1072,6 +1072,16 @@ Socket.prototype.connect = function(...a
return this;
};
+function socketToDnsFamily(family) {
+ switch (family) {
+ case 'IPv4':
+ return 4;
+ case 'IPv6':
+ return 6;
+ }
+
+ return family;
+}
function lookupAndConnect(self, options) {
const { localAddress, localPort } = options;
@@ -1114,7 +1124,7 @@ function lookupAndConnect(self, options)
if (dns === undefined) dns = require('dns');
const dnsopts = {
- family: options.family,
+ family: socketToDnsFamily(options.family),
hints: options.hints || 0
};