feat(botfilter): add clientIP

This commit is contained in:
hoelee committed 2026-01-13 15:23:00 +08:00
1 parent aaa6f82011
commit e106a1086c
1 file changed
+17
+17
View File
@@ -0,0 +1,17 @@
package botfilter
import (
"net"
"net/http"
"net/netip"
"net/url"
pathpkg "path"
"strings"
)
func clientIP(r *http.Request, cfg *compiledConfig) netip.Addr {
remote := parseRemoteAddress(r.RemoteAddr)
if cfg.clientIPHeader == "" || !addressInPrefixes(remote, cfg.trustedProxies) {
return remote
}