Documentation ¶
Overview ¶
Package helper should have the name commonUtilHelper but that was too long.
Index ¶
Constants ¶
const ( ClientIP = "Client-Ip" Forwarded = "Forwarded" ForwardedFor = "Forwarded-For" XClusterClientIP = "X-Cluster-Client-Ip" XForwarded = "X-Forwarded" XForwardedFor = "X-Forwarded-For" XRealIP = "X-Real-Ip" )
Available HTTP header keys for reading the real IP address.
Variables ¶
var ForwardedIPHeaders = headers{XForwarded, XForwardedFor, Forwarded, ForwardedFor, XRealIP, ClientIP, XClusterClientIP}
ForwardedIPHeaders contains a list of available headers which might contain the client IP address.
Functions ¶
func CommaListToSlice ¶
CommaListToSlice transforms a comma separated string into a slice with trimmed spaces.
func RealIP ¶
RealIP extracts the remote address from a request and takes care of different headers in which an IP address can be stored. Checks if the IP in one of the header fields lies in net.PrivateIPRanges. Return value can be empty. A check for the RealIP costs 8 allocs, for now. This implementation trusts the values found in the forward headers.
func StringsToInts ¶
StringsToInts converts stringified integers into real ints. If an error occurs during converting the entries gets skipped.
Types ¶
This section is empty.