1.0.5 • Published 5 years ago

proxy-turn-over v1.0.5

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

Proxy Turn Over

Build Status npm

Flip host:port and login:password in private proxy (proxy with login and password). If there is a protocol, it will always be at the beginning.

This library relies heavily on split-proxy

npm i proxy-turn-over

Examples:

host:port first (default):

const proxyTurnOver = require('proxy-turn-over');
proxyTurnOver('https://superLogin:superPassword@123.123.2.42:8080');

// return this:
// 'https://123.123.2.42:8080@superLogin:superPassword'

login:password first (need a second argument - 'loginPass'):

const proxyTurnOver = require('proxy-turn-over');
proxyTurnOver('123.123.2.42:8080@superLogin:superPassword', 'loginPass');

// return this:
// 'superLogin:superPassword@123.123.2.42:8080'

Expand proxy array so that login and password always follow @

const proxyTurnOver = require('proxy-turn-over');
const proxyArray = [
  '123.123.2.42:8080@superLogin:superPassword',
  'https://superLogin:superPassword@123.123.2.42:8080',
  '123.123.2.42:8080',
  'superLogin:superPassword@123.123.2.42:9999',
  'login:pass@123.123.2.42:000'
];

const newProxyArray = proxyArray.map((proxy) => {
  return proxyTurnOver(proxy);
});

// return this:
// [ '123.123.2.42:8080@superLogin:superPassword',
//   'https://123.123.2.42:8080@superLogin:superPassword',
//   '123.123.2.42:8080',
//   '123.123.2.42:9999@superLogin:superPassword',
//   '123.123.2.42:000@login:pass' ]
1.0.5

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