修复国家设置,允许不设置任何国家,不做判断
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
require_once __DIR__ . '/../WhitelistGate.php';
|
||||
require_once __DIR__ . '/../CloakJudgmentCache.php';
|
||||
require_once __DIR__ . '/../RiskSecondaryGate.php';
|
||||
require_once __DIR__ . '/../CountryAllowlist.php';
|
||||
|
||||
/**
|
||||
* 流量判定主流水线
|
||||
@@ -88,11 +89,15 @@ class CheckPipeline
|
||||
return;
|
||||
}
|
||||
|
||||
CloakPipelineTimer::stage('GeoIP国家判定');
|
||||
include __DIR__ . '/stages/check_country_geoip.inc.php';
|
||||
if (!empty($_SESSION['check_result'])) {
|
||||
CloakPipelineTimer::finish();
|
||||
return;
|
||||
if (CountryAllowlist::isEnabled()) {
|
||||
CloakPipelineTimer::stage('GeoIP国家判定');
|
||||
include __DIR__ . '/stages/check_country_geoip.inc.php';
|
||||
if (!empty($_SESSION['check_result'])) {
|
||||
CloakPipelineTimer::finish();
|
||||
return;
|
||||
}
|
||||
} elseif ($__cloak_debug_on) {
|
||||
cloak_dbg_step(__LINE__, 'GeoIP国家判定', 'skip', '未开启国家条件');
|
||||
}
|
||||
|
||||
CloakPipelineTimer::stage('广告来源限制');
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../../CountryAllowlist.php';
|
||||
require_once __DIR__ . '/../../ClientIpResolver.php';
|
||||
require_once __DIR__ . '/../../GeoIpCountryResolver.php';
|
||||
/**
|
||||
* 仅用本地 MaxMind 解析国家并写入访客信息/Session(不做国家允许列表或其它判定)
|
||||
* 未开启国家条件(SHOW_SITE_COUNTRY 为空)时不查询 MaxMind。
|
||||
*
|
||||
* 依赖全局:$v_info, $__cloak_debug_on
|
||||
*/
|
||||
if (!CountryAllowlist::isEnabled()) {
|
||||
if (!empty($GLOBALS['__cloak_debug_on'])) {
|
||||
cloak_dbg_step(__LINE__, 'MaxMind国家记录', 'skip', '未开启国家条件,跳过 MaxMind');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
$ip = ClientIpResolver::resolve();
|
||||
if ($ip !== '' && $ip !== '0.0.0.0') {
|
||||
$v_info->v_ip = $ip;
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* 屏蔽模式:GeoIP 国家判定(本地 MaxMind + 30 天 IP 缓存)
|
||||
*
|
||||
* 依赖全局:$v_info, $reason, $__cloak_debug_on
|
||||
* 未开启国家条件(SHOW_SITE_COUNTRY 为空)时跳过。
|
||||
*/
|
||||
require_once __DIR__ . '/../../CountryAllowlist.php';
|
||||
require_once __DIR__ . '/../../ClientIpResolver.php';
|
||||
require_once __DIR__ . '/../../GeoIpCountryResolver.php';
|
||||
if (!defined('SHOW_SITE_MODE_SWITCH') || SHOW_SITE_MODE_SWITCH !== 'ip_check') {
|
||||
return;
|
||||
}
|
||||
@@ -14,6 +16,13 @@ if (!empty($_SESSION['check_result'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CountryAllowlist::isEnabled()) {
|
||||
if (!empty($GLOBALS['__cloak_debug_on'])) {
|
||||
cloak_dbg_step(__LINE__, 'GeoIP国家判定', 'skip', '未开启国家条件,跳过本地 MaxMind 判定');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
$ip = ClientIpResolver::resolve();
|
||||
if ($ip !== '' && $ip !== '0.0.0.0') {
|
||||
$v_info->v_ip = $ip;
|
||||
@@ -53,7 +62,7 @@ if (!CountryAllowlist::isAllowed($countryCode, $allowlist)) {
|
||||
}
|
||||
|
||||
if (!empty($GLOBALS['__cloak_debug_on'])) {
|
||||
cloak_dbg_step(__LINE__, 'GeoIP国家判定', 'pass', '国家允许或列表为空', [
|
||||
cloak_dbg_step(__LINE__, 'GeoIP国家判定', 'pass', '国家在允许列表内', [
|
||||
'ip' => $ip,
|
||||
'country' => $countryCode,
|
||||
'allowlist' => $allowlist,
|
||||
|
||||
Reference in New Issue
Block a user