mirror of
https://github.com/openrport/openrport.git
synced 2025-10-26 11:27:11 +00:00
22 lines
355 B
Go
22 lines
355 B
Go
package chserver
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
chshare "github.com/openrport/openrport/share"
|
|
)
|
|
|
|
func (al *APIListener) handleBannedIPs(r *http.Request, authorized bool) (ok bool) {
|
|
if al.bannedIPs != nil {
|
|
ip := chshare.RemoteIP(r)
|
|
|
|
if authorized {
|
|
al.bannedIPs.AddSuccessAttempt(ip)
|
|
} else {
|
|
al.bannedIPs.AddBadAttempt(ip)
|
|
}
|
|
}
|
|
|
|
return true
|
|
}
|