Flip ip address and login:password in private proxy (proxy with authorization).
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src all tests passed Feb 11, 2019
.babelrc ini Feb 11, 2019
.eslintrc .eslintrc new Feb 11, 2019
.gitignore ini Feb 11, 2019
.npmrc ini Feb 11, 2019
.prettierrc ini Feb 11, 2019
.travis.yml prepublishOnly Feb 15, 2019
LICENSE ini Feb 11, 2019
README.md Update README.md Feb 14, 2019
jest.config.js ini Feb 11, 2019
package.json "split-proxy": "^1.0.3" Feb 16, 2019
tsconfig.json ini Feb 11, 2019

README.md

Proxy Turn Over

Build Status npm

Flip ip address 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:

ipAddress: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' ]