Documentation
¶
Index ¶
- func AccessLog(logger logContract.Logger, config AccessLogConfig) gin.HandlerFunc
- func HttpsRedirect() gin.HandlerFunc
- func RateLimiter(period time.Duration, limit int64) gin.HandlerFunc
- func Recovery(logger logContract.Logger) gin.HandlerFunc
- func RequestID() gin.HandlerFunc
- func Security(config SecurityConfig) gin.HandlerFunc
- type AccessLogConfig
- type SecurityConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AccessLog ¶
func AccessLog(logger logContract.Logger, config AccessLogConfig) gin.HandlerFunc
AccessLog 访问日志中间件 记录HTTP请求的访问日志,支持跳过指定路径
func RateLimiter ¶
func RateLimiter(period time.Duration, limit int64) gin.HandlerFunc
func Recovery ¶
func Recovery(logger logContract.Logger) gin.HandlerFunc
func Security ¶
func Security(config SecurityConfig) gin.HandlerFunc
Security 安全头中间件 添加各种安全相关的HTTP头,提高应用安全性
Types ¶
type AccessLogConfig ¶
type AccessLogConfig struct {
Enabled bool `yaml:"enabled"`
Format string `yaml:"format"`
SkipPaths []string `yaml:"skip-paths"`
}
AccessLogConfig 访问日志配置
Click to show internal directories.
Click to hide internal directories.