Skip to content

Commit

Permalink
修复未启动防爆功能导致无法验证的Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wsczx committed Sep 29, 2024
1 parent c5a76ba commit 9e70083
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion server/base/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
2 changes: 1 addition & 1 deletion server/conf/server.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ ipv4_end = "192.168.90.200"
#是否自动添加nat
iptables_nat = true

#单位时间内最大尝试次数
#单位时间内最大尝试次数,0为关闭防爆功能
max_ban_score = 5
#设置单位时间(秒),超过则重置计数
ban_reset_time = 10
Expand Down
1 change: 1 addition & 0 deletions server/handler/antiBruteForce.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9e70083

Please sign in to comment.