parse-proxy is a lightweight Node.js proxy string parsing library
- parses a string of proxies into an array of proxy objects
- supports multiple delimiters (comma, newline, space)
- supports proxy authentication
- supports proxy protocols
npm install @devhigley/parse-proxy
yarn add @devhigley/parse-proxy
const parseProxy = require("@devhigley/parse-proxy");
parseProxy(`1.1.1.1:80, 2.2.2.2:80, 3.3.3.3:80`);
[
{ host: '1.1.1.1', port: 80, protocol: 'http' },
{ host: '2.2.2.2', port: 80, protocol: 'http' },
{ host: '3.3.3.3', port: 80, protocol: 'http' }
]
const parseProxy = require("@devhigley/parse-proxy");
parseProxy(`https://user:pass@104.236.55.48:8080
https://user:pass@213.105.29.14:3128`);
[
{
host: '104.236.55.48',
port: 8080,
protocol: 'https',
auth: { username: 'user', password: 'pass' }
},
{
host: '213.105.29.14',
port: 3128,
protocol: 'https',
auth: { username: 'user', password: 'pass' }
}
]