mirror of
https://github.com/fosrl/pangolin.git
synced 2026-08-21 19:52:47 +02:00
♻️ add Country is not rule to verifySession
This commit is contained in:
@@ -1054,7 +1054,10 @@ async function checkRules(
|
|||||||
isPathAllowed(rule.value, path)
|
isPathAllowed(rule.value, path)
|
||||||
) {
|
) {
|
||||||
return rule.action as any;
|
return rule.action as any;
|
||||||
} else if (clientIp && rule.match == "COUNTRY") {
|
} else if (
|
||||||
|
clientIp &&
|
||||||
|
(rule.match === "COUNTRY" || rule.match === "COUNTRY_IS_NOT")
|
||||||
|
) {
|
||||||
// COUNTRY=ALL should not affect local/private/CGNAT addresses.
|
// COUNTRY=ALL should not affect local/private/CGNAT addresses.
|
||||||
if (
|
if (
|
||||||
rule.value.toUpperCase() === "ALL" &&
|
rule.value.toUpperCase() === "ALL" &&
|
||||||
@@ -1063,7 +1066,10 @@ async function checkRules(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (await isIpInGeoIP(ipCC, rule.value)) {
|
const inCountry = await isIpInGeoIP(ipCC, rule.value);
|
||||||
|
const matched = rule.match === "COUNTRY" ? inCountry : !inCountry;
|
||||||
|
|
||||||
|
if (matched) {
|
||||||
return rule.action as any;
|
return rule.action as any;
|
||||||
}
|
}
|
||||||
} else if (clientIp && rule.match == "ASN") {
|
} else if (clientIp && rule.match == "ASN") {
|
||||||
|
|||||||
Reference in New Issue
Block a user