UNPKG

@devbaseit/antivpn

Version:

The most accurate VPN/Proxy detection system, powered by advanced machine learning and real-time threat intelligence.

115 lines (79 loc) 2.42 kB
# @devbaseit/antivpn The most accurate VPN/Proxy detection system, powered by advanced machine learning and real-time threat intelligence. [ https://antivpn.cc/ ] ## Installation ```bash npm install @devbaseit/antivpn ``` ## Usage ### Initialize the Client ```javascript const antivpn = require('@devbaseit/antivpn'); // Create a client instance with your API key const client = antivpn.createClient('your-api-key-here'); ``` ### Check Single IP Address ```javascript async function checkSingleIP() { try { const result = await client.checkIp('192.168.1.1'); console.log(result); } catch (error) { console.error('Error checking IP:', error); } } checkSingleIP(); ``` ### Batch Check Multiple IP Addresses ```javascript async function checkMultipleIPs() { const ips = ['192.168.1.1', '10.0.0.1', '8.8.8.8']; try { const results = await client.batchCheckIp(ips); console.log(results); } catch (error) { console.error('Error checking IPs:', error); } } checkMultipleIPs(); ``` ## API Methods ### `checkIp(ip)` Checks a single IP address for VPN/Proxy detection. **Parameters:** - `ip` (string): The IP address to check **Returns:** - Promise that resolves to the API response data or `false` if the request fails ### `batchCheckIp(ips)` Checks multiple IP addresses in a single request for better performance. **Parameters:** - `ips` (array): Array of IP addresses to check **Returns:** - Promise that resolves to the API response data or `false` if the request fails ## Error Handling Both methods return `false` if the API request fails (non-200 status code). For more detailed error handling, you can wrap the calls in try-catch blocks to handle network errors and other exceptions. ```javascript async function safeCheck(ip) { try { const result = await client.checkIp(ip); if (result === false) { console.log('API request failed'); return null; } return result; } catch (error) { console.error('Network or other error:', error.message); return null; } } ``` ## Requirements - Node.js - Valid API key from antivpn.cc ## Dependencies - axios: ^1.9.0 ## License ISC ## Author Devbase team ## Keywords VPN detection, Proxy detection, IP analysis, Security, Machine learning, Threat intelligence