middleware

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdminAuth

func AdminAuth() gin.HandlerFunc

func AdminOperationLog

func AdminOperationLog() gin.HandlerFunc

AdminOperationLog 记录管理员操作日志。 关键:goroutine 中不能使用 *gin.Context(handler 返回后 c 会被 gin pool 复用)。 因此所有字段必须在主协程中抽取成普通值,再交给 app.SafeGo 异步写库。 SafeGo 还会兜底 panic,避免 DB 抖动时异步任务拖挂整个进程。

func AdminPower

func AdminPower(power string) gin.HandlerFunc

func Cors

func Cors() gin.HandlerFunc

func JWTAuth

func JWTAuth() gin.HandlerFunc

func Logger

func Logger() gin.HandlerFunc

func PrometheusHTTP added in v1.6.0

func PrometheusHTTP() gin.HandlerFunc

PrometheusHTTP 记录请求计数与直方图(依赖 route 在 c.Next() 之后由 Gin 写入 FullPath)。

func RateLimit added in v1.5.5

func RateLimit(limit int, window time.Duration) gin.HandlerFunc

RateLimit 滑动窗口限流:Redis 可用且后端为 auto/redis 时用集群限流,否则进程内限流。

Types

This section is empty.

Jump to

Keyboard shortcuts

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