middlewares

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cors

func Cors(conf CorsConfig) gin.HandlerFunc

func GinLogger

func GinLogger() gin.HandlerFunc

GinLogger 接收gin框架默认的日志

func GinRecovery

func GinRecovery(stack bool) gin.HandlerFunc

GinRecovery recover掉项目可能出现的panic,并使用zap记录相关日志

func IPWhiteList

func IPWhiteList(whiteList []string) gin.HandlerFunc

func RateLimiter

func RateLimiter(client *libredis.Client, limitStr string) gin.HandlerFunc

func TokenValidate

func TokenValidate() gin.HandlerFunc

TokenValidate validate user's token is valid or not

Types

type CorsConfig

type CorsConfig struct {
	AllowOrigins     []string `json:"allowOrigins"`
	AllowMethods     []string `json:"allowMethods"`
	AllowHeaders     []string `json:"allowHeaders"`
	AllowCredentials bool     `json:"allowCredentials"`
	MaxAge           int      `json:"maxAge"`
}

Jump to

Keyboard shortcuts

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