Split proxy string into protocol, ipAddress, port, login and password.
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
.babelrc
.eslintrc
.gitignore
.npmrc
.prettierrc
.travis.yml
LICENSE
README.md
jest.config.js
package.json
tsconfig.json

README.md

Split Proxy

Build Status npm

Split proxy string into object wish protocol, ipAddress, port, login and password.

npm i split-proxy

Examples:

const splitProxy = require('split-proxy');
splitProxy('123.123.2.42:8080@superLogin:superPassword');

// return this:
// {
//   protocol: '',
//   ipAddress: '123.123.2.42',
//   port: '8080',
//   login: 'superLogin',
//   password: 'superPassword'
// }
const splitProxy = require('split-proxy');
splitProxy('socks5://superLogin:superPassword@123.123.2.42:8080');

// return this:
// {
//   protocol: 'socks5',
//   ipAddress: '123.123.2.42',
//   port: '8080',
//   login: 'superLogin',
//   password: 'superPassword'
// }
const splitProxy = require('split-proxy');
splitProxy('http://localhost:9005');

// return this:
// {
//   protocol: 'http',
//   ipAddress: 'localhost',
//   port: '9005',
//   login: '',
//   password: ''
// }
const splitProxy = require('split-proxy');
splitProxy('https://www.example.com:9005');

// return this:
// {
//   protocol: 'https',
//   ipAddress: 'www.example.com',
//   port: '9005',
//   login: '',
//   password: ''
// }