(hostname)
| 21 | } |
| 22 | |
| 23 | function shouldBypassProxy(hostname) { |
| 24 | const noProxy = env.NO_PROXY || env.no_proxy || '' |
| 25 | if (!noProxy) return false |
| 26 | |
| 27 | const domains = noProxy |
| 28 | .split(',') |
| 29 | .map((domain) => domain.trim().toLowerCase().replace(/:\d+$/, '')) |
| 30 | const host = hostname.toLowerCase() |
| 31 | |
| 32 | return domains.some((domain) => { |
| 33 | if (domain === '*') return true |
| 34 | if (domain.startsWith('.')) { |
| 35 | return host.endsWith(domain) || host === domain.slice(1) |
| 36 | } |
| 37 | return host === domain || host.endsWith(`.${domain}`) |
| 38 | }) |
| 39 | } |
| 40 | |
| 41 | function connectThroughProxy(proxyUrl, targetHost, targetPort) { |
| 42 | return new Promise((resolve, reject) => { |
no outgoing calls
no test coverage detected