diff --git a/web/web.go b/web/web.go index 6eb0623..56aa5fc 100644 --- a/web/web.go +++ b/web/web.go @@ -117,13 +117,13 @@ func getIP(w http.ResponseWriter, r *http.Request) { var ret results.Result clientIP := r.RemoteAddr - if strings.Contains(clientIP, ":") { - ip, _, _ := net.SplitHostPort(r.RemoteAddr) + clientIP = strings.ReplaceAll(clientIP, "::ffff:", "") + + ip, _, err := net.SplitHostPort(r.RemoteAddr) + if err == nil { clientIP = ip } - strings.ReplaceAll(clientIP, "::ffff:", "") - isSpecialIP := true switch { case clientIP == "::1":