@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
Markdown
The most accurate VPN/Proxy detection system, powered by advanced machine learning and real-time threat intelligence. [ https://antivpn.cc/ ]
```bash
npm install @devbaseit/antivpn
```
```javascript
const antivpn = require('@devbaseit/antivpn');
// Create a client instance with your API key
const client = antivpn.createClient('your-api-key-here');
```
```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();
```
```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();
```
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
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
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;
}
}
```
- Node.js
- Valid API key from antivpn.cc
- axios: ^1.9.0
ISC
Devbase team
VPN detection, Proxy detection, IP analysis, Security, Machine learning, Threat intelligence