From 45b4acc31f56fa20bfc8f4c882390945115f4d6b Mon Sep 17 00:00:00 2001 From: starry <115192496+sky22333@users.noreply.github.com> Date: Tue, 2 Sep 2025 01:03:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=B8=80=E4=BA=9B=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/config.go | 4 ++-- src/utils/ratelimiter.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/config/config.go b/src/config/config.go index 700b4c9..ceaf9de 100644 --- a/src/config/config.go +++ b/src/config/config.go @@ -84,8 +84,8 @@ func DefaultConfig() *AppConfig { RequestLimit int `toml:"requestLimit"` PeriodHours float64 `toml:"periodHours"` }{ - RequestLimit: 200, - PeriodHours: 1.0, + RequestLimit: 500, + PeriodHours: 3.0, }, Security: struct { WhiteList []string `toml:"whiteList"` diff --git a/src/utils/ratelimiter.go b/src/utils/ratelimiter.go index b0d960f..0658ff6 100644 --- a/src/utils/ratelimiter.go +++ b/src/utils/ratelimiter.go @@ -13,7 +13,7 @@ import ( ) const ( - CleanupInterval = 10 * time.Minute + CleanupInterval = 20 * time.Minute MaxIPCacheSize = 10000 ) @@ -98,7 +98,7 @@ func (i *IPRateLimiter) cleanupRoutine() { i.mu.RLock() for ip, entry := range i.ips { - if now.Sub(entry.lastAccess) > 1*time.Hour { + if now.Sub(entry.lastAccess) > 2*time.Hour { expired = append(expired, ip) } }