From cc7cf5f8c50f676b08cf3aae90cd2e7ba90fc33a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Sat, 11 Mar 2023 11:58:05 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=90=E5=88=B6=E7=BB=9F=E8=AE=A1=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E5=92=8C=E6=B5=8F=E8=A7=88=E5=99=A8=E7=9A=84=E6=9C=80?= =?UTF-8?q?=E5=A4=A7=E9=95=BF=E5=BA=A6=EF=BC=8C=E5=87=8F=E5=B0=91=E9=9A=8F?= =?UTF-8?q?=E6=9C=BAUserAgent=E6=94=BB=E5=87=BB=E5=BD=B1=E5=93=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/stats/http_request_stat_manager.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/stats/http_request_stat_manager.go b/internal/stats/http_request_stat_manager.go index 128e3ab..cd95d9f 100644 --- a/internal/stats/http_request_stat_manager.go +++ b/internal/stats/http_request_stat_manager.go @@ -232,7 +232,9 @@ Loop: if dotIndex > -1 { osInfo.Version = osInfo.Version[:dotIndex] } - this.systemMap[serverId+"@"+osInfo.Name+"@"+osInfo.Version]++ + if len(this.systemMap) < 100_000 { // 限制最大数据,防止攻击 + this.systemMap[serverId+"@"+osInfo.Name+"@"+osInfo.Version]++ + } } var browser, browserVersion = result.BrowserName, result.BrowserVersion @@ -241,7 +243,9 @@ Loop: if dotIndex > -1 { browserVersion = browserVersion[:dotIndex] } - this.browserMap[serverId+"@"+browser+"@"+browserVersion]++ + if len(this.browserMap) < 100_000 { // 限制最大数据,防止攻击 + this.browserMap[serverId+"@"+browser+"@"+browserVersion]++ + } } case firewallRuleGroupString := <-this.firewallRuleGroupChan: this.dailyFirewallRuleGroupMap[firewallRuleGroupString]++