limit

package
Version: v1.0.20 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// per second request,0 不限流
	Rate int

	// max size,桶内最大量
	BucketSize int
}

type RateLimiter

type RateLimiter struct {
	C            *Config
	LimiterGroup *xrate.RateGroup
}

速率限制器

func NewLimiter

func NewLimiter(c *Config) (rl *RateLimiter)

func (*RateLimiter) EchoLimit added in v1.0.8

func (r *RateLimiter) EchoLimit() echo.MiddlewareFunc

func (*RateLimiter) GinLimit added in v1.0.8

func (r *RateLimiter) GinLimit() gin.HandlerFunc

Source Files

Jump to

Keyboard shortcuts

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