Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetHTTPClientIP ¶
func GetHTTPClientIP(r *http.Request, options GetHTTPClientIPOptions) string
GetHTTPClientIP will extract ip from headers or just remoteaddr
code mainly from dts gateway code
ref, https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For todo, add support for Forwarded , https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Forwarded
func IsPrivateIP ¶
IsPrivateIP returns true if the given IP is in private ip mask range
func IsPublicIP ¶
IsPublicIP returns true if the given IP is not in private ip mask range
Types ¶
type FilterStrategy ¶
type FilterStrategy uint8
const ( FirstIP FilterStrategy = iota LastPublicIP )
type GetHTTPClientIPOptions ¶
type GetHTTPClientIPOptions struct {
FilterStrategy FilterStrategy
SupportHeaderXRealIP bool // X-Real-IP is used by nginx ngx_http_realip_module
}
Click to show internal directories.
Click to hide internal directories.