MCPcopy Create free account
hub / github.com/authorizerdev/authorizer / GetIP

Function GetIP

internal/utils/request_info.go:6–16  ·  view source on GitHub ↗

GetIP helps in getting the IP address from the request

(r *http.Request)

Source from the content-addressed store, hash-verified

4
5// GetIP helps in getting the IP address from the request
6func GetIP(r *http.Request) string {
7 IPAddress := r.Header.Get("X-Real-Ip")
8 if IPAddress == "" {
9 IPAddress = r.Header.Get("X-Forwarded-For")
10 }
11
12 if IPAddress == "" {
13 IPAddress = r.RemoteAddr
14 }
15 return IPAddress
16}
17
18// GetUserAgent helps in getting the user agent from the request
19func GetUserAgent(r *http.Request) string {

Callers 7

MetaFromGinFunction · 0.92
VerifyEmailHandlerMethod · 0.92
LogoutHandlerMethod · 0.92
OAuthCallbackHandlerMethod · 0.92
TokenHandlerMethod · 0.92
OAuthLoginHandlerMethod · 0.92

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected