proxic-client

Node client for the proxic HTTP proxy server

Usage no npm install needed!

<script type="module">
  import proxicClient from 'https://cdn.skypack.dev/proxic-client';
</script>

README

proxic-client

Node client for the Proxic HTTP proxy server

Install

npm i proxic-client

Run local Proxic server for testing

docker run -it -p 5135:5135 -e keysize=4096 ethanent/proxic:1.0.0

Connect to local server and make a request

const { Client } = require('proxic-client')

const mainC = new Client({
    'host': 'localhost',
    'port': 5135,
    'rejectUnauthorized': false // Recommended to avoid disabling rejectUnauthorized in production. Consider using your own certificates in the Proxic container with volumes.
})

mainC.on('connect', async () => {
    console.log('Connected.')

    console.log((await mainC.request({
        'url': 'https://ethanent.me'
    })).body.toString())
})

Properties of a response

See the protospec definition for some information about the response.

Response has a headers object, a body buffer, and a statusCode integer.

Disable persist connection

Disabling persistConnection causes the client to create new connections for each request. Disabling may harm performance.

const mainC = new Client({
    // ...,
    'persistConnection': false
})