GetIP helps in getting the IP address from the request
(r *http.Request)
| 4 | |
| 5 | // GetIP helps in getting the IP address from the request |
| 6 | func 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 |
| 19 | func GetUserAgent(r *http.Request) string { |
no test coverage detected