NodeJS library without any external dependencies to check if free HTTP/SOCKS4/SOCKS5 proxies are working/up

Overview

free-proxy_checker

NodeJS library WITHOUT any external dependencies to:

  • download free proxies;
  • check if free HTTP/SOCKS4/SOCKS5 proxies are working/up.

Proxy testing protocol

HTTP

To test HTTP proxies, the library makes an HTTP CONNECT request to the proxy host/IP and port. If the request doesn't generate an error/timeout and if the status code is 200, we consider the proxy is UP. We do that to ignore proxies that are up but that ignore/block our request.

SOCKS4/5

To test SOCKS proxies, we establish create a TCP socket using net.Socket and try to establish a connection with the proxy. If the connection is successful (no error and no timeout), we consider the proxy is UP.

Library installation

npm install free-proxy-checker

Library usage

You can find examples in the /examples directory.

Downloading and testing free proxies

const {ProxyChecker, ProxyScrapeDownloader, FoxtoolsDownloader, FreeProxyListDownloader, downloadAllProxies} = require('free-proxy-checker');

(async () => {
    // We can download proxies from a particular proxy provider, e.g. proxyscrape, foxtools, freeproxylist and my proxy
    const proxyScrapeDownloader = new ProxyScrapeDownloader();
    const proxyScrapeProxies = await proxyScrapeDownloader.download();

    const foxtoolsDownloader = new FoxtoolsDownloader();
    const foxtoolsProxies = await foxtoolsDownloader.download();

    // We can also download all proxies from all proxy providers at once
    const allProxies = await downloadAllProxies();

    // Then, we can check the availability of the proxies we downloaded
    const proxyChecker = new ProxyChecker(allProxies, {
        concurrency: 25,
        timeout: 7500,
        verbose: true
    })

    await proxyChecker.checkProxies();
    const proxiesUp = proxyChecker.getProxiesUp();
    console.log(`There are ${proxiesUp.length} proxies UP:`);
    console.log(proxiesUp);
})();

Testing if proxies are UP/DOWN

The code snippet below shows how you can create HttpProxy and SocksProxy to create proxy instances, and pass them to a ProxyChecker to verify their availability.

const {HttpProxy, SocksProxy, ProxyChecker} = require('free-proxy-checker');


(async () => {
    const proxies = [];
    proxies.push(new HttpProxy('112.6.117.178', '8085'));
    proxies.push(new SocksProxy('5.153.140.180', '4145'));


    const proxyChecker = new ProxyChecker(proxies, {
        concurrency: 15,
        timeout: 7500,
        verbose: 30
    })

    await proxyChecker.checkProxies();
    let proxiesUp = proxyChecker.getProxiesUp();
    console.log(`There are ${proxiesUp.length} proxies UP:`);
    console.log(proxiesUp);
})();

Remarks

For the moment the library is really basic, it only checks if a proxy is UP/DOWN. It doesn't store any data about latency. Feel free to open an issue if you have a feature request. I may add it to the library if I feel like it's relevant.

You might also like...

Simple scrollspy without jQuery, no dependencies

Simple Scrollspy Simple scrollspy is a lightweight javascript library without jQuery, no dependencies. It is used to make scrollspy effect for your me

Dec 13, 2022

Generally free coding Resources for all! Check it out and don't forget to give it a star ⭐️

Generally free coding Resources for all! Check it out and don't forget to give it a star ⭐️

A-Z Coding Resources This website is built using Docusaurus 2, a modern static website generator. Installation yarn install Local Development yarn sta

Jan 2, 2023

A simple To-do app project made using JavaScript ES6 and Webpack - Microverse. You can add, remove, check tasks, and remove all the tasks that were done at the same time. Feel free to see the live version, if you like it please give it a star!

To Do List a to do list javascript app buit using webpack and es6. Built With HTML CSS JavaScript Wepack Live Demo (if available) Live Demo Link Getti

Dec 17, 2022

This app offers users a quick way to check the current temperature and humidity of any location in the world.

This app offers users a quick way to check the current temperature and humidity of any location in the world.

Pretty Weather App This app offers users a quick way to check weather data for any location in the world. The specific data provided by the app includ

Jun 7, 2022

Completely free TS/JS one-file source code snippets with tests, which can be copied to avoid extra dependencies (contributions welcome).

TinySource Completely free TS/JS one-file source code snippets with tests, which can be copied to avoid extra dependencies (contributions welcome). Sn

Jan 3, 2023

Mag🔥Lit - A super fast and easy-to-use free and open source private encrypted Magnet/HTTP(s) Link Shortener

Mag🔥Lit - A super fast and easy-to-use free and open source private encrypted Magnet/HTTP(s) Link Shortener

Mag 🔥 Lit Mag 🔥 Lit - A super fast and easy-to-use free and open source private encrypted Magnet/HTTP(s) Link Shortener https://maglit.ml Features ✅

Jan 8, 2023

nodejs load balancing app to distribute http requests evenly across multiple servers.

nodejs load balancing app to distribute http requests evenly across multiple servers.

load-balancer-nodejs nodejs load balancing app to distribute http requests evenly across multiple servers. How to use ? Please edit the file 'config.j

Nov 7, 2022

A tiny JavaScript library to easily toggle the state of any HTML element in any contexts, and create UI components in no time.

A tiny JavaScript library to easily toggle the state of any HTML element in any contexts, and create UI components in no time.

A tiny JavaScript library to easily toggle the state of any HTML element in any contexts, and create UI components in no time. Dropdown, navigation bu

Nov 25, 2022

A simple Node.js code to get unlimited instagram public pictures by every user without api, without credentials.

A simple Node.js code to get unlimited instagram public pictures by every user without api, without credentials.

Instagram Without APIs Instagram Scraping in August 2022, no credentials required This is a Node.js library, are you looking for the same in PHP? go t

Dec 29, 2022
Comments
  • [enhacement] Use Flexible ascii progress bar.

    [enhacement] Use Flexible ascii progress bar.

    For a better understanding of the progress of the proxies checks, here is an example of code using an flexible ascii progress bar: node-progress.

    Rem: Pool is not accessible via require('free-proxy-checker')

    // https://github.com/antoinevastel/free_proxy_checker
    const { ProxyChecker, downloadAllProxies, } = require('free-proxy-checker');
    // https://github.com/visionmedia/node-progress
    const ProgressBar = require('progress');
    
    const { Pool } = require('./pool.js');
    
    class ProgressProxyChecker extends ProxyChecker {
        async checkProxies() {
            this.lastCheck = Date.now();
            const pool = new Pool(this.options.concurrency);
            const pbar = new ProgressBar('Checking proxies [:bar] :percent :etas', {
                complete: '=',
                incomplete: ' ',
                width: 20,
                total: this.proxies.length
            });
    
            this.proxies.forEach((proxy) => {
                pool.addTask(async() => {
                    try {
                        await proxy._testConnection(this.options.timeout);
                    } catch (_) { }
                    finally {
                        if (this.options.verbose) {
                            pbar.tick();
                        }
                    }
                })
            })
    
            await pool.run();
        }
    }
    
    (async () => {
        // Clear console
        process.stdout.write('\033c');
    
        // Download all proxies from all proxy providers at once
        const allProxies = await downloadAllProxies();
        console.log(`There are ${allProxies.length} proxies to test`);
    
        // Check the availability of the proxies we downloaded
        const proxyChecker = new ProgressProxyChecker(allProxies, {
            concurrency: 50,
            timeout: 7500,
            verbose: true
        })
    
        await proxyChecker.checkProxies();
        const proxiesUp = proxyChecker.getProxiesUp();
        console.log(`There are ${proxiesUp.length} proxies UP:`);
    })();
    

    Result: image

    opened by LeMoussel 2
  • New proxy providers

    New proxy providers

    Add 2 new proxy providers:

    • geonode
    • spys me

    Fix bug when deduplicating proxies while calling downloadAllProxies. I was leveraging Set of objects in JS. However, there were still duplicates since objects were considered unique as they didn't have the same reference (even though they had the same values)

    Improve verification before creating proxies. Check if host is a proper IP.

    opened by antoinevastel 0
  • [enhacement] Use of Proxy Judge To test proxies.

    [enhacement] Use of Proxy Judge To test proxies.

    I think it would be more interesting to use a Proxy Judge like azenv.php to test the proxies (see: http://azenv.net/, http://httpheader.net/azenv.php).

    Moreover with a Proxy Judge we can know what is

    • the type of anonymity of the proxy.
    • the response time of the proxy.
    opened by LeMoussel 0
  • [enhacement] Getting country codes/names of proxy

    [enhacement] Getting country codes/names of proxy

    It would be interesting to resolve IPs proxies to country codes/names. To do this, we can use a free service such as

    Example ip2c: https://ip2c.org/1.0.205.8 Result: 1;TH;THA;Thailand

    Example ipwhois: https://ipwhois.app/json/1.0.205.8 Result:

    {
      "ip": "1.0.205.8",
      "success": true,
      "type": "IPv4",
      "continent": "Asia",
      "continent_code": "AS",
      "country": "Thailand",
      "country_code": "TH",
      "country_flag": "https://cdn.ipwhois.io/flags/th.svg",
      "country_capital": "Bangkok",
      "country_phone": "+66",
      "country_neighbours": "LA,MM,KH,MY",
      "region": "Phuket",
      "city": "Thalang District",
      "latitude": 8.0320027,
      "longitude": 98.3334626,
      "asn": "AS23969",
      "org": "TOT Public Company Limited",
      "isp": "TOT Public Company Limited",
      "timezone": "Asia/Bangkok",
      "timezone_name": "Indochina Time",
      "timezone_dstOffset": 0,
      "timezone_gmtOffset": 25200,
      "timezone_gmt": "GMT +7:00",
      "currency": "Thai Baht",
      "currency_code": "THB",
      "currency_symbol": "฿",
      "currency_rates": 33.562,
      "currency_plural": "Thai baht",
      "completed_requests": 2
    }
    
    
    opened by LeMoussel 0
Owner
antoine vastel
antoine vastel
CLI Progress Bar implemented in NodeJS to track Time, ETA and Steps for any long running jobs in any loops in JS, NodeJS code

NodeJS-ProgressBar CLI Progress Bar for NodeJS and JavaScript to track Time, ETA and Steps for any long running jobs in any loops in JS, NodeJS code D

Atanu Sarkar 5 Nov 14, 2022
JavaScript enums using proxies.

enum-xyz JavaScript enums using proxies. Based on this tweet Install $ npm install enum-xyz --save Usage Strings import Enum from 'enum-xyz' const {

Chase Fleming 38 Oct 22, 2022
🚀 A Node.js server that automaticaly finds and checks proxies for you.

Proxi A Node.js app that automaticaly finds and checks proxies for you and shows them on a dashboard. Install & Setup ## Download git clone https://gi

Jareer Abdullah 8 Jul 7, 2022
Calculating Pi number without limitation until 10k digits or more in your browser powered by JS without any third party library!

PI Calculator Web JS (Online) Calculating Pi number without limitation until 10k digits or more in your browser powered by JS without any third party

Max Base 6 Jul 27, 2022
📡Usagi-http-interaction: A library for interacting with Http Interaction API

?? - A library for interacting with Http Interaction API (API for receiving interactions.)

Rabbit House Corp 3 Oct 24, 2022
A mobile web application to check the data on the total covid19 confirmed cases and deaths, check data for all countries with recorded cases.

This is a mobile web application to check the data on the total covid19 confirmed cases and deaths, check data for all countries with recorded cases. It also has a details page to check for the statistics for each region/state if available.

Solomon Hagan 7 Jul 30, 2022
Responsive navigation plugin without library dependencies and with fast touch screen support.

Responsive Nav Responsive navigation plugin without library dependencies and with fast touch screen support. Responsive Nav is a tiny JavaScript plugi

Viljami Salminen 4.1k Dec 29, 2022
The best Nodejs price kit you need when working with cryptocurrencies with multiple providers support

Cryptocurrency Price Kit STAGE: RFC The best Nodejs price kit you need when working with cryptocurrencies with multiple providers support. Goal To pro

TrapCode 6 Sep 7, 2022
Json-parser - A parser for json-objects without dependencies

Json Parser This is a experimental tool that I create for educational purposes, it's based in the jq works With this tool you can parse json-like stri

Gabriel Guerra 1 Jan 3, 2022
🖼 Simple file-upload utility that shows a preview of the uploaded image. Written in TypeScript. No dependencies. Works well with or without a framework.

file-upload-with-preview ?? Simple file-upload utility that shows a preview of the uploaded image. Written in TypeScript. No dependencies. Works well

John Datserakis 427 Dec 26, 2022