Skip to content

Commit e13ef75

Browse files
warjiangDcatfly
andcommitted
feat(cli): rm socks5 proxy protocol, reuse https-proxy-agent for http & https protocol
Co-authored-by: Dcatfly <[email protected]>
1 parent e02ac39 commit e13ef75

File tree

3 files changed

+6
-74
lines changed

3 files changed

+6
-74
lines changed

package-lock.json

Lines changed: 1 addition & 65 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/core/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,12 @@
3838
"glob": "^10.4.5",
3939
"google-auth-library": "^9.11.0",
4040
"html-to-text": "^9.0.5",
41-
"http-proxy-agent": "^7.0.2",
4241
"https-proxy-agent": "^7.0.6",
4342
"ignore": "^7.0.0",
4443
"micromatch": "^4.0.8",
4544
"open": "^10.1.2",
4645
"shell-quote": "^1.8.2",
4746
"simple-git": "^3.28.0",
48-
"socks-proxy-agent": "^8.0.5",
4947
"strip-ansi": "^7.1.0",
5048
"undici": "^7.10.0",
5149
"ws": "^8.18.0"

packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
import { Buffer } from 'buffer';
88
import * as https from 'https';
9-
import { SocksProxyAgent } from 'socks-proxy-agent';
10-
import { HttpProxyAgent } from 'http-proxy-agent';
119
import { HttpsProxyAgent } from 'https-proxy-agent';
1210

1311
import {
@@ -402,12 +400,12 @@ export class ClearcutLogger {
402400
getProxyAgent() {
403401
const proxyUrl = this.config?.getProxy();
404402
if (!proxyUrl) return undefined;
405-
if (proxyUrl.startsWith('socks')) {
406-
return new SocksProxyAgent(proxyUrl);
407-
} else if (proxyUrl.startsWith('https')) {
403+
// undici which is widely used in the repo can only support http & https proxy protocol,
404+
// https://github.com/nodejs/undici/issues/2224
405+
// as @Dcatfly metioned, `HttpsProxyAgent` can support https & http proxy protocol at the same time,
406+
// so only use `https-proxy-agent` dependency now.
407+
if (proxyUrl.startsWith('http')) {
408408
return new HttpsProxyAgent(proxyUrl);
409-
} else if (proxyUrl.startsWith('http')) {
410-
return new HttpProxyAgent(proxyUrl);
411409
} else {
412410
throw new Error('Unsupported proxy type');
413411
}

0 commit comments

Comments
 (0)