https://github.com/ganevdev/proxy-turn-over
Flip host:port and login:password in private proxy (proxy with authorization).
https://github.com/ganevdev/proxy-turn-over
Last synced: 8 months ago
JSON representation
Flip host:port and login:password in private proxy (proxy with authorization).
- Host: GitHub
- URL: https://github.com/ganevdev/proxy-turn-over
- Owner: ganevdev
- License: mit
- Created: 2019-02-11T18:41:23.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-08T09:13:32.000Z (almost 7 years ago)
- Last Synced: 2025-05-25T18:50:43.991Z (9 months ago)
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/proxy-turn-over
- Size: 17.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Proxy Turn Over
[](https://travis-ci.com/Ganevru/proxy-turn-over)
[](http://npm.im/proxy-turn-over)
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](https://github.com/Ganevru/split-proxy)
```bash
npm i proxy-turn-over
```
Examples:
host:port first (default):
```javascript
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'):
```javascript
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 @
```javascript
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' ]
```