middleware

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthMiddleware

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

AuthMiddleware provides JWT token validation This is a pre-middleware that runs before routing

func NewAuthMiddleware

func NewAuthMiddleware(secretKey string, skipPaths []string) *AuthMiddleware

NewAuthMiddleware creates a new authentication middleware

func (*AuthMiddleware) Invoke

func (m *AuthMiddleware) Invoke(w http.ResponseWriter, r *http.Request, next func(http.ResponseWriter, *http.Request))

Invoke implements the Middleware interface for pre-middleware execution

type CORSPreMiddleware

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

CORSPreMiddleware provides CORS handling as pre-middleware This runs before routing to handle preflight requests efficiently

func NewCORSPreMiddleware

func NewCORSPreMiddleware() *CORSPreMiddleware

NewCORSPreMiddleware creates a new CORS pre-middleware

func (*CORSPreMiddleware) Invoke

func (m *CORSPreMiddleware) Invoke(
	w http.ResponseWriter, r *http.Request, next func(http.ResponseWriter, *http.Request),
)

Invoke implements the Middleware interface for pre-middleware execution

type LoggingPreMiddleware

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

LoggingPreMiddleware provides request logging as pre-middleware This logs all requests before routing

func NewLoggingPreMiddleware

func NewLoggingPreMiddleware(logFunc func(method, path, remoteAddr string, startTime time.Time)) *LoggingPreMiddleware

NewLoggingPreMiddleware creates a new logging pre-middleware

func (*LoggingPreMiddleware) Invoke

Invoke implements the Middleware interface for pre-middleware execution

type RateLimitMiddleware

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

RateLimitMiddleware provides simple in-memory rate limiting This is a pre-middleware that runs before routing

func NewRateLimitMiddleware

func NewRateLimitMiddleware(maxRequests int, window time.Duration) *RateLimitMiddleware

NewRateLimitMiddleware creates a new rate limiting middleware

func (*RateLimitMiddleware) Invoke

Invoke implements the Middleware interface for pre-middleware execution

Jump to

Keyboard shortcuts

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