18 lines
311 B
Go
18 lines
311 B
Go
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
|
|
}
|
|
|