2.0.1 • Published 3 days ago

tiny-proxy-chain v2.0.1

Weekly downloads
66
License
ISC
Repository
github
Last release
3 days ago

Tiny Proxy Chain

Tiny Proxy Chain is a lightweight tool for Node.js that helps set up a chain of proxies for HTTP and HTTPS traffic. It's designed to be easy and straightforward.

Install

npm i -D tiny-proxy-chain

Example of usage

const TinyProxyChain = require('tiny-proxy-chain')

new TinyProxyChain({
  listenPort: 8080,
  proxyURL: 'http://other-proxy-host:port',
  proxyUsername: 'other-proxy-user',
  proxyPassword: 'other-proxy-password',
  debug: false,
  key: fs.readFileSync('./keys/privkey.pem'),
  cert: fs.readFileSync('./keys/cert.pem'),
  ca: fs.readFileSync('./keys/chain.pem'),
  connectionTimeout: 60000,
  onRequest: (req, defaultProxyOptions) => {
    console.log(`${req.method} ${req.url} HTTP/${req.httpVersion}`)

    if (req.headers['proxy-authorization'] !== TinyProxyChain.makeAuth('tiny-proxy-username', 'tiny-proxy-password')) {
      req.socket.write(
        `HTTP/${req.httpVersion} 407 Proxy Authentication Required\r\n` +
        `Proxy-Authenticate: Basic\r\n\r\n`
      )
    } else {
      delete req.headers['proxy-authorization']
      return defaultProxyOptions
    }
  }
}).listen()

Test

To test Tiny Proxy Chain, you'll need Docker installed on your machine.

npm test
2.0.1

3 days ago

2.0.0

2 months ago

1.7.2

7 months ago

1.7.1

12 months ago

1.7.0

1 year ago

1.6.1

1 year ago

1.6.0

1 year ago

1.5.0

1 year ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago