proxies-pool
Simple way to handle a pool of proxies using round robin strategy.
Install
$ npm install proxies-pool --save
Usage
The instance is a function that returns a different proxy every time you call it, using round robin algorithm.
const proxiesPool = const proxies = 'proxy1' 'proxy2' 'proxy3'const proxyPool = const url = 'http://lumtest.com/echo.json' const createAgent = agent: http: tunnel ;async { // => it uses 'proxy1' await // => it uses 'proxy2' await // => it uses 'proxy3' await // => it uses 'proxy1' await }
API
proxyPool = proxiesPool(proxies, [fromIndex])
proxies
Required
Type: array
A collection of proxies to use.
You can get it from your luminati.io control panel or any compatible provider.
Read more at documentation.
fromIndex
Type: number
Default: 0
It specifies the position of the proxies
collection to start.
proxyPool
The instance is a function that returns a different proxy every time you call it, using round robin algorithm.
.current()
Returns the current proxy tunnel credential.
.index()
Returns the current proxy tunnel index from the proxies
provided.
.next()
Returns the next proxy tunnel credential.
.previous()
Returns the previous proxy tunnel credential.
.size()
Returns the number of proxies in the pool.
License
proxies-pool © Kiko Beats, released under the MIT License.
Authored and maintained by Kiko Beats with help from contributors.
kikobeats.com · GitHub Kiko Beats · Twitter @Kikobeats