Documentation ¶
Index ¶
- Constants
- func CacheMiddleware(cacheDuration time.Duration) gin.HandlerFunc
- func CheckAuthMiddlewareFunc(auth user2.Auth) gin.HandlerFunc
- func CheckHeaderMiddleware(ctx *gin.Context)
- func ClearCheckAuth()
- func Code() *code
- func CorsMiddleware() gin.HandlerFunc
- func GenerateCacheKey(c *gin.Context) (string, error)
- func GetAuthUser(ctx *gin.Context) (user2.User, error)
- func InitCheckAuth(svc *svc.Svc)
- func NewStatusCodeGreaterThan(code int) gin.HandlerFunc
- func RateLimitMiddleware(limit int, duration time.Duration) gin.HandlerFunc
- type CacheEntry
- type CheckAuth
- type CodeResp
- type Jwt
- type JwtMapClaims
- type LoginRequest
- type RateLimitMiddlewareRequestInfo
- type ResponseRecorder
- type VerifyCodeReq
Constants ¶
View Source
const CubeProHeaderKey = "x-cubing-pro"
View Source
const IdentityKey = "UserDetail"
Variables ¶
This section is empty.
Functions ¶
func CacheMiddleware ¶
func CacheMiddleware(cacheDuration time.Duration) gin.HandlerFunc
CacheMiddleware 缓存中间件
func CheckAuthMiddlewareFunc ¶
func CheckAuthMiddlewareFunc(auth user2.Auth) gin.HandlerFunc
func CheckHeaderMiddleware ¶
func ClearCheckAuth ¶
func ClearCheckAuth()
func CorsMiddleware ¶
func CorsMiddleware() gin.HandlerFunc
func GenerateCacheKey ¶
GenerateCacheKey 根据请求生成一个唯一的缓存键
func InitCheckAuth ¶
func NewStatusCodeGreaterThan ¶
func NewStatusCodeGreaterThan(code int) gin.HandlerFunc
func RateLimitMiddleware ¶
func RateLimitMiddleware(limit int, duration time.Duration) gin.HandlerFunc
Types ¶
type CacheEntry ¶
CacheEntry 存储缓存的响应内容及其创建时间
type Jwt ¶
type Jwt struct { *jwt.GinJWTMiddleware // contains filtered or unexported fields }
type JwtMapClaims ¶
type JwtMapClaims struct { Id uint `json:"id"` Auth user2.Auth `json:"auth"` Name string `json:"name"` EnName string `json:"enName"` LoginID string `json:"loginID"` CubeID string `json:"cubeID"` WcaID string `json:"wcaID"` DelegateName string `json:"delegateName"` }
func GetJwtUser ¶
func GetJwtUser(ctx *gin.Context) (JwtMapClaims, error)
type LoginRequest ¶
type RateLimitMiddlewareRequestInfo ¶
type RateLimitMiddlewareRequestInfo struct {
// contains filtered or unexported fields
}
type ResponseRecorder ¶
type ResponseRecorder struct { gin.ResponseWriter Writer io.Writer }
ResponseRecorder 捕获 gin 响应的自定义 writer
type VerifyCodeReq ¶
Click to show internal directories.
Click to hide internal directories.