防爆增加全局黑名单功能

增加防爆测试用例
优化防爆检查逻辑
This commit is contained in:
wsczx
2025-08-25 18:05:07 +08:00
parent c435d3e5c5
commit d2a35dcec2
6 changed files with 494 additions and 30 deletions

View File

@@ -68,6 +68,11 @@ func LinkAuth(w http.ResponseWriter, r *http.Request) {
ClientRequest: cr,
UserActLog: ua,
}
// 锁定状态判断
if !lockManager.CheckLocked(cr.Auth.Username, r.RemoteAddr) {
w.WriteHeader(http.StatusTooManyRequests)
return
}
// setCommonHeader(w)
if cr.Type == "logout" {
// 退出删除session信息
@@ -136,12 +141,6 @@ func LinkAuth(w http.ResponseWriter, r *http.Request) {
return
}
// 锁定状态判断
if !lockManager.CheckLocked(cr.Auth.Username, r.RemoteAddr) {
w.WriteHeader(http.StatusTooManyRequests)
return
}
// TODO 用户密码校验
ext := map[string]any{"mac_addr": cr.MacAddressList.MacAddress}
err = dbdata.CheckUser(cr.Auth.Username, cr.Auth.Password, cr.GroupSelect, ext)