@devbaseit/antivpn
Version:
The most accurate VPN/Proxy detection system, powered by advanced machine learning and real-time threat intelligence.
62 lines (52 loc) • 1.18 kB
JavaScript
const axios = require('axios')
class Instance {
constructor(apiKey) {
this.apiKey = apiKey;
this.BASE_API = "https://antivpn.cc/api/";
}
/**
* Check an ip
*/
async checkIp(ip) {
const response = await axios.post(
this.BASE_API + "check",
{
'ip': ip
},
{
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + this.apiKey
}
}
)
if(response.status === 200){
return response.data
}
return false;
}
/**
* Check many ips with one request
*/
async batchCheckIp(ips) {
const response = await axios.post(
this.BASE_API + "batch-check",
{
'ips': ips
},
{
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + this.apiKey
}
}
)
if(response.status === 200){
return response.data
}
return false;
}
}
module.exports = {
createClient: (apiKey) => new Instance(apiKey)
};