| 42 | const secureEndpoint = options.protocol === 'https:'; |
| 43 | const targetHostname = options.servername || options.hostname; |
| 44 | const connector = new SocksProxyAgent(proxyUrls.get(proxyAgent), { timeout: PROXY_CONNECT_TIMEOUT_MS }); |
| 45 | socket = await connector.connect(new PassThrough(), { |
| 46 | ...proxyAgent.options, |
| 47 | ...options, |
| 48 | host: options.hostname, |
| 49 | port: Number(options.port || (secureEndpoint ? 443 : 80)), |
| 50 | secureEndpoint, |
| 51 | servername: isIP(targetHostname) ? undefined : targetHostname, |
| 52 | checkServerIdentity: (hostname, certificate) => checkServerIdentity(targetHostname, certificate), |
| 53 | ALPNProtocols: ['http/1.1'] |
| 54 | }); |
| 55 | if (secureEndpoint) { |