feat: 支持设置demo检查中间件

This commit is contained in:
2026-01-09 16:00:14 +08:00
parent 5139f1ee01
commit 909a209540
2 changed files with 15 additions and 0 deletions

View File

@@ -25,6 +25,17 @@ type serverOption struct {
loggerCfg *middleware.AccessConfig // 日志配置
initContextData gin.HandlerFunc // 初始化一些请求数据
rateLimitInstance abstract.IRateLimit // 服务流控实例
demoCheck gin.HandlerFunc // demo检查
}
// WithDemoCheck 设置demo检查
func WithDemoCheck(f gin.HandlerFunc) SetServerOptionFunc {
return func(so *serverOption) {
if nil == f {
return
}
so.demoCheck = f
}
}
// WithRateLimitInstance 设置流控实例, 配置为 nil, 代表禁用