middleware

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CSRF

func CSRF(config CSRFConfig) opm.MiddlewareFunc

func Logger

func Logger(next opm.Handler) opm.Handler

Logger --

func Recover

func Recover(next opm.Handler) opm.Handler

Recover --

Types

type CSRFConfig

type CSRFConfig struct {
	MaxAge   int
	Domain   string
	Path     string
	HTTPOnly bool
	Secure   bool
	SameSite http.SameSite

	RequestHeader string
	FieldName     string
	CookieName    string
}

type Limiter

type Limiter struct {
	MaxLimit int
	IPCount  map[string]int
}

func ProtectLimiter

func ProtectLimiter(max int) *Limiter

func (*Limiter) Middleware

func (m *Limiter) Middleware(next opm.Handler) opm.Handler

type RateLimiterConfig

type RateLimiterConfig struct {
	Rate  rate.Limit
	Burst int
	// contains filtered or unexported fields
}

func RateLimiter

func RateLimiter(rate rate.Limit, b int) *RateLimiterConfig

func (*RateLimiterConfig) Middleware

func (m *RateLimiterConfig) Middleware(next opm.Handler) opm.Handler

type Visitor

type Visitor struct {
	*rate.Limiter
	Lastseen time.Time
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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