MCPcopy Index your code
hub / github.com/labstack/echo / extractIP

Function extractIP

ip.go:211–220  ·  view source on GitHub ↗
(req *http.Request)

Source from the content-addressed store, hash-verified

209}
210
211func 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.

Callers 2

ExtractIPFromXFFHeaderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…