Documentation
¶
Index ¶
- Constants
- Variables
- func BlockQuery() int
- func GetIntervalFromContext(r *http.Request) timeutil.TimeInterval
- func GetSession(ctx context.Context) *sessions.Session
- func LoggerWithHTTPContext(requestId string) zerolog.Logger
- type Chain
- type CustomHTTPHandler
- type CustomHTTPHandlerInterface
- type Interval
- type Middleware
- func RequestWithInterval(timezone *time.Location) Middleware
- func RequestWithRateLimit(timeFrame time.Duration, numberOfTries int64, isBehindAReverseProxy bool, ...) Middleware
- func RequestWithSession(authenticator *auth.Authenticator) Middleware
- func RequestWithTimeout(defaultTimeout time.Duration) Middleware
- func RequireAuthenticationOnlyAfterSystemHasAnyUser(auth *httpauth.Authenticator) Middleware
- type RequestID
- type RestrictAction
- type SessionName
Constants ¶
View Source
const ( DefaultTimeout = time.Second * 30 MaxCustomTimeout = time.Minute * 1 )
View Source
const LoggerKey string = "LoggerKey"
Variables ¶
View Source
var (
ErrInvalidKeepAliveHeader = errors.New("Could not parse Keep-Alive Header")
)
Functions ¶
func BlockQuery ¶
func BlockQuery() int
func GetIntervalFromContext ¶
func GetIntervalFromContext(r *http.Request) timeutil.TimeInterval
func LoggerWithHTTPContext ¶
Logger returns a logger with http context
Types ¶
type Chain ¶
type Chain struct {
// contains filtered or unexported fields
}
func New ¶
func New(middleware ...Middleware) Chain
func WithDefaultStack ¶
func WithDefaultStack(auth *auth.Authenticator, middleware ...Middleware) Chain
func WithDefaultStackWithoutAuth ¶
func WithDefaultStackWithoutAuth(middleware ...Middleware) Chain
func (Chain) WithEndpoint ¶
func (c Chain) WithEndpoint(endpoint CustomHTTPHandlerInterface) http.Handler
type CustomHTTPHandler ¶
type CustomHTTPHandler func(w http.ResponseWriter, r *http.Request) error
func (CustomHTTPHandler) ServeHTTP ¶
func (f CustomHTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) error
type CustomHTTPHandlerInterface ¶
type CustomHTTPHandlerInterface interface {
ServeHTTP(w http.ResponseWriter, r *http.Request) error
}
type Middleware ¶
type Middleware func(CustomHTTPHandler) CustomHTTPHandler
func RequestWithInterval ¶
func RequestWithInterval(timezone *time.Location) Middleware
func RequestWithRateLimit ¶
func RequestWithRateLimit(timeFrame time.Duration, numberOfTries int64, isBehindAReverseProxy bool, action RestrictAction) Middleware
func RequestWithSession ¶
func RequestWithSession(authenticator *auth.Authenticator) Middleware
func RequestWithTimeout ¶
func RequestWithTimeout(defaultTimeout time.Duration) Middleware
func RequireAuthenticationOnlyAfterSystemHasAnyUser ¶
func RequireAuthenticationOnlyAfterSystemHasAnyUser(auth *httpauth.Authenticator) Middleware
RequireAuthenticationOnlyAfterSystemHasAnyUser allows something to be seen only if before the user registration ends or the user is authenticated
type RestrictAction ¶
type RestrictAction func() int
Data structures to define rate-limiting behaviour
Click to show internal directories.
Click to hide internal directories.