Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
Port int = 5000
)
Functions ¶
func ClientIP ¶ added in v0.4.1
ClientIP implements a best effort algorithm to return the real client IP. It called c.RemoteIP() under the hood, to check if the remote IP is a trusted proxy or not. If it's it will then try to parse the headers defined in Engine.RemoteIPHeaders (defaulting to [X-Forwarded-For, X-Real-Ip]). If the headers are nots syntactically valid OR the remote IP does not correspong to a trusted proxy, the remote IP (coming form Request.RemoteAddr) is returned.
func RemoteIP ¶ added in v0.4.1
RemoteIP parses the IP from Request.RemoteAddr, normalizes and returns the IP (without the port). It also checks if the remoteIP is a trusted proxy or not. In order to perform this validation, it will see if the IP is contained within at least one of the CIDR blocks defined in Engine.TrustedProxies
Types ¶
This section is empty.