middleware

package
v0.0.0-...-849f898 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CorsEx = cors.New(cors.Config{
	AllowMethods:    []string{"GET,POST,PUT,PATCH,DELETE,OPTIONS"},
	AllowHeaders:    []string{"Keep-Alive,User-Agent,Cache-Control,Content-Type,Authorization"},
	AllowAllOrigins: true,
})

Functions

func AuthSign

func AuthSign() gin.HandlerFunc

AuthSign ...

func AuthToken

func AuthToken() gin.HandlerFunc

AuthToken ...

func Cors

func Cors() gin.HandlerFunc

func RateLimitOnConcurrency

func RateLimitOnConcurrency(maxConcurrency int64, logOnly bool) gin.HandlerFunc

RateLimitOnConcurrency 限制最大并发数 估算最大并发数公式:

单机峰值OPS * 接口平均延时,

例如:

	服务峰值ops = 8000个请求每秒, 接口平均延时为 25ms
那么,
	最大并发数 = 8000 * 0.025 = 200

func Recovery

func Recovery(deal func(c *gin.Context)) gin.HandlerFunc

func Trace

func Trace() gin.HandlerFunc

Trace 拦截器

Types

type RateLimitConcurrency

type RateLimitConcurrency struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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