MCPcopy
hub / github.com/electerm/electerm / buildProxyString

Function buildProxyString

src/client/common/build-proxy.js:1–18  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

1export 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}

Callers 3

fixBookmarksFunction · 0.90
fixConfFunction · 0.85
fixBookmarksFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected