MCPcopy
hub / github.com/pocketbase/pocketbase / RemoteIP

Method RemoteIP

tools/router/event.go:93–97  ·  view source on GitHub ↗

RemoteIP returns the IP address of the client that sent the request. IPv6 addresses are returned expanded. For example, "2001:db8::1" becomes "2001:0db8:0000:0000:0000:0000:0000:0001". Note that if you are behind reverse proxy(ies), this method returns the IP of the last connecting proxy.

()

Source from the content-addressed store, hash-verified

91// Note that if you are behind reverse proxy(ies), this method returns
92// the IP of the last connecting proxy.
93func (e *Event) RemoteIP() string {
94 ip, _, _ := net.SplitHostPort(e.Request.RemoteAddr)
95 parsed, _ := netip.ParseAddr(ip)
96 return parsed.StringExpanded()
97}
98
99// FindUploadedFiles extracts all form files of "key" from a http request
100// and returns a slice with filesystem.File instances (if any).

Callers 3

TestEventRemoteIPFunction · 0.95
RealIPMethod · 0.80
logRequestFunction · 0.80

Calls

no outgoing calls

Tested by 1

TestEventRemoteIPFunction · 0.76