Check-proxy is an advanced proxy checking library that powers https://gimmeproxy.com
Check-proxy.com is public backend ping server for the library.
What it does:
It will return a promise that is either fulfilled with an array of working proxies and protocols (some proxies support SOCKS4/SOCKS5 on the same port) or rejected if it wasn't able to connect to provided port.
Install check-proxy library:
npm install check-proxy --save yarn add check-proxy
Obtain an API KEY for our service.
Use the api endpoint as `testHost` parameter: `check-proxy.com/api/v1/test?api_key=YOUR_API_KEY`
Create proxy-test.js with the following code:
const checkProxy = require('check-proxy').check; const proxy = { ip: '107.151.152.218', // proxy ip to test port: 80 // proxy port }; checkProxy({ testHost: 'check-proxy.com/api/v1/test?api_key=YOUR_API_KEY', proxyIP: proxy.ip, proxyPort: proxy.port, localIP: '185.103.27.23', // local machine IP address to test timeout: 10, // max timeout, seconds websites: [ { name: 'example', url: 'http://www.example.com/', regex: /example/gim, // expected result - regex }, { name: 'yandex', url: 'http://www.yandex.ru/', regex: /yandex/gim, // expected result - regex }, { name: 'google', url: 'http://www.google.com/', regex: function(html) { // expected result - custom function return html && html.indexOf('google') != -1; }, }, { name: 'amazon', url: 'http://www.amazon.com/', regex: 'Amazon', // expected result - look for this string in the output } ] }).then(function(res) { console.log('final result', res); }, function(err) { console.log('proxy rejected', err); });
Result (in a promise)
[{ get: true, post: true, cookies: true, referer: true, 'user-agent': true, anonymityLevel: 1, supportsHttps: true, protocol: 'http', ip: '107.151.152.218', port: 80, country: 'MX', connectTime: 0.23, // Time in seconds it took to establish the connection totalTime: 1.1, // Total transaction time in seconds for last the transfer websites: { google: { "responseCode": 200, "connectTime": 0.648131, // seconds "totalTime": 0.890804, // seconds "receivedLength": 1270, // bytes "averageSpeed": 1425 // bytes per second }, amazon: false, ebay: { "responseCode": 200, "connectTime": 0.648131, // seconds "totalTime": 0.890804, // seconds "receivedLength": 1270, // bytes "averageSpeed": 1425 // bytes per second } } }]