middleware

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CacheKeyIgnoreQuery = []string{
	"api_key",

	"starttimeticks",
	"x-playback-session-id",

	"playsessionid",
	"tag",
}

计算Key时忽略的查询参数

Functions

func ClientFilter

func ClientFilter() gin.HandlerFunc

客户端过滤器

func ImageCache

func ImageCache(ttl time.Duration, reg *regexp.Regexp) gin.HandlerFunc

func Logger

func Logger() gin.HandlerFunc

记录访问日志

func Recovery

func Recovery() gin.HandlerFunc

func SetRefererPolicy

func SetRefererPolicy(value constants.ReferrerPolicy) gin.HandlerFunc

设置Referer策略

func SubtitleCache

func SubtitleCache(ttl time.Duration, reg *regexp.Regexp) gin.HandlerFunc

Types

type CacheData

type CacheData struct {
	StatusCode int         // code 响应码
	Header     http.Header // header 响应头信息
	Body       []byte      // body 响应体
}

func ParseCacheData

func ParseCacheData(data []byte) (*CacheData, error)

func (*CacheData) Json

func (c *CacheData) Json() ([]byte, error)

func (*CacheData) WriteResponse

func (c *CacheData) WriteResponse(ctx *gin.Context)

type WriterWarp

type WriterWarp struct {
	gin.ResponseWriter
	Body bytes.Buffer
}

自定义的请求响应器

用于记录缓存数据

func (*WriterWarp) Write

func (w *WriterWarp) Write(data []byte) (int, error)

Jump to

Keyboard shortcuts

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