feat(botfilter): botfilter.go part 1/2

This commit is contained in:
hoelee committed 2026-05-14 13:26:00 +08:00
1 parent 9fe86bc379
commit 1027804b48
1 file changed
+17
+17
View File
@@ -52,3 +52,20 @@ func (b *botFilter) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
return
}
match := inspectRequest(r, b.config)
paths := requestPaths(r)
decision := b.cache.observeRequest(ip, requestObservation{
at: now,
paths: paths,
points: match.points,
forceBan: match.forceBan,
})
if decision.banned {
reason := match.reason
if reason == "" {
reason = "suspicion score threshold"
}
b.reject(rw, ip, reason, decision)
return
}