middleware package - github.com/adrian-lorenz/noxway/middleware - Go Packages

middleware

package
v0.0.0-...-f9f9634 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppMetrics = GlobalMetrics{}

Globale Instanz der Metriken

Functions

func BannList

func BannList() gin.HandlerFunc

func GetIP

func GetIP(c *gin.Context) string

GetIP returns the real client IP, respecting Gin's trusted proxy configuration. To enable X-Forwarded-For trust, call router.SetTrustedProxies() with your proxy CIDRs.

func MetricsMiddleware

func MetricsMiddleware() gin.HandlerFunc

Middleware zur Erfassung von Metriken

func RateLimiterMiddleware

func RateLimiterMiddleware(config RateLimiterConfig) gin.HandlerFunc

func SecurityHeaders

func SecurityHeaders() gin.HandlerFunc

SecurityHeaders adds standard security headers to every response. Apply this only to admin routes, not to the reverse-proxy routes.

func UpdateRequestMetrics

func UpdateRequestMetrics(requestSize, responseSize int64, duration time.Duration)

Funktion zur Aktualisierung der Anfragemetriken

Types

type GlobalMetrics

type GlobalMetrics struct {
	sync.RWMutex
	TotalRequests     int64
	TotalRequestSize  int64
	TotalResponseSize int64
	TotalDuration     time.Duration
}

type RateLimiterConfig

type RateLimiterConfig struct {
	Rate   int
	Window time.Duration
}

type RequestCounter

type RequestCounter struct {
	Count       int
	LastRequest time.Time
}

Jump to

Keyboard shortcuts

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