chore: workaround socks/https agent servername deprecated message

This commit is contained in:
Max Schmitt 2024-11-11 13:14:02 +01:00
parent 503f74da90
commit dfa7575e6e
4 changed files with 1262 additions and 3 deletions

File diff suppressed because it is too large Load diff

View file

@ -6,7 +6,8 @@
"esbuild": "node build.js",
"build": "npm run esbuild -- --minify",
"watch": "npm run esbuild -- --watch --sourcemap",
"generate-license": "node ../../../../utils/generate_third_party_notice.js"
"generate-license": "node ../../../../utils/generate_third_party_notice.js",
"postinstall": "patch-package"
},
"dependencies": {
"colors": "1.4.0",
@ -40,6 +41,7 @@
"@types/proper-lockfile": "^4.1.2",
"@types/proxy-from-env": "^1.0.1",
"@types/stack-utils": "^2.0.1",
"@types/ws": "8.2.2"
"@types/ws": "8.2.2",
"patch-package": "^8.0.0"
}
}

View file

@ -0,0 +1,22 @@
diff --git a/node_modules/https-proxy-agent/dist/index.js b/node_modules/https-proxy-agent/dist/index.js
index 0c91722..4c420aa 100644
--- a/node_modules/https-proxy-agent/dist/index.js
+++ b/node_modules/https-proxy-agent/dist/index.js
@@ -85,7 +85,7 @@ class HttpsProxyAgent extends agent_base_1.Agent {
const servername = this.connectOpts.servername || this.connectOpts.host;
socket = tls.connect({
...this.connectOpts,
- servername,
+ servername: servername && net.isIP(servername) ? undefined : servername,
});
}
else {
@@ -126,7 +126,7 @@ class HttpsProxyAgent extends agent_base_1.Agent {
return tls.connect({
...omit(opts, 'host', 'path', 'port'),
socket,
- servername,
+ servername: net.isIP(servername) ? undefined : servername,
});
}
return socket;

View file

@ -0,0 +1,21 @@
diff --git a/node_modules/socks-proxy-agent/dist/index.js b/node_modules/socks-proxy-agent/dist/index.js
index a9b5db2..968f0e1 100644
--- a/node_modules/socks-proxy-agent/dist/index.js
+++ b/node_modules/socks-proxy-agent/dist/index.js
@@ -32,6 +32,7 @@ const agent_base_1 = require("agent-base");
const debug_1 = __importDefault(require("debug"));
const dns = __importStar(require("dns"));
const tls = __importStar(require("tls"));
+const net = __importStar(require("net"));
const url_1 = require("url");
const debug = (0, debug_1.default)('socks-proxy-agent');
function parseSocksURL(url) {
@@ -153,7 +154,7 @@ class SocksProxyAgent extends agent_base_1.Agent {
const tlsSocket = tls.connect({
...omit(opts, 'host', 'path', 'port'),
socket,
- servername,
+ servername: (!servername || net.isIP(servername)) ? undefined : servername,
});
tlsSocket.once('error', (error) => {
debug('Socket TLS error', error.message);