1.重构防爆逻辑,基于IP+UserName锁定(单位时间内,锁定相同IP下的相同用户,其它IP和用户不影响)

2.增加基于用户的全局锁定
3.增加基于IP的全局锁定
4.用户单位时间内的请求频率限制(暂未开放)
This commit is contained in:
wsczx
2024-10-03 23:29:41 +08:00
parent 9e700830be
commit 2fedb281e8
4 changed files with 337 additions and 82 deletions

View File

@@ -85,10 +85,19 @@ type ServerConfig struct {
DisplayError bool `json:"display_error"`
ExcludeExportIp bool `json:"exclude_export_ip"`
MaxBanCount int `json:"max_ban_score"`
BanResetTime int `json:"ban_reset_time"`
LockTime int `json:"lock_time"`
UserStateExpiration int `json:"user_state_expiration"`
AntiBruteForce bool `json:"anti_brute_force"`
MaxBanCount int `json:"max_ban_score"`
BanResetTime int `json:"ban_reset_time"`
LockTime int `json:"lock_time"`
MaxGlobalUserBanCount int `json:"max_global_user_ban_count"`
GlobalUserBanResetTime int `json:"global_user_ban_reset_time"`
GlobalUserLockTime int `json:"global_user_lock_time"`
MaxGlobalIPBanCount int `json:"max_global_ip_ban_count"`
GlobalIPBanResetTime int `json:"global_ip_ban_reset_time"`
GlobalIPLockTime int `json:"global_ip_lock_time"`
}
func initServerCfg() {