middleware

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultRegistry = metrics.NewRegistry()
)

Functions

func Cors

func Cors() gin.HandlerFunc

跨域处理

func GetRequestsIp

func GetRequestsIp(r *http.Request) string

GetIP gets a requests IP address by reading off the forwarded-for header (for proxies) and falls back to use the remote address.

func InitContext

func InitContext() gin.HandlerFunc

func Limiter

func Limiter(maxBurstSize int) gin.HandlerFunc

maxBurstSize 每秒允许最大请求数

func PrintPostData

func PrintPostData() gin.HandlerFunc

func ProtocolDeal

func ProtocolDeal() gin.HandlerFunc

func RequestStats

func RequestStats() gin.HandlerFunc

RequestStats middleware

func StatsReport

func StatsReport() metrics.Registry

Report from default metric registry

func TimeoutMiddleware

func TimeoutMiddleware(timeout time.Duration) func(c *gin.Context)

TimeoutMiddleware 超时控制

Types

This section is empty.

Jump to

Keyboard shortcuts

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