Documentation ¶
Index ¶
- Constants
- func Compose(l *zap.Logger, name string, handler http.Handler, middlewares ...Middleware) http.Handler
- func DefaultJWTClaimsHandler(l *zap.Logger, w http.ResponseWriter, r *http.Request, claims jwt2.Claims) bool
- func DefaultJWTClaimsProvider() jwt2.Claims
- func DefaultJWTErrorHandler(l *zap.Logger, w http.ResponseWriter, r *http.Request, err error) bool
- func DefaultJWTInvalidTokenHandler(l *zap.Logger, w http.ResponseWriter, r *http.Request, token *jwt2.Token) bool
- func DefaultJWTMissingTokenHandler(l *zap.Logger, w http.ResponseWriter, r *http.Request) (jwt2.Claims, bool)
- func DefaultSessionIDGenerator() string
- func DefaultTrackingIDGenerator() string
- func LoggerLabelerFromContext(ctx context.Context) (context.Context, *log.Labeler)
- func LoggerLabelerFromRequest(r *http.Request) (*http.Request, *log.Labeler)
- func RequiredJWTMissingTokenHandler(l *zap.Logger, w http.ResponseWriter, r *http.Request) (jwt2.Claims, bool)
- func SessionIDFromContext(ctx context.Context) string
- func TrackingIDFromContext(ctx context.Context) string
- func WrapResponseWriter(w http.ResponseWriter) *responseWriter
- type BasicAuthOption
- type BasicAuthOptions
- type CORSOption
- type CORSOptions
- type CookieTokenProviderOption
- type CookieTokenProviderOptions
- type HeaderTokenProviderOption
- type HeaderTokenProviderOptions
- type JWTClaimsHandler
- type JWTClaimsProvider
- type JWTErrorHandler
- type JWTInvalidTokenHandler
- type JWTMissingTokenHandler
- type JWTOption
- func JWTWithClaimsHandler(v JWTClaimsHandler) JWTOption
- func JWTWithClaimsProvider(v JWTClaimsProvider) JWTOption
- func JWTWithErrorHandler(v JWTErrorHandler) JWTOption
- func JWTWithInvalidTokenHandler(v JWTInvalidTokenHandler) JWTOption
- func JWTWithMissingTokenHandler(v JWTMissingTokenHandler) JWTOption
- func JWTWithSetContext(v bool) JWTOption
- func JWTWithTokenProvider(v TokenProvider) JWTOption
- type JWTOptions
- type LoggerOption
- type LoggerOptions
- type Middleware
- func BasicAuth(username string, passwordHash []byte, opts ...BasicAuthOption) Middleware
- func BasicAuthWithOptions(username string, passwordHash []byte, opts BasicAuthOptions) Middleware
- func CORS(opts ...CORSOption) Middleware
- func CORSWithOptions(opts CORSOptions) Middleware
- func JWT(jwt *jwt.JWT, contextKey interface{}, opts ...JWTOption) Middleware
- func JWTWithOptions(jwt *jwt.JWT, contextKey interface{}, opts JWTOptions) Middleware
- func Logger(opts ...LoggerOption) Middleware
- func LoggerWithOptions(opts LoggerOptions) Middleware
- func PoweredByHeader(opts ...PoweredByHeaderOption) Middleware
- func PoweredByHeaderWithOptions(opts PoweredByHeaderOptions) Middleware
- func Recover(opts ...RecoverOption) Middleware
- func RecoverWithOptions(opts RecoverOptions) Middleware
- func Referer(opts ...RefererOption) Middleware
- func RefererWithOptions(opts RefererOptions) Middleware
- func RequestID(opts ...RequestIDOption) Middleware
- func RequestIDWithOptions(opts RequestIDOptions) Middleware
- func ResponseTime(opts ...ResponseTimeOption) Middleware
- func ResponseTimeWithOptions(opts ResponseTimeOptions) Middleware
- func ServerHeader(opts ...ServerHeaderOption) Middleware
- func ServerHeaderWithOptions(opts ServerHeaderOptions) Middleware
- func SessionID(opts ...SessionIDOption) Middleware
- func SessionIDWithOptions(opts SessionIDOptions) Middleware
- func Skip(mw Middleware, skippers ...Skipper) Middleware
- func Telemetry(opts ...TelemetryOption) Middleware
- func TelemetryWithOptions(opts TelemetryOptions) Middleware
- func TokenAuth(token string, opts ...TokenAuthOption) Middleware
- func TokenAuthWithOptions(token string, opts TokenAuthOptions) Middleware
- func TrackingID(opts ...TrackingIDOption) Middleware
- func TrackingIDWithOptions(opts TrackingIDOptions) Middleware
- type PoweredByHeaderOption
- type PoweredByHeaderOptions
- type RecoverOption
- type RecoverOptions
- type RefererOption
- type RefererOptions
- type RequestIDOption
- func RequestIDWithGenerator(v provider.RequestID) RequestIDOption
- func RequestIDWithRequestHeader(v ...string) RequestIDOption
- func RequestIDWithResponseHeader(v string) RequestIDOption
- func RequestIDWithSetContext(v bool) RequestIDOption
- func RequestIDWithSetRequestHeader(v bool) RequestIDOption
- func RequestIDWithSetResponseHeader(v bool) RequestIDOption
- type RequestIDOptions
- type ResponseTimeOption
- type ResponseTimeOptions
- type ServerHeaderOption
- type ServerHeaderOptions
- type SessionIDGenerator
- type SessionIDOption
- func SessionIDWithCookie(v cookie.Cookie) SessionIDOption
- func SessionIDWithGenerator(v SessionIDGenerator) SessionIDOption
- func SessionIDWithHeader(v string) SessionIDOption
- func SessionIDWithSetContext(v bool) SessionIDOption
- func SessionIDWithSetCookie(v bool) SessionIDOption
- func SessionIDWithSetHeader(v bool) SessionIDOption
- type SessionIDOptions
- type Skipper
- type TelemetryOption
- type TelemetryOptions
- type TokenAuthOption
- type TokenAuthOptions
- type TokenProvider
- type TrackingIDGenerator
- type TrackingIDOption
- func TrackingIDWithCookie(v cookie.Cookie) TrackingIDOption
- func TrackingIDWithGenerator(v TrackingIDGenerator) TrackingIDOption
- func TrackingIDWithHeader(v string) TrackingIDOption
- func TrackingIDWithSetContext(v bool) TrackingIDOption
- func TrackingIDWithSetCookie(v bool) TrackingIDOption
- func TrackingIDWithSetHeader(v bool) TrackingIDOption
- type TrackingIDOptions
Examples ¶
Constants ¶
const (
DefaultSessionIDCookieName = "keel-session"
)
const (
DefaultTrackingIDCookieName = "keel-tracking"
)
Variables ¶
This section is empty.
Functions ¶
func DefaultJWTClaimsHandler ¶ added in v0.12.0
func DefaultJWTClaimsHandler(l *zap.Logger, w http.ResponseWriter, r *http.Request, claims jwt2.Claims) bool
DefaultJWTClaimsHandler function
func DefaultJWTClaimsProvider ¶ added in v0.2.0
DefaultJWTClaimsProvider function
func DefaultJWTErrorHandler ¶ added in v0.2.0
DefaultJWTErrorHandler function
func DefaultJWTInvalidTokenHandler ¶ added in v0.2.0
func DefaultJWTInvalidTokenHandler(l *zap.Logger, w http.ResponseWriter, r *http.Request, token *jwt2.Token) bool
DefaultJWTInvalidTokenHandler function
func DefaultJWTMissingTokenHandler ¶ added in v0.2.0
func DefaultJWTMissingTokenHandler(l *zap.Logger, w http.ResponseWriter, r *http.Request) (jwt2.Claims, bool)
DefaultJWTMissingTokenHandler function
func DefaultSessionIDGenerator ¶ added in v0.2.0
func DefaultSessionIDGenerator() string
DefaultSessionIDGenerator function
func DefaultTrackingIDGenerator ¶ added in v0.9.1
func DefaultTrackingIDGenerator() string
DefaultTrackingIDGenerator function
func LoggerLabelerFromContext ¶ added in v0.14.0
func LoggerLabelerFromRequest ¶ added in v0.14.0
func RequiredJWTMissingTokenHandler ¶ added in v0.2.0
func RequiredJWTMissingTokenHandler(l *zap.Logger, w http.ResponseWriter, r *http.Request) (jwt2.Claims, bool)
RequiredJWTMissingTokenHandler function
func SessionIDFromContext ¶ added in v0.2.0
SessionIDFromContext helper
func TrackingIDFromContext ¶ added in v0.9.1
TrackingIDFromContext helper
func WrapResponseWriter ¶ added in v0.2.0
func WrapResponseWriter(w http.ResponseWriter) *responseWriter
Types ¶
type BasicAuthOption ¶ added in v0.2.0
type BasicAuthOption func(*BasicAuthOptions)
func BasicAuthWithRealm ¶ added in v0.2.0
func BasicAuthWithRealm(v string) BasicAuthOption
BasicAuthWithRealm middleware option
type BasicAuthOptions ¶ added in v0.2.0
type BasicAuthOptions struct {
Realm string
}
func GetDefaultBasicAuthOptions ¶ added in v0.2.0
func GetDefaultBasicAuthOptions() BasicAuthOptions
GetDefaultBasicAuthOptions returns the default options
type CORSOption ¶ added in v0.2.0
type CORSOption func(*CORSOptions)
func CORSWithAllowCredentials ¶ added in v0.2.0
func CORSWithAllowCredentials(v bool) CORSOption
CORSWithAllowCredentials middleware option
func CORSWithAllowHeaders ¶ added in v0.2.0
func CORSWithAllowHeaders(v ...string) CORSOption
CORSWithAllowHeaders middleware option
func CORSWithAllowMethods ¶ added in v0.2.0
func CORSWithAllowMethods(v ...string) CORSOption
CORSWithAllowMethods middleware option
func CORSWithAllowOrigins ¶ added in v0.2.0
func CORSWithAllowOrigins(v ...string) CORSOption
CORSWithAllowOrigins middleware option
func CORSWithExposeHeaders ¶ added in v0.2.0
func CORSWithExposeHeaders(v ...string) CORSOption
CORSWithExposeHeaders middleware option
func CORSWithMaxAge ¶ added in v0.2.0
func CORSWithMaxAge(v int) CORSOption
CORSWithMaxAge middleware option
type CORSOptions ¶ added in v0.2.0
type CORSOptions struct { AllowOrigins []string AllowMethods []string AllowHeaders []string AllowCredentials bool ExposeHeaders []string MaxAge int }
func GetDefaultCORSOptions ¶ added in v0.2.0
func GetDefaultCORSOptions() CORSOptions
GetDefaultCORSOptions returns the default options
type CookieTokenProviderOption ¶ added in v0.2.0
type CookieTokenProviderOption func(*CookieTokenProviderOptions)
type CookieTokenProviderOptions ¶ added in v0.2.0
type CookieTokenProviderOptions struct{}
func GetDefaultCookieTokenOptions ¶ added in v0.2.0
func GetDefaultCookieTokenOptions() CookieTokenProviderOptions
GetDefaultCookieTokenOptions returns the default options
type HeaderTokenProviderOption ¶ added in v0.2.0
type HeaderTokenProviderOption func(*HeaderTokenProviderOptions)
func HeaderTokenProviderWithHeader ¶ added in v0.2.0
func HeaderTokenProviderWithHeader(v string) HeaderTokenProviderOption
HeaderTokenProviderWithHeader middleware option
func HeaderTokenProviderWithPrefix ¶ added in v0.2.0
func HeaderTokenProviderWithPrefix(v string) HeaderTokenProviderOption
HeaderTokenProviderWithPrefix middleware option
type HeaderTokenProviderOptions ¶ added in v0.2.0
func GetDefaultHeaderTokenOptions ¶ added in v0.2.0
func GetDefaultHeaderTokenOptions() HeaderTokenProviderOptions
GetDefaultHeaderTokenOptions returns the default options
type JWTClaimsHandler ¶ added in v0.12.0
type JWTClaimsProvider ¶ added in v0.2.0
type JWTErrorHandler ¶ added in v0.2.0
type JWTInvalidTokenHandler ¶ added in v0.2.0
type JWTMissingTokenHandler ¶ added in v0.2.0
type JWTOption ¶ added in v0.2.0
type JWTOption func(*JWTOptions)
func JWTWithClaimsHandler ¶ added in v0.12.0
func JWTWithClaimsHandler(v JWTClaimsHandler) JWTOption
JWTWithClaimsHandler middleware option
func JWTWithClaimsProvider ¶ added in v0.2.0
func JWTWithClaimsProvider(v JWTClaimsProvider) JWTOption
JWTWithClaimsProvider middleware option
func JWTWithErrorHandler ¶ added in v0.2.0
func JWTWithErrorHandler(v JWTErrorHandler) JWTOption
JWTWithErrorHandler middleware option
func JWTWithInvalidTokenHandler ¶ added in v0.2.0
func JWTWithInvalidTokenHandler(v JWTInvalidTokenHandler) JWTOption
JWTWithInvalidTokenHandler middleware option
func JWTWithMissingTokenHandler ¶ added in v0.2.0
func JWTWithMissingTokenHandler(v JWTMissingTokenHandler) JWTOption
JWTWithMissingTokenHandler middleware option
func JWTWithSetContext ¶ added in v0.2.1
func JWTWithTokenProvider ¶ added in v0.2.0
func JWTWithTokenProvider(v TokenProvider) JWTOption
JWTWithTokenProvider middleware option
type JWTOptions ¶ added in v0.2.0
type JWTOptions struct { SetContext bool TokenProvider TokenProvider ClaimsProvider JWTClaimsProvider ClaimsHandler JWTClaimsHandler MissingTokenHandler JWTMissingTokenHandler InvalidTokenHandler JWTInvalidTokenHandler ErrorHandler JWTErrorHandler }
func GetDefaultJWTOptions ¶ added in v0.2.0
func GetDefaultJWTOptions() JWTOptions
GetDefaultJWTOptions returns the default options
type LoggerOption ¶ added in v0.2.0
type LoggerOption func(*LoggerOptions)
func LoggerWithInjectLabeler ¶ added in v0.14.0
func LoggerWithInjectLabeler(v bool) LoggerOption
LoggerWithInjectLabeler middleware option
Example ¶
package main import ( "fmt" "net/http" "github.com/foomo/keel/log" "github.com/foomo/keel/net/http/middleware" keeltest "github.com/foomo/keel/test" "go.uber.org/zap" ) func main() { svr := keeltest.NewServer() // get logger l := svr.Logger() // create demo service svs := http.NewServeMux() svs.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) _, _ = w.Write([]byte("ok")) fmt.Println("ok") }) svr.AddService( keeltest.NewServiceHTTP(l, "demo", svs, func(l *zap.Logger, s string, next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { r, labeler := middleware.LoggerLabelerFromRequest(r) labeler.Add(zap.String("injected", "message")) next.ServeHTTP(w, r) }) }, middleware.Logger( middleware.LoggerWithInjectLabeler(true), ), ), ) svr.Start() resp, err := http.Get(svr.GetService("demo").URL() + "/") //nolint:noctx log.Must(l, err) defer resp.Body.Close() }
Output: ok
func LoggerWithMessage ¶ added in v0.2.4
func LoggerWithMessage(v string) LoggerOption
LoggerWithMessage middleware option
func LoggerWithMinErrorCode ¶ added in v0.11.6
func LoggerWithMinErrorCode(v int) LoggerOption
LoggerWithMinErrorCode middleware option
func LoggerWithMinWarnCode ¶ added in v0.11.6
func LoggerWithMinWarnCode(v int) LoggerOption
LoggerWithMinWarnCode middleware option
type LoggerOptions ¶ added in v0.2.0
func GetDefaultLoggerOptions ¶ added in v0.2.0
func GetDefaultLoggerOptions() LoggerOptions
GetDefaultLoggerOptions returns the default options
type Middleware ¶
Middleware your way to handle requests
func BasicAuth ¶
func BasicAuth(username string, passwordHash []byte, opts ...BasicAuthOption) Middleware
BasicAuth middleware
func BasicAuthWithOptions ¶ added in v0.2.0
func BasicAuthWithOptions(username string, passwordHash []byte, opts BasicAuthOptions) Middleware
BasicAuthWithOptions middleware
func CORSWithOptions ¶ added in v0.2.0
func CORSWithOptions(opts CORSOptions) Middleware
CORSWithOptions middleware
func JWT ¶ added in v0.2.0
func JWT(jwt *jwt.JWT, contextKey interface{}, opts ...JWTOption) Middleware
JWT middleware
func JWTWithOptions ¶ added in v0.2.0
func JWTWithOptions(jwt *jwt.JWT, contextKey interface{}, opts JWTOptions) Middleware
JWTWithOptions middleware
func Logger ¶
func Logger(opts ...LoggerOption) Middleware
Logger middleware
Example ¶
package main import ( "fmt" "net/http" "github.com/foomo/keel/log" "github.com/foomo/keel/net/http/middleware" keeltest "github.com/foomo/keel/test" ) func main() { svr := keeltest.NewServer() // get logger l := svr.Logger() // create demo service svs := http.NewServeMux() svs.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) _, _ = w.Write([]byte("ok")) fmt.Println("ok") }) svr.AddService( keeltest.NewServiceHTTP(l, "demo", svs, middleware.Logger(), ), ) svr.Start() resp, err := http.Get(svr.GetService("demo").URL() + "/") //nolint:noctx log.Must(l, err) defer resp.Body.Close() }
Output: ok
func LoggerWithOptions ¶ added in v0.2.0
func LoggerWithOptions(opts LoggerOptions) Middleware
LoggerWithOptions middleware
func PoweredByHeader ¶ added in v0.2.6
func PoweredByHeader(opts ...PoweredByHeaderOption) Middleware
PoweredByHeader middleware
func PoweredByHeaderWithOptions ¶ added in v0.2.6
func PoweredByHeaderWithOptions(opts PoweredByHeaderOptions) Middleware
PoweredByHeaderWithOptions middleware
func RecoverWithOptions ¶ added in v0.2.0
func RecoverWithOptions(opts RecoverOptions) Middleware
RecoverWithOptions middleware
func RefererWithOptions ¶ added in v0.14.2
func RefererWithOptions(opts RefererOptions) Middleware
RefererWithOptions middleware
func RequestIDWithOptions ¶ added in v0.2.0
func RequestIDWithOptions(opts RequestIDOptions) Middleware
RequestIDWithOptions middleware
func ResponseTime ¶ added in v0.2.0
func ResponseTime(opts ...ResponseTimeOption) Middleware
ResponseTime middleware
func ResponseTimeWithOptions ¶ added in v0.2.0
func ResponseTimeWithOptions(opts ResponseTimeOptions) Middleware
ResponseTimeWithOptions middleware
func ServerHeader ¶ added in v0.2.6
func ServerHeader(opts ...ServerHeaderOption) Middleware
ServerHeader middleware
func ServerHeaderWithOptions ¶ added in v0.2.6
func ServerHeaderWithOptions(opts ServerHeaderOptions) Middleware
ServerHeaderWithOptions middleware
func SessionID ¶ added in v0.2.0
func SessionID(opts ...SessionIDOption) Middleware
SessionID middleware
func SessionIDWithOptions ¶ added in v0.2.0
func SessionIDWithOptions(opts SessionIDOptions) Middleware
SessionIDWithOptions middleware
func Skip ¶ added in v0.2.0
func Skip(mw Middleware, skippers ...Skipper) Middleware
func TelemetryWithOptions ¶ added in v0.2.0
func TelemetryWithOptions(opts TelemetryOptions) Middleware
TelemetryWithOptions middleware
func TokenAuth ¶ added in v0.2.0
func TokenAuth(token string, opts ...TokenAuthOption) Middleware
TokenAuth middleware
func TokenAuthWithOptions ¶ added in v0.2.0
func TokenAuthWithOptions(token string, opts TokenAuthOptions) Middleware
TokenAuthWithOptions middleware
func TrackingID ¶ added in v0.9.1
func TrackingID(opts ...TrackingIDOption) Middleware
TrackingID middleware
func TrackingIDWithOptions ¶ added in v0.9.1
func TrackingIDWithOptions(opts TrackingIDOptions) Middleware
TrackingIDWithOptions middleware
type PoweredByHeaderOption ¶ added in v0.2.6
type PoweredByHeaderOption func(*PoweredByHeaderOptions)
func PoweredByHeaderWithHeader ¶ added in v0.2.6
func PoweredByHeaderWithHeader(v string) PoweredByHeaderOption
PoweredByHeaderWithHeader middleware option
func PoweredByHeaderWithMessage ¶ added in v0.2.6
func PoweredByHeaderWithMessage(v string) PoweredByHeaderOption
PoweredByHeaderWithMessage middleware option
type PoweredByHeaderOptions ¶ added in v0.2.6
func GetDefaultPoweredByHeaderOptions ¶ added in v0.2.6
func GetDefaultPoweredByHeaderOptions() PoweredByHeaderOptions
GetDefaultPoweredByHeaderOptions returns the default options
type RecoverOption ¶ added in v0.2.0
type RecoverOption func(*RecoverOptions)
func RecoverWithDisablePrintStack ¶ added in v0.2.0
func RecoverWithDisablePrintStack(v bool) RecoverOption
RecoverWithDisablePrintStack middleware option
type RecoverOptions ¶ added in v0.2.0
type RecoverOptions struct {
DisablePrintStack bool
}
func GetDefaultRecoverOptions ¶ added in v0.2.0
func GetDefaultRecoverOptions() RecoverOptions
GetDefaultRecoverOptions returns the default options
type RefererOption ¶ added in v0.14.2
type RefererOption func(*RefererOptions)
func RefererWithRequestHeader ¶ added in v0.14.2
func RefererWithRequestHeader(v ...string) RefererOption
RefererWithRequestHeader middleware option
func RefererWithSetContext ¶ added in v0.14.2
func RefererWithSetContext(v bool) RefererOption
RefererWithSetContext middleware option
type RefererOptions ¶ added in v0.14.2
func GetDefaultRefererOptions ¶ added in v0.14.2
func GetDefaultRefererOptions() RefererOptions
GetDefaultRefererOptions returns the default options
type RequestIDOption ¶ added in v0.2.0
type RequestIDOption func(*RequestIDOptions)
func RequestIDWithGenerator ¶ added in v0.2.0
func RequestIDWithGenerator(v provider.RequestID) RequestIDOption
RequestIDWithGenerator middleware option
func RequestIDWithRequestHeader ¶ added in v0.11.3
func RequestIDWithRequestHeader(v ...string) RequestIDOption
RequestIDWithRequestHeader middleware option
func RequestIDWithResponseHeader ¶ added in v0.2.0
func RequestIDWithResponseHeader(v string) RequestIDOption
RequestIDWithResponseHeader middleware option
func RequestIDWithSetContext ¶ added in v0.11.3
func RequestIDWithSetContext(v bool) RequestIDOption
RequestIDWithSetContext middleware option
func RequestIDWithSetRequestHeader ¶ added in v0.11.3
func RequestIDWithSetRequestHeader(v bool) RequestIDOption
RequestIDWithSetRequestHeader middleware option
func RequestIDWithSetResponseHeader ¶ added in v0.2.0
func RequestIDWithSetResponseHeader(v bool) RequestIDOption
RequestIDWithSetResponseHeader middleware option
type RequestIDOptions ¶ added in v0.2.0
type RequestIDOptions struct { Provider provider.RequestID RequestHeader []string ResponseHeader string SetRequestHeader bool SetResponseHeader bool SetContext bool }
func GetDefaultRequestIDOptions ¶ added in v0.2.0
func GetDefaultRequestIDOptions() RequestIDOptions
GetDefaultRequestIDOptions returns the default options
type ResponseTimeOption ¶ added in v0.2.0
type ResponseTimeOption func(*ResponseTimeOptions)
func ResponseTimeWithMaxDuration ¶ added in v0.2.0
func ResponseTimeWithMaxDuration(v time.Duration) ResponseTimeOption
ResponseTimeWithMaxDuration middleware option
func ResponseTimeWithMaxDurationMessage ¶ added in v0.2.0
func ResponseTimeWithMaxDurationMessage(v string) ResponseTimeOption
ResponseTimeWithMaxDurationMessage middleware option
func ResponseTimeWithSetHeader ¶ added in v0.2.0
func ResponseTimeWithSetHeader(v bool) ResponseTimeOption
ResponseTimeWithSetHeader middleware option
type ResponseTimeOptions ¶ added in v0.2.0
type ResponseTimeOptions struct { SetHeader bool MaxDuration time.Duration MaxDurationMessage string }
func GetDefaultResponseTimeOptions ¶ added in v0.2.0
func GetDefaultResponseTimeOptions() ResponseTimeOptions
GetDefaultResponseTimeOptions returns the default options
type ServerHeaderOption ¶ added in v0.2.6
type ServerHeaderOption func(*ServerHeaderOptions)
func ServerHeaderWithHeader ¶ added in v0.2.6
func ServerHeaderWithHeader(v string) ServerHeaderOption
ServerHeaderWithHeader middleware option
func ServerHeaderWithName ¶ added in v0.2.6
func ServerHeaderWithName(v string) ServerHeaderOption
ServerHeaderWithName middleware option
type ServerHeaderOptions ¶ added in v0.2.6
func GetDefaultServerHeaderOptions ¶ added in v0.2.6
func GetDefaultServerHeaderOptions() ServerHeaderOptions
GetDefaultServerHeaderOptions returns the default options
type SessionIDGenerator ¶ added in v0.2.0
type SessionIDGenerator func() string
type SessionIDOption ¶ added in v0.2.0
type SessionIDOption func(*SessionIDOptions)
func SessionIDWithCookie ¶ added in v0.2.0
func SessionIDWithCookie(v cookie.Cookie) SessionIDOption
SessionIDWithCookie middleware option
func SessionIDWithGenerator ¶ added in v0.2.0
func SessionIDWithGenerator(v SessionIDGenerator) SessionIDOption
SessionIDWithGenerator middleware option
func SessionIDWithHeader ¶ added in v0.2.0
func SessionIDWithHeader(v string) SessionIDOption
func SessionIDWithSetContext ¶ added in v0.2.0
func SessionIDWithSetContext(v bool) SessionIDOption
SessionIDWithSetContext middleware option
func SessionIDWithSetCookie ¶ added in v0.2.0
func SessionIDWithSetCookie(v bool) SessionIDOption
SessionIDWithSetCookie middleware option
func SessionIDWithSetHeader ¶ added in v0.2.0
func SessionIDWithSetHeader(v bool) SessionIDOption
SessionIDWithSetHeader middleware option
type SessionIDOptions ¶ added in v0.2.0
type SessionIDOptions struct { // Header to look up the session id Header string // Cookie how to set the cookie Cookie cookie.Cookie // Generator for the session ids Generator SessionIDGenerator // SetCookie if true it will create a cookie if not exists SetCookie bool // SetHeader if true it will set add a request header SetHeader bool // SetContext if true it will set the context key SetContext bool }
func GetDefaultSessionIDOptions ¶ added in v0.2.0
func GetDefaultSessionIDOptions() SessionIDOptions
GetDefaultSessionIDOptions returns the default options
type Skipper ¶ added in v0.2.0
func RequestURIBlacklistSkipper ¶ added in v0.2.0
RequestURIBlacklistSkipper returns a HTTPMiddlewareConfig.Skipper which skips the given uris
func RequestURIWhitelistSkipper ¶ added in v0.2.0
RequestURIWhitelistSkipper returns a HTTPMiddlewareConfig.Skipper which skips all but the given uris
type TelemetryOption ¶ added in v0.2.0
type TelemetryOption func(*TelemetryOptions)
func TelemetryWithInjectPropagationHeader ¶ added in v0.9.12
func TelemetryWithInjectPropagationHeader(v bool) TelemetryOption
func TelemetryWithName ¶ added in v0.2.6
func TelemetryWithName(v string) TelemetryOption
func TelemetryWithOtelOpts ¶ added in v0.2.6
func TelemetryWithOtelOpts(v ...otelhttp.Option) TelemetryOption
TelemetryWithOtelOpts middleware options
type TelemetryOptions ¶ added in v0.2.0
type TelemetryOptions struct { Name string OtelOpts []otelhttp.Option InjectPropagationHeader bool }
func GetDefaultTelemetryOptions ¶ added in v0.2.0
func GetDefaultTelemetryOptions() TelemetryOptions
GetDefaultTelemetryOptions returns the default options
type TokenAuthOption ¶ added in v0.2.0
type TokenAuthOption func(*TokenAuthOptions)
func TokenAuthWithTokenProvider ¶ added in v0.2.0
func TokenAuthWithTokenProvider(v TokenProvider) TokenAuthOption
TokenAuthWithTokenProvider middleware option
type TokenAuthOptions ¶ added in v0.2.0
type TokenAuthOptions struct { // TokenProvider function to retrieve the token TokenProvider TokenProvider }
func GetDefaultTokenAuthOptions ¶ added in v0.2.0
func GetDefaultTokenAuthOptions() TokenAuthOptions
GetDefaultTokenAuthOptions returns the default options
type TokenProvider ¶ added in v0.2.0
func CookieTokenProvider ¶ added in v0.2.0
func CookieTokenProvider(cookieName string, opts ...CookieTokenProviderOption) TokenProvider
func HeaderTokenProvider ¶ added in v0.2.0
func HeaderTokenProvider(opts ...HeaderTokenProviderOption) TokenProvider
type TrackingIDGenerator ¶ added in v0.9.1
type TrackingIDGenerator func() string
type TrackingIDOption ¶ added in v0.9.1
type TrackingIDOption func(*TrackingIDOptions)
func TrackingIDWithCookie ¶ added in v0.9.1
func TrackingIDWithCookie(v cookie.Cookie) TrackingIDOption
TrackingIDWithCookie middleware option
func TrackingIDWithGenerator ¶ added in v0.9.1
func TrackingIDWithGenerator(v TrackingIDGenerator) TrackingIDOption
TrackingIDWithGenerator middleware option
func TrackingIDWithHeader ¶ added in v0.9.1
func TrackingIDWithHeader(v string) TrackingIDOption
func TrackingIDWithSetContext ¶ added in v0.9.1
func TrackingIDWithSetContext(v bool) TrackingIDOption
TrackingIDWithSetContext middleware option
func TrackingIDWithSetCookie ¶ added in v0.9.1
func TrackingIDWithSetCookie(v bool) TrackingIDOption
TrackingIDWithSetCookie middleware option
func TrackingIDWithSetHeader ¶ added in v0.9.1
func TrackingIDWithSetHeader(v bool) TrackingIDOption
TrackingIDWithSetHeader middleware option
type TrackingIDOptions ¶ added in v0.9.1
type TrackingIDOptions struct { // Header to look up the tracking id Header string // Cookie how to set the cookie Cookie cookie.Cookie // Generator for the tracking ids Generator TrackingIDGenerator // SetCookie if true it will create a cookie if not exists SetCookie bool // SetHeader if true it will set add a request header SetHeader bool // SetContext if true it will set the context key SetContext bool }
func GetDefaultTrackingIDOptions ¶ added in v0.9.1
func GetDefaultTrackingIDOptions() TrackingIDOptions
GetDefaultTrackingIDOptions returns the default options
Source Files ¶
- basicauth.go
- cookietokenprovider.go
- cors.go
- headertokenprovider.go
- jwt.go
- logger.go
- middleware.go
- poweredbyheader.go
- recover.go
- referrer.go
- requestid.go
- requesturiblacklistskipper.go
- requesturiwhitelistskipper.go
- responsetime.go
- responsewriter.go
- serverheader.go
- sessionid.go
- skip.go
- skipper.go
- telemetry.go
- tokenauth.go
- tokenprovider.go
- trackingid.go