sbff

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2026 License: MIT Imports: 6 Imported by: 0

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

func GetIPAddress(r *http.Request) (addr string, found bool)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL