From 85182f936838b4fae4f80a041bedfdc4149fefd5 Mon Sep 17 00:00:00 2001 From: NewName Date: Sat, 17 May 2025 16:48:41 +0800 Subject: [PATCH] =?UTF-8?q?GitHub=E6=96=87=E4=BB=B6=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E9=99=90=E6=B5=81=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ghproxy/main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ghproxy/main.go b/ghproxy/main.go index 955275b..e44a970 100644 --- a/ghproxy/main.go +++ b/ghproxy/main.go @@ -96,9 +96,11 @@ func main() { c.File("./public/bj.svg") }) + // 创建GitHub文件下载专用的限流器 + githubLimiter := NewIPRateLimiter() + // 注册NoRoute处理器,应用限流中间件 - // 为GitHub文件下载应用限流 - ApplyRateLimit(router, "*", "GET", handler) + router.NoRoute(RateLimitMiddleware(githubLimiter), handler) err := router.Run(fmt.Sprintf("%s:%d", host, port)) if err != nil {