middleware

package
v0.0.0-...-79f8893 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

middleware/audit.go

middleware/cors.go

middleware/error.go

middleware/ratelimit.go

Index

Constants

This section is empty.

Variables

View Source
var (
	CurrentUser = "ziren926"
	CurrentTime = time.Date(2025, 1, 20, 2, 45, 19, 0, time.UTC)
)

Functions

func AuditMiddleware

func AuditMiddleware() gin.HandlerFunc

func CORS

func CORS() gin.HandlerFunc

CORS 处理跨域请求的中间件

func ErrorHandler

func ErrorHandler() gin.HandlerFunc

func JWTMiddleware

func JWTMiddleware() gin.HandlerFunc

定义一个 JWT 的中间件, 除了校验 jtw,还要校验之前签发的 api token 只要一样就放行。

func RateLimit

func RateLimit() gin.HandlerFunc

RateLimit 创建速率限制中间件

Types

type AuditInfo

type AuditInfo struct {
	UserLogin string
	Timestamp time.Time
	RequestID string
}

Jump to

Keyboard shortcuts

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