npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

proxy-detect-module

v0.1.1

Published

detect proxy ip addresses

Downloads

0

Readme

proxy-detect-module

  • This module is used to detect the IP address if an IP address is a proxy IP address.
  • It will store the proxy IP address in a MongoDB database and a Redis database.
  • Redis is used to store only IP addresses and fast access and MongoDB is used to store the IP address and other information as a permanent record.
  • The module will check the IP address on the following default ports: 8000, 443, 8080, 8081, 1194, 3128.
  • The module will try to connect (TCP CONNECT) to the IP address on the above ports, if it is successful, it will be considered as a proxy IP address.
  • The module will also check if the IP address is a TOR node, if it is, it will be considered as a proxy IP address. ( DNSEL Service will be used to check if the IP address is a TOR node )
  • Before checking the IP address, it will be checked in the Redis database, if it is not in the Redis database, it will be checked.
  • When the module is initialized, IP addresses are stored in MongoDB, will be transferred to Redis.
  • Full Lookup time is about 500ms, even if the IP address is not a proxy IP address.

MongoDB Schema to store IP address and other information

Screenshot

IP address stored in Redis

Screenshot

Installation

yarn add proxy-detect-module

Exposed Methods

// initialize the module with the following parameters
proxyDetect.init({
  host: 'redis-domain.com',
  port: 19831, // Redis port
  password: 'redispassword', 
  username: 'default', // Redis username
  ports: [8000, 443, 8080, 8081, 1194, 3128], // Ports to check
  mongoUri:
    'mongodb+srv://DetectService:fgfg' // MongoDB connection string
});

// get all proxy ip stored in mongoDB
proxyDetect.GetProxyList(page: number, limit: number, search: string) : Promise<ProxyIp[]>;

//peform a check on a single ip address, if it is a proxy ip address, it will be stored in mongoDB and redis
proxyDetect.IsProxy(ip: string) : Promise<boolean>;

//remove a proxy ip address from mongoDB and redis
proxyDetect.DeleteProxyIP(id: string) : Promise<{ resultM : boolean, resultR : boolean }>;

Usage ( NestJS API Example )

// importing the module
import { ProxyDetect } from 'proxy-detect-module';


export class DetectService {
  // initialize the module with the following parameters
  private proxyDetect = new ProxyDetect();
  constructor() {
    this.proxyDetect.init({
      host: 'redis-domain.com',
      port: 19831, // Redis port
      password: 'redispassword', 
      username: 'default', // Redis username
      ports: [8000, 443, 8080, 8081, 1194, 3128], // Ports to check
      mongoUri:
        'mongodb+srv://DetectService:[email protected]/ProxyIpDB?retryWrites=true&w=majority',
    });
  }
  // get all proxy ip stored in mongoDB
  async findAll(page: number, limit: number, search: string) {
    return await this.proxyDetect.GetProxyList(page, limit, search);
  }

  //peform a check on a single ip address, if it is a proxy ip address, it will be stored in mongoDB and redis
  async findOne(ip: string) {
    console.log('findOne service', ip);
    const res = await this.proxyDetect.IsProxy(ip);
    return { ip, res };
  }

  //remove a proxy ip address from mongoDB and redis
  async remove(id: string) {
    return await this.proxyDetect.DeleteProxyIP(id); 
  }
}
    

Methodology of the module

graph TD;
    Start-->IP-TO-CHECK;
    IP-TO-CHECK-->Redis-Check;
    Redis-Check<-------->Redis-Database;
    Redis-Check-->Result;
    Redis-Check-->Async-Operations-Queue;
    Async-Operations-Queue-->Try-TCP-CONNECT;
    Async-Operations-Queue-->TOR-Node-CHECK;
    Try-TCP-CONNECT-->8000;
    Try-TCP-CONNECT-->443;
    Try-TCP-CONNECT-->8080;
    Try-TCP-CONNECT-->8081;
    Try-TCP-CONNECT-->1194;
    Try-TCP-CONNECT-->3128;

    8080--->Result;
    8081--->Result;
    1194--->Result;
    3128--->Result;
    8000--->Result;
    443--->Result;
    Result--->Store-IP-Address;
    Store-IP-Address--->Finish;
    Store-IP-Address--->Redis-Database;
    Store-IP-Address--->MongoDB-Database;

    TOR-Node-CHECK-->Result;

    A[Start] ------------>|Maximum 500ms| B(Finish)