This commit is contained in:
Jeferson Ramos 2025-11-19 14:02:52 -03:00
parent 31a6f2d92e
commit 179af3f41c

View File

@ -1,8 +1,7 @@
import { ProxyAgent } from 'undici';
import { HttpsProxyAgent } from 'https-proxy-agent';
import { SocksProxyAgent } from 'socks-proxy-agent';
import { ProxyAgent } from 'undici'
type Proxy = {
host: string;
password?: string;
@ -47,7 +46,7 @@ export function makeProxyAgent(proxy: Proxy | string): HttpsProxyAgent<string> |
return selectProxyAgent(proxyUrl);
}
export function makeProxyAgentUndici(proxy: Proxy | string): ProxyAgent|SocksProxyAgent {
export function makeProxyAgentUndici(proxy: Proxy | string): ProxyAgent | SocksProxyAgent {
let proxyUrl: string;
let protocol: string;
@ -65,8 +64,8 @@ export function makeProxyAgentUndici(proxy: Proxy | string): ProxyAgent|SocksPro
const auth = username && password ? `${username}:${password}@` : '';
proxyUrl = `${protocol}://${auth}${host}:${port}`;
}
;
};
const PROXY_HTTP_PROTOCOL = 'http';
const PROXY_HTTPS_PROTOCOL = 'https';
const PROXY_SOCKS4_PROTOCOL = 'socks4';