luminati-tunnel

1.3.0 • Public • Published

luminati-tunnel

Last version Build Status Coverage Status Dependency status Dev Dependencies Status NPM Status

HTTP/HTTPS tunnel proxy for luminati.io using round robin strategy.

Install

$ npm install luminati-tunnel --save

Usage

The instance is a function that returns a different proxy tunnel every time you call it, using round robin algorithm.

const luminatiTunnel = require('luminati-tunnel')
 
const proxies = [ 'proxy1', 'proxy2', 'proxy3' ]
const tunnel = createTunnel(proxies)
const url = 'http://lumtest.com/echo.json'
 
;(async () => {
  // => it uses 'proxy1'
  await got(url, {
    agent: tunnel(),
    json: true
  })
 
  // => it uses 'proxy2'
  await got(url, {
    agent: tunnel(),
    json: true
  })
 
  // => it uses 'proxy3'
  await got(url, {
    agent: tunnel(),
    json: true
  })
 
  // => it uses 'proxy1'
  await got(url, {
    agent: tunnel(),
    json: true
  })
})()

API

tunnel = luminatiTunnel(proxies, [fromIndex])

proxies

Required
Type: array

A collection of the proxy IPs to use.

You can get it from your luminati.io control panel.

Read more at documentation.

fromIndex

Type: number
Default: 0

It specifies the position of the proxies collection to start.

tunnel

The instance is a function that returns a different proxy tunnel 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

luminati-tunnel © Kiko Beats, released under the MIT License.
Authored and maintained by Kiko Beats with help from contributors.

kikobeats.com · GitHub Kiko Beats · Twitter @Kikobeats

Package Sidebar

Install

npm i luminati-tunnel

Weekly Downloads

2

Version

1.3.0

License

MIT

Unpacked Size

11.9 kB

Total Files

11

Last publish

Collaborators

  • kikobeats