middleware

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2025 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BrowserCacheMiddlewareConfig

type BrowserCacheMiddlewareConfig struct {
	CacheDuration time.Duration
	ExcludedFiles []string
}

type Middleware

type Middleware struct {
	// contains filtered or unexported fields
}

func New

func New(servs *service.Service) *Middleware

func (*Middleware) InjectReqctx

func (m *Middleware) InjectReqctx(next echo.HandlerFunc) echo.HandlerFunc

func (Middleware) NewBrowserCacheMiddleware

func (Middleware) NewBrowserCacheMiddleware(
	config BrowserCacheMiddlewareConfig,
) echo.MiddlewareFunc

NewBrowserCacheMiddleware creates a new CacheMiddleware with the specified cache duration and a list of excluded files that will bypass the cache.

func (Middleware) RateLimit

func (Middleware) RateLimit(config RateLimitConfig) echo.MiddlewareFunc

RateLimit creates a rate limiting middleware.

func (*Middleware) RequireAuth

func (m *Middleware) RequireAuth(next echo.HandlerFunc) echo.HandlerFunc

func (*Middleware) RequireNoAuth

func (m *Middleware) RequireNoAuth(next echo.HandlerFunc) echo.HandlerFunc

type RateLimitConfig

type RateLimitConfig struct {
	// Limit is the maximum number of requests to allow per period.
	Limit int
	// Period is the duration in which the limit is enforced.
	Period time.Duration
}

RateLimitConfig defines the config for RateLimit middleware.

Jump to

Keyboard shortcuts

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