11import { socksDispatcher } from 'fetch-socks' ;
22import { HttpsProxyAgent } from 'https-proxy-agent' ;
33import { SocksProxyAgent } from 'socks-proxy-agent' ;
4- import { Agent , ProxyAgent } from 'undici' ;
4+ import { ProxyAgent } from 'undici' ;
55
66type Proxy = {
77 host : string ;
@@ -25,8 +25,7 @@ function selectProxyAgent(proxyUrl: string): HttpsProxyAgent<string> | SocksProx
2525 case PROXY_HTTP_PROTOCOL :
2626 return new HttpsProxyAgent ( url ) ;
2727 case PROXY_SOCKS_PROTOCOL :
28- case PROXY_SOCKS5_PROTOCOL :
29-
28+ case PROXY_SOCKS5_PROTOCOL : {
3029 let urlSocks = '' ;
3130
3231 if ( url . username && url . password ) {
@@ -36,6 +35,7 @@ function selectProxyAgent(proxyUrl: string): HttpsProxyAgent<string> | SocksProx
3635 }
3736
3837 return new SocksProxyAgent ( urlSocks ) ;
38+ }
3939 default :
4040 throw new Error ( `Unsupported proxy protocol: ${ url . protocol } ` ) ;
4141 }
@@ -73,7 +73,6 @@ export function makeProxyAgentUndici(proxy: Proxy | string) {
7373 proxyUrl = `${ protocol } ://${ auth } ${ host } :${ port } ` ;
7474 }
7575
76- // Normalização
7776 protocol = protocol . toLowerCase ( ) ;
7877
7978 const PROXY_HTTP_PROTOCOL = 'http' ;
@@ -84,7 +83,6 @@ export function makeProxyAgentUndici(proxy: Proxy | string) {
8483 switch ( protocol ) {
8584 case PROXY_HTTP_PROTOCOL :
8685 case PROXY_HTTPS_PROTOCOL :
87- // Proxy HTTP/HTTPS → usar ProxyAgent do Undici
8886 return new ProxyAgent ( proxyUrl ) ;
8987
9088 case PROXY_SOCKS4_PROTOCOL :
0 commit comments