Split Proxy
Split proxy string into object wish protocol, host, port, login and password.
npm i split-proxy
Examples
const splitProxy = ;; // return this:// {// protocol: '',// host: '123.123.2.42',// port: '8080',// login: 'superLogin',// password: 'superPassword'// }
const splitProxy = ;; // return this:// {// protocol: 'socks5',// host: '123.123.2.42',// port: '8080',// login: 'superLogin',// password: 'superPassword'// }
const splitProxy = ;; // return this:// {// protocol: 'http',// host: 'localhost',// port: '9005',// login: '',// password: ''// }
const splitProxy = ;; // return this:// {// protocol: 'https',// host: 'www.example.com',// port: '9005',// login: '',// password: ''// }
const splitProxy = ;; // return this:// {// protocol: '',// host: '123.123.2.42',// port: '',// login: '',// password: ''// }
const splitProxy = ;; // return this:// {// protocol: 'http',// host: '123.123.2.42',// port: '',// login: '',// password: ''// }
axios examples
{ mode: 'axios' }
special mode for use with library axios (with proxy config options) - it returns an object with the same names and formats as required by axios
. It also never returns empty values.
const splitProxy = ;; // return this:// {// host: '123.123.2.42',// port: 8080,// auth: {// username: 'mikeymike',// password: 'rapunz3l'// }// }
const splitProxy = ;; // return this:// {// host: '123.123.2.42',// port: 8080// }
const splitProxy = ;; // return this:// {// host: 'localhost'// }
node-tunnel examples
Mode for node-tunnel, returns an object with the same names and formats as required by node-tunnel
. It also never returns empty values.
const splitProxy = ;; // return this:// {// host: '123.123.2.42',// port: 8080,// proxyAuth: 'superLogin:superPassword'// }
const splitProxy = ;; // return this:// {// host: '123.123.2.42',// port: 8080// }
const splitProxy = ;; // return this:// {// host: 'localhost'// }