openrport-openrport/server/api_helper_authorization.go
2023-09-27 15:43:23 +02:00

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
}