maxmind国家判断失效跳过
This commit is contained in:
@@ -39,15 +39,24 @@ if ($countryCode !== null && $countryCode !== '') {
|
||||
}
|
||||
|
||||
$allowlist = CountryAllowlist::parse(defined('SHOW_SITE_COUNTRY') ? SHOW_SITE_COUNTRY : '');
|
||||
|
||||
// MaxMind 查不到有效国家:跳过本地判定,继续走 byApi(已传 country_code 作兜底)
|
||||
if ($countryCode === null || $countryCode === '') {
|
||||
if (!empty($GLOBALS['__cloak_debug_on'])) {
|
||||
cloak_dbg_step(__LINE__, 'GeoIP国家判定', 'skip', 'MaxMind 未识别国家,跳过本地判定,交由 byApi 兜底', [
|
||||
'ip' => $ip,
|
||||
'allowlist' => $allowlist,
|
||||
'geo_source' => $geoSource,
|
||||
]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CountryAllowlist::isAllowed($countryCode, $allowlist)) {
|
||||
$_SESSION['check_result'] = 'false';
|
||||
if ($countryCode === null || $countryCode === '') {
|
||||
$reason = '无法识别访客国家';
|
||||
} else {
|
||||
$reason = '国家不符:访客 ' . $countryCode;
|
||||
if ($allowlist !== []) {
|
||||
$reason .= ',允许 ' . implode(',', $allowlist);
|
||||
}
|
||||
$reason = '国家不符:访客 ' . $countryCode;
|
||||
if ($allowlist !== []) {
|
||||
$reason .= ',允许 ' . implode(',', $allowlist);
|
||||
}
|
||||
if (!empty($GLOBALS['__cloak_debug_on'])) {
|
||||
cloak_dbg_step(__LINE__, 'GeoIP国家判定', 'fail', $reason, [
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../../WhitelistGate.php';
|
||||
|
||||
//判断临时链接参数(Guard 之后、API/指纹 之前)
|
||||
if (!empty($GLOBALS['__cloak_simulation_on'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$whiteParamsMatched = WhitelistGate::matchesWhitelistParams();
|
||||
|
||||
if(empty($_SESSION["check_result"]) && !$whiteParamsMatched && SHOW_SITE_MODE_SWITCH == 'ip_check' && CLOAK_URL_ARGS_TIMEOUT > 0) {
|
||||
if ($__cloak_debug_on) {
|
||||
cloak_dbg_step(__LINE__,'临时链接参数', 'info', 'CLOAK_URL_ARGS_TIMEOUT=' . CLOAK_URL_ARGS_TIMEOUT . ' 分钟,开始检查');
|
||||
|
||||
@@ -75,6 +75,7 @@ class visitorInfo
|
||||
$this->check_result = !empty($return['result']) ? "true" : "false";
|
||||
if ($this->v_country === '' && !empty($return['country'])) {
|
||||
$this->v_country = (string) $return['country'];
|
||||
$_SESSION['gcu_country'] = $this->v_country;
|
||||
}
|
||||
$this->v_reason = cloak_api_reason($return, $this->check_result);
|
||||
return $return;
|
||||
|
||||
Reference in New Issue
Block a user