Documentation ¶
Index ¶
- func AccessLog(next server.HandlerFunc) server.HandlerFunc
- func AuthUser(next server.HandlerFunc) server.HandlerFunc
- func RequestID(next server.HandlerFunc) server.HandlerFunc
- func StripUrlSuffix(next server.HandlerFunc) server.HandlerFunc
- func TrustProxies(next server.HandlerFunc) server.HandlerFunc
- func User(next server.HandlerFunc) server.HandlerFunc
- type IPExtractor
- type TrustOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RequestID ¶ added in v0.4.2
func RequestID(next server.HandlerFunc) server.HandlerFunc
RequestID 添加request_id
func StripUrlSuffix ¶
func StripUrlSuffix(next server.HandlerFunc) server.HandlerFunc
StripUrlSuffix 去除url后缀
func TrustProxies ¶ added in v0.4.2
func TrustProxies(next server.HandlerFunc) server.HandlerFunc
TrustProxies
Types ¶
type IPExtractor ¶ added in v0.4.2
func ExtractIPDirect ¶ added in v0.4.2
func ExtractIPDirect() IPExtractor
ExtractIPDirect extracts IP address using actual IP address. Use this if your server faces to internet directory (i.e.: uses no proxy).
func ExtractIPFromRealIPHeader ¶ added in v0.4.2
func ExtractIPFromRealIPHeader(options ...TrustOption) IPExtractor
ExtractIPFromRealIPHeader extracts IP address using x-real-ip header. Use this if you put proxy which uses this header.
func ExtractIPFromXFFHeader ¶ added in v0.4.2
func ExtractIPFromXFFHeader(options ...TrustOption) IPExtractor
ExtractIPFromXFFHeader extracts IP address using x-forwarded-for header. Use this if you put proxy which uses this header. This returns nearest untrustable IP. If all IPs are trustable, returns furthest one (i.e.: XFF[0]).
type TrustOption ¶ added in v0.4.2
type TrustOption func(*ipChecker)
TrustOption is config for which IP address to trust
func TrustIPRange ¶ added in v0.4.2
func TrustIPRange(ipRange string) TrustOption
TrustIPRange add trustable IP ranges using CIDR notation.
func TrustLinkLocal ¶ added in v0.4.2
func TrustLinkLocal(v bool) TrustOption
TrustLinkLocal configures if you trust link-local address (default: true).
func TrustLoopback ¶ added in v0.4.2
func TrustLoopback(v bool) TrustOption
TrustLoopback configures if you trust loopback address (default: true).
func TrustPrivateNet ¶ added in v0.4.2
func TrustPrivateNet(v bool) TrustOption
TrustPrivateNet configures if you trust private network address (default: true).