Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRemoteAddr ¶
GetRemoteAddr parses the given request, resolves the X-Forwarded-For header and returns the resolved remote address.
func GetRemoteAddrIfAllowed ¶
GetRemoteAddrIfAllowed parses the given request, resolves the X-Forwarded-For header and returns the resolved remote address if allowed.
func IsPublicIP ¶
IsPublicIP returns true if the given IP can be routed on the Internet.
Types ¶
type Options ¶
type Options struct {
// AllowedSubnets is a list of Subnets from which we will accept the
// X-Forwarded-For header.
// If this list is empty we will accept every Subnets (default).
AllowedSubnets []string
// Debugging flag adds additional output to debug server side XFF issues.
Debug bool
}
Options is a configuration container to setup the XFF middleware.
type XFF ¶
XFF http handler
func (*XFF) HandlerFunc ¶
func (xff *XFF) HandlerFunc(w http.ResponseWriter, r *http.Request)
HandlerFunc provides Martini compatible handler
func (*XFF) ServeHTTP ¶
func (xff *XFF) ServeHTTP(w http.ResponseWriter, r *http.Request, next http.HandlerFunc)
Negroni compatible interface
Click to show internal directories.
Click to hide internal directories.