diff options
author | terminaldweller <devi@terminaldweller.com> | 2025-05-01 21:14:39 +0000 |
---|---|---|
committer | terminaldweller <devi@terminaldweller.com> | 2025-05-01 21:14:39 +0000 |
commit | bfc07067eefe24e7f274098f68c7e3da1b00d013 (patch) | |
tree | f2b5c1bf17e524c6443b817bf578a0ee553a80cc | |
parent | added the proxy protocol to the server (diff) | |
download | icanhazallips-bfc07067eefe24e7f274098f68c7e3da1b00d013.tar.gz icanhazallips-bfc07067eefe24e7f274098f68c7e3da1b00d013.zip |
update
-rw-r--r-- | main.go | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -41,8 +41,9 @@ func getIP(request *http.Request) (string, error) { log.Println(request.RemoteAddr) - if len(splitIps) > 0 { - netIP := net.ParseIP(splitIps[len(splitIps)-1]) + if len(splitIps) > 1 { + netIP := net.ParseIP(splitIps[len(splitIps)-2]) + log.Println("one:", netIP.String()) if netIP != nil { return netIP.String(), nil } @@ -59,6 +60,7 @@ func getIP(request *http.Request) (string, error) { return "127.0.0.1", nil } + log.Println("two:", ip) return ip, nil } |