Skip to content

HeroDevelopmentTeam/antivpn-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AntiVPN Lib (Beta)

AntiVPN Lib is an open-source Java library (currently in beta stage) for detecting and blocking VPN/proxy usage in your applications. It helps you enforce regional access, maintain security, and prevent circumvention of your platform's rules.


Features

  • VPN/Proxy Detection: Identify users connecting via VPN or proxy in real-time.
  • Multiple Detection Strategies: Utilizes IP2Proxy, blocklists, X4B VPN list, FireHol lists, and other internal methods.
  • No Reliance on Public APIs: All detection is performed using bundled data and internal algorithms.
  • Lightweight & Fast: Optimized for performance and minimal resource usage.
  • Simple Integration: Easy-to-use APIs for Java applications and platforms.

Beta Notice

This library is in beta. While it is functional and actively developed, APIs and detection strategies may change. Please report bugs and share feedback to help improve stability and features.


License

This project is licensed under the GNU Affero General Public License (AGPL).


Getting Started

There is currently no packaged release or Maven repository available.
To use AntiVPN Lib, clone the repository and compile the source code with Maven.

1. Clone the Repository

git clone https://github.com/HeroDevelopmentTeam/antivpn-lib.git
cd antivpn-lib

2. Compile the Source Code with Maven

Make sure you have Maven installed.
To build the project, run:

mvn clean package

The compiled JAR will be located in the target/ directory.

3. Using the Library in Your Project

Add the compiled JAR from target/ to your project's classpath or include it as a local dependency.


Example Usage

Below is a sample usage of the library (see example/Main.java):

import it.herodevelopment.novpn.NoVPN;
import it.herodevelopment.novpn.objects.CheckResponse;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        NoVPN noVPN = NoVPN.init();
        noVPN.downloadAndCache();

        Scanner scanner = new Scanner(System.in);
        String ip;
        while(!(ip = scanner.nextLine()).equals("exit")){
            long start = System.nanoTime();
            CheckResponse response = noVPN.isDetected(ip).join();
            if(response.isSafe()){
                System.out.println("No VPN detected");
            } else {
                System.out.println("VPN detected: ");
                System.out.println(" Tags:");
                response.tags().forEach(tag -> System.out.println("  - " + tag.name()));
                System.out.println("Confidence: " + response.confidence());
            }
            System.out.println("Time: " + ((System.nanoTime() - start) / 1_000_000) + "ms");
        }

        noVPN.shutdown();
    }
}

Detection Strategies

AntiVPN Lib combines multiple detection methods:

  • IP2Proxy: Checks IP addresses against the IP2Proxy database for known VPN/proxy endpoints.
  • Blocklists: Maintains curated blocklists of VPN/proxy IP ranges.
  • X4B VPN List: Integrates the X4B VPN list for additional coverage.
  • FireHol Lists: Uses FireHol's security lists for layered protection.
  • Internal Heuristics: Applies custom logic for enhanced detection accuracy.

No external public APIs are required; all detection is performed using locally cached or bundled data.


Configuration

  • Initialize the library with NoVPN.init().
  • Run downloadAndCache() before performing checks to ensure detection data is up-to-date.
  • Use isDetected(ip) to check if an IP is detected as VPN/proxy. The result is asynchronous and returns a CheckResponse.
  • After all checks, call shutdown() to clean up resources.

Star History

Star History Chart


Contributing

We welcome contributions!

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/my-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin feature/my-feature)
  5. Open a Pull Request

See CONTRIBUTING.md for more details.


Community & Support


Acknowledgements

Thanks to all contributors and users for supporting the project!

About

An AntiVPN library that uses basic detection strategies to check if an ip address or ip range is threatning or not.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages