MCPcopy Create free account
hub / github.com/6174/comflowyspace / parseMacProxySettings

Function parseMacProxySettings

apps/node/src/modules/utils/env.ts:75–91  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

73}
74
75function parseMacProxySettings() {
76 const systemProxyString = execSync("scutil --proxy").toString();
77 const proxyTypes = [['HTTP', 'http_proxy'], ['HTTPS', 'https_proxy'], ['SOCKS', 'all_proxy']];
78
79 for (let item of proxyTypes) {
80 const type = item[0];
81 const key = item[1];
82 const proxyPattern = new RegExp(type + "Proxy" + " : (\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})");
83 const portPattern = new RegExp(type + "Port" + " : (\\d+)");
84
85 const address = proxyPattern.exec(systemProxyString);
86 const port = portPattern.exec(systemProxyString);
87 if (address && port) {
88 systemProxy[key] = `http://${address[1]}:${port[1]}`;
89 }
90 }
91}
92
93async function parseWindowsProxySettings() {
94 try {

Callers 1

getSystemProxyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected