| 73 | } |
| 74 | |
| 75 | function 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 | |
| 93 | async function parseWindowsProxySettings() { |
| 94 | try { |