middleware

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

api/middleware/auth_middleware.go

api/middleware/error_handler.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthMiddleware

func AuthMiddleware(cfg *config.Config) gin.HandlerFunc

AuthMiddleware creates a gin middleware for checking JWT authentication. It depends on the application configuration for the JWT secret.

func CombinedAuthMiddleware

func CombinedAuthMiddleware(db *sql.DB, cfg *config.Config) gin.HandlerFunc

func ErrorHandler

func ErrorHandler() gin.HandlerFunc

ErrorHandler creates a Gin middleware for centralized error handling.

func RateLimitMiddleware

func RateLimitMiddleware(rl *RateLimiter) gin.HandlerFunc

Types

type RateLimiter

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

func NewRateLimiter

func NewRateLimiter() *RateLimiter

func (*RateLimiter) Allow

func (rl *RateLimiter) Allow(ip string) bool

Jump to

Keyboard shortcuts

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