|
|
@ -67,14 +67,13 @@ Blacklist.test = function (clientIp, callback) {
|
|
|
|
// return ip.cidrSubnet(subnet).contains(clientIp);
|
|
|
|
// return ip.cidrSubnet(subnet).contains(clientIp);
|
|
|
|
}) // not in a blacklisted IPv4 or IPv6 cidr range
|
|
|
|
}) // not in a blacklisted IPv4 or IPv6 cidr range
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
plugins.fireHook('filter:blacklist.test', {
|
|
|
|
plugins.fireHook('filter:blacklist.test', { // To return test failure, pass back an error in callback
|
|
|
|
ip: clientIp,
|
|
|
|
ip: clientIp,
|
|
|
|
result: false,
|
|
|
|
}, function (err) {
|
|
|
|
}, function (err, data) {
|
|
|
|
|
|
|
|
if (typeof callback === 'function') {
|
|
|
|
if (typeof callback === 'function') {
|
|
|
|
callback(err);
|
|
|
|
callback(err);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return data.result;
|
|
|
|
return !!err;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|