(req *http.Request)
| 209 | } |
| 210 | |
| 211 | func extractIP(req *http.Request) string { |
| 212 | host, _, err := net.SplitHostPort(req.RemoteAddr) |
| 213 | if err != nil { |
| 214 | if net.ParseIP(req.RemoteAddr) != nil { |
| 215 | return req.RemoteAddr |
| 216 | } |
| 217 | return "" |
| 218 | } |
| 219 | return host |
| 220 | } |
| 221 | |
| 222 | // ExtractIPFromRealIPHeader extracts IP address using `x-real-ip` header. |
| 223 | // Use this if you put proxy which uses this header. |
no outgoing calls
no test coverage detected
searching dependent graphs…