1.3.0 • Published 5 years ago

luminati-tunnel v1.3.0

Weekly downloads
6
License
MIT
Repository
github
Last release
5 years ago

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.

npm.io

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