(obj)
| 1 | export const buildProxyString = function (obj) { |
| 2 | if (!obj.proxyIp) { |
| 3 | return '' |
| 4 | } |
| 5 | |
| 6 | const proxyTypeMapping = { |
| 7 | 5: 'socks5', |
| 8 | 4: 'socks4', |
| 9 | 0: 'http', |
| 10 | 1: 'https' |
| 11 | } |
| 12 | |
| 13 | const proxyType = proxyTypeMapping[obj.proxyType] || '' |
| 14 | const hasCredentials = obj.proxyUsername && obj.proxyPassword |
| 15 | const credentials = hasCredentials ? `${obj.proxyUsername}:${obj.proxyPassword}@` : '' |
| 16 | |
| 17 | return `${proxyType}://${credentials}${obj.proxyIp}${obj.proxyPort ? `:${obj.proxyPort}` : ''}` |
| 18 | } |
no outgoing calls
no test coverage detected