From 9e700830beb02cf5c0b5a0b8c05f674ac80e3a9a Mon Sep 17 00:00:00 2001 From: wsczx Date: Sun, 29 Sep 2024 21:09:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9C=AA=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E9=98=B2=E7=88=86=E5=8A=9F=E8=83=BD=E5=AF=BC=E8=87=B4=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E9=AA=8C=E8=AF=81=E7=9A=84Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/base/config.go | 2 +- server/conf/server.toml | 2 +- server/handler/antiBruteForce.go | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/server/base/config.go b/server/base/config.go index 93c0cb0..f676c19 100644 --- a/server/base/config.go +++ b/server/base/config.go @@ -72,7 +72,7 @@ var configs = []config{ {Typ: cfgBool, Name: "display_error", Usage: "客户端显示详细错误信息(线上环境慎开启)", ValBool: false}, {Typ: cfgBool, Name: "exclude_export_ip", Usage: "排除出口ip路由(出口ip不加密传输)", ValBool: true}, - {Typ: cfgInt, Name: "max_ban_score", Usage: "单位时间内最大尝试次数", ValInt: 5}, + {Typ: cfgInt, Name: "max_ban_score", Usage: "单位时间内最大尝试次数,0为关闭防爆功能", ValInt: 5}, {Typ: cfgInt, Name: "ban_reset_time", Usage: "设置单位时间(秒),超过则重置计数", ValInt: 1}, {Typ: cfgInt, Name: "lock_time", Usage: "超过最大尝试次数后的锁定时长(秒)", ValInt: 300}, {Typ: cfgInt, Name: "user_state_expiration", Usage: "用户状态的保存周期(秒),超过则清空计数", ValInt: 900}, diff --git a/server/conf/server.toml b/server/conf/server.toml index d34871f..2d60201 100644 --- a/server/conf/server.toml +++ b/server/conf/server.toml @@ -53,7 +53,7 @@ ipv4_end = "192.168.90.200" #是否自动添加nat iptables_nat = true -#单位时间内最大尝试次数 +#单位时间内最大尝试次数,0为关闭防爆功能 max_ban_score = 5 #设置单位时间(秒),超过则重置计数 ban_reset_time = 10 diff --git a/server/handler/antiBruteForce.go b/server/handler/antiBruteForce.go index 48f1bbc..c84902a 100644 --- a/server/handler/antiBruteForce.go +++ b/server/handler/antiBruteForce.go @@ -54,6 +54,7 @@ func antiBruteForce(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { // 如果最大验证失败次数为0,则不启用防爆破功能 if base.Cfg.MaxBanCount == 0 { + next.ServeHTTP(w, r) return } body, err := io.ReadAll(r.Body)