Tested on linux based systems using iptables.
npm install npm-layer7-protections
yarn add npm-layer7-protections
const { isProxy, dropIp, checkIp, openFile } = require('npm-layer7-protections');
openFile('IP2PROXY_DATABASE_FILE.bin')
.then(() => {
return isProxy(IP);
})
.then(() => {
return dropIp(IP);
})
.then(() => {
console.log('Success');
})
.catch(() => {
console.log('Error');
});
checkIp(IP, 'IP2PROXY_DATABASE_FILE.bin'); // checkIp uses both modules: isProxy and dropIp
IP2PROXY_DATABASE_FILE.bin is an example name of the file that you can download via this site: https://lite.ip2location.com/database/px1-ip-country