Documentation
¶
Index ¶
- func Auth(c *gin.Context)
- func AuthAdmin(c *gin.Context)
- func AuthNotGuest(c *gin.Context)
- func Authn(c *gin.Context)
- func Down(verifyFunc func(string, string) error) func(c *gin.Context)
- func DownloadRateLimiter(limiter stream.Limiter) gin.HandlerFunc
- func ErrorLogging() gin.HandlerFunc
- func FilteredLogger() gin.HandlerFunc
- func ForceHTTPS(c *gin.Context)
- func FsUp(c *gin.Context)
- func MaxAllowed(n int) gin.HandlerFunc
- func SearchIndex(c *gin.Context)
- func StoragesLoaded(c *gin.Context)
- func UploadRateLimiter(limiter stream.Limiter) gin.HandlerFunc
- type ResponseWriterWrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthNotGuest ¶
AuthNotGuest 中间件,确保用户不是访客 需要在Auth或Authn中间件之后使用
func Down ¶
Down 中间件生成器,用于处理下载请求的验证 验证文件路径和签名
参数:
- verifyFunc: 签名验证函数,接受路径和签名参数
返回:
- gin.HandlerFunc: Gin中间件函数
func DownloadRateLimiter ¶
func DownloadRateLimiter(limiter stream.Limiter) gin.HandlerFunc
DownloadRateLimiter 中间件生成器,限制下载速率 包装响应写入器,应用速率限制
参数:
- limiter: 速率限制器
返回:
- gin.HandlerFunc: Gin中间件函数
func ErrorLogging ¶
func ErrorLogging() gin.HandlerFunc
ErrorLogging 中间件,记录HTTP响应中的错误信息 捕获响应体中的错误信息或状态码错误,并记录到日志中
返回:
- gin.HandlerFunc: Gin中间件函数
func FilteredLogger ¶ added in v4.2.8
func FilteredLogger() gin.HandlerFunc
func MaxAllowed ¶
func MaxAllowed(n int) gin.HandlerFunc
MaxAllowed 中间件生成器,限制并发请求数量 使用信号量模式实现请求限流
参数:
- n: 最大并发请求数
返回:
- gin.HandlerFunc: Gin中间件函数
func StoragesLoaded ¶
StoragesLoaded 中间件,检查存储是否已加载完成 如果存储尚未加载,除了某些特定路径外,其他请求将被拒绝
允许通过的路径包括: - 根路径和favicon.ico - 静态资源路径(assets、images、streamer、static)
func UploadRateLimiter ¶
func UploadRateLimiter(limiter stream.Limiter) gin.HandlerFunc
UploadRateLimiter 中间件生成器,限制上传速率 包装请求体,应用速率限制
参数:
- limiter: 速率限制器
返回:
- gin.HandlerFunc: Gin中间件函数
Types ¶
type ResponseWriterWrapper ¶
type ResponseWriterWrapper struct {
gin.ResponseWriter // 原始的响应写入器
WrapWriter io.Writer // 包装的写入器
}
ResponseWriterWrapper 响应写入器包装器 将响应写入重定向到自定义的写入器
Click to show internal directories.
Click to hide internal directories.