blacklist should not use data.result anymore, just err is fine

v1.18.x
Julian Lam 8 years ago
parent 19ae2b3eb4
commit 00c25d47f9

@ -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 {

Loading…
Cancel
Save