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.
- 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.
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.
This project is licensed under the GNU Affero General Public License (AGPL).
There is currently no packaged release or Maven repository available.
To use AntiVPN Lib, clone the repository and compile the source code with Maven.
git clone https://github.com/HeroDevelopmentTeam/antivpn-lib.git
cd antivpn-libMake sure you have Maven installed.
To build the project, run:
mvn clean packageThe compiled JAR will be located in the target/ directory.
Add the compiled JAR from target/ to your project's classpath or include it as a local dependency.
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();
}
}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.
- 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 aCheckResponse. - After all checks, call
shutdown()to clean up resources.
We welcome contributions!
- Fork the repository
- Create your feature branch (
git checkout -b feature/my-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin feature/my-feature) - Open a Pull Request
See CONTRIBUTING.md for more details.
Thanks to all contributors and users for supporting the project!