How to use the pac-proxy-agent function in pac-proxy-agent

To help you get started, we’ve selected a few pac-proxy-agent examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github poooi / poi / lib / proxy.es View on Github external
const username = config.get('proxy.http.username', '')
        const password = config.get('proxy.http.password', '')
        const useAuth = requirePassword && username !== '' && password !== ''
        const strAuth = `${username}:${password}@`
        const uri = `http://${useAuth ? strAuth : ''}${host}:${port}`
        if (!this.httpAgents[uri]) {
          this.httpAgents[uri] = new HttpProxyAgent(uri)
        }
        options.agent = this.httpAgents[uri]
        break
      }
      // PAC
      case 'pac': {
        const uri = config.get('proxy.pacAddr')
        if (!this.pacAgents[uri]) {
          this.pacAgents[uri] = new PacProxyAgent(uri)
        }
        options.agent = this.pacAgents[uri]
        break
      }
    }
    return options
  }
github trazyn / ieaseMusic / server / provider / index.js View on Github external
plugins.map(e => {
            if (proxy && e.proxy) {
                if (proxy.endsWith('.pac')) {
                    Object.assign(
                        rpOptions,
                        {
                            agent: new PacProxyAgent(proxy)
                        }
                    );
                } else {
                    Object.assign(
                        rpOptions,
                        {
                            proxy,
                        }
                    );
                }
            }
            // If a request failed will keep waiting for other possible successes, if a request successed,
            // treat it as a rejection so Promise.all immediate break.
            return e.enginner(rp, ...args).then(
                val => Promise.reject(val),
                err => Promise.resolve(err)

pac-proxy-agent

A PAC file proxy `http.Agent` implementation for HTTP

MIT
Latest version published 8 months ago

Package Health Score

84 / 100
Full package analysis

Popular pac-proxy-agent functions