UNPKG

global-proxy-agent

Version:

A universal proxy agent for Node.js that combines environment-variable-based proxy resolution with smart protocol-aware agent selection. Automatically supports HTTP, HTTPS, SOCKS, and PAC proxies using a modular, runtime-configurable approach. It also pro

33 lines (32 loc) 934 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.globalState = void 0; exports.setAgent = setAgent; exports.getCurrentProxy = getCurrentProxy; exports.getExcludedDomains = getExcludedDomains; exports.resetProxySettings = resetProxySettings; exports.globalState = { agent: undefined, proxyUrl: '', exclude: [], forceGlobal: true, logging: false, fallbackProxies: [], }; function setAgent(agent) { exports.globalState.agent = agent; } function getCurrentProxy() { return exports.globalState.proxyUrl ?? ''; } function getExcludedDomains() { return exports.globalState.exclude; } function resetProxySettings() { exports.globalState.agent = undefined; exports.globalState.proxyUrl = ''; exports.globalState.exclude = []; exports.globalState.forceGlobal = true; exports.globalState.logging = false; exports.globalState.fallbackProxies = []; }