From 9fea0749a0755a8cd8f9583f1f46e68d851d331f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Fri, 7 Jul 2023 10:11:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=9B=BD=E5=AE=B6/=E5=9C=B0?= =?UTF-8?q?=E5=8C=BA=E3=80=81=E7=9C=81=E4=BB=BD=E5=B0=81=E7=A6=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/nodes/http_request_waf.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/internal/nodes/http_request_waf.go b/internal/nodes/http_request_waf.go index 5cc9c51..c07fde5 100644 --- a/internal/nodes/http_request_waf.go +++ b/internal/nodes/http_request_waf.go @@ -9,7 +9,6 @@ import ( "github.com/TeaOSLab/EdgeNode/internal/stats" "github.com/TeaOSLab/EdgeNode/internal/waf" "github.com/iwind/TeaGo/Tea" - "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/types" "io" "net/http" @@ -171,8 +170,7 @@ func (this *HTTPRequest) checkWAFRequest(firewallPolicy *firewallconfigs.HTTPFir var currentURL = this.URL() if regionConfig.MatchCountryURL(currentURL) { // 检查国家/地区级别封禁 - var countryId = result.CountryId() - if countryId > 0 && lists.ContainsInt64(regionConfig.DenyCountryIds, countryId) { + if !regionConfig.IsAllowedCountry(result.CountryId(), result.ProvinceId()) { this.firewallPolicyId = firewallPolicy.Id this.writeCode(http.StatusForbidden, "The region has been denied.", "当前区域禁止访问") @@ -192,8 +190,7 @@ func (this *HTTPRequest) checkWAFRequest(firewallPolicy *firewallconfigs.HTTPFir if regionConfig.MatchProvinceURL(currentURL) { // 检查省份封禁 - var provinceId = result.ProvinceId() - if provinceId > 0 && lists.ContainsInt64(regionConfig.DenyProvinceIds, provinceId) { + if !regionConfig.IsAllowedProvince(result.CountryId(), result.ProvinceId()) { this.firewallPolicyId = firewallPolicy.Id this.writeCode(http.StatusForbidden, "The region has been denied.", "当前区域禁止访问")