Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
cl-bvl committed Nov 27, 2023
1 parent 9a4bbd4 commit 47ac004
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,11 @@ func ExtractIPFromRealIPHeader(options ...TrustOption) IPExtractor {
checker := newIPChecker(options)
return func(req *http.Request) string {
realIP := req.Header.Get(HeaderXRealIP)
remoteIP := extractIP(req)
if realIP != "" {
remoteIP := extractIP(req)
if checker.trust(remoteIP) && realIP != "" {
realIP = strings.TrimPrefix(realIP, "[")
realIP = strings.TrimSuffix(realIP, "]")
if ip := net.ParseIP(realIP); ip != nil && checker.trust(remoteIP) {
if ip := net.ParseIP(realIP); ip != nil {
return realIP
}
}
Expand Down

0 comments on commit 47ac004

Please sign in to comment.