diff options
author | MichaelKo <[email protected]> | 2020-05-07 16:09:10 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2020-05-07 16:09:10 +0200 |
commit | 9272b8c8b4044f551b43ae4fc46a128ca4ec0b4e (patch) | |
tree | 215084b0ef0b43e8ee27a7fd2fd400855842627e | |
parent | 8ecb65ee17144fe972db31c9500adaf385fb3866 (diff) |
fix perfomance issue
-rw-r--r-- | service/http/handler.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/service/http/handler.go b/service/http/handler.go index eeee5e35..457e7cb5 100644 --- a/service/http/handler.go +++ b/service/http/handler.go @@ -179,11 +179,12 @@ func (h *Handler) resolveIP(r *Request) { r.RemoteAddr = fetchIP(r.Header.Get("X-Real-Ip")) } - if r.Header.Get("CF-Connecting-IP") != "" { - r.RemoteAddr = fetchIP(r.Header.Get("CF-Connecting-IP")) - } - if r.Header.Get("True-Client-IP") != "" { r.RemoteAddr = fetchIP(r.Header.Get("True-Client-IP")) + return + } + + if r.Header.Get("CF-Connecting-IP") != "" { + r.RemoteAddr = fetchIP(r.Header.Get("CF-Connecting-IP")) } } |