You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// getClientIP retrieves the client IP set in the custom header 'X-Client-IP'. It returns an empty string if the IP address sent is invalid, unknown or could ne be parsed.
72
-
funcgetClientIP(r*http.Request) string {
73
-
clientIP:=r.Header.Get("X-Client-IP")
74
-
ifclientIP==""||clientIP=="unknown" {
75
-
return""
76
-
}
77
-
ifip:=net.ParseIP(clientIP); ip==nil {
78
-
return""
79
-
}
80
-
returnclientIP
81
-
}
71
+
// // getClientIP retrieves the client IP set in the custom header 'X-Client-IP'. It returns an empty string if the IP address sent is invalid, unknown or could ne be parsed.
0 commit comments