Documentation
¶
Index ¶
Constants ¶
View Source
const HeaderName = "sb-forwarded-for"
HeaderName is the Sb-Forwarded-For header name. It is all lowercase here as HTTP header names are not case-sensitive.
Variables ¶
View Source
var ( ErrHeaderNotFound = errors.New("Sb-Forwarded-For header not found") ErrHeaderInvalid = errors.New("invalid Sb-Forwarded-For header value") )
Functions ¶
func GetIPAddress ¶
GetIPAddress returns the value of the IP address in Sb-Forwarded-For as defined by SBForwardedForMiddleware. If no value is present in the request context, this function will return ("", false).
func Middleware ¶
func Middleware(cfg *conf.SecurityConfiguration, errCallback func(*http.Request, error)) func(http.Handler) http.Handler
Middleware returns a middleware function that parses the Sb-Forwarded-For header and adds the leftmost header value to the request context if GOTRUE_SECURITY_SB_FORWARDED_FOR_ENABLED is true and the value is a valid IP address.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.