forked from svrjs/svrjs
Fix bugs in the block list.
This commit is contained in:
parent
98b251b867
commit
036091a0c6
1 changed files with 3 additions and 3 deletions
6
svr.js
6
svr.js
|
@ -730,7 +730,7 @@ function ipBlockList(rawBlockList) {
|
||||||
var ips = ip.split(":");
|
var ips = ip.split(":");
|
||||||
var ip2s = [];
|
var ip2s = [];
|
||||||
ips.forEach(function (ipe) {
|
ips.forEach(function (ipe) {
|
||||||
ip2s.push(parseInt(ipe));
|
ip2s.push(parseInt(ipe, 16));
|
||||||
});
|
});
|
||||||
return ip2s;
|
return ip2s;
|
||||||
}
|
}
|
||||||
|
@ -764,9 +764,9 @@ function ipBlockList(rawBlockList) {
|
||||||
function checkIfIPv6CIDRMatches(ipBlock, cidrObject) {
|
function checkIfIPv6CIDRMatches(ipBlock, cidrObject) {
|
||||||
if (!cidrObject.v6) return false;
|
if (!cidrObject.v6) return false;
|
||||||
for (var i = 0; i < 8; i++) {
|
for (var i = 0; i < 8; i++) {
|
||||||
if (ipBlock[i] < cidrObject.min[i] || ipBlock[i] > cidrObject.max[i]) return true;
|
if (ipBlock[i] < cidrObject.min[i] || ipBlock[i] > cidrObject.max[i]) return false;
|
||||||
}
|
}
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to add an IP or CIDR block to the block list
|
// Function to add an IP or CIDR block to the block list
|
||||||
|
|
Reference in a new issue