limit

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2021 License: Apache-2.0 Imports: 5 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 `json:"rate" yaml:"rate" toml:"rate"`

	// max size,桶内最大量
	BucketSize int `json:"bucket_size" yaml:"bucket_size" toml:"bucket_size"`
}

type RateLimiter

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

速率限制器

func NewLimiter

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

func (*RateLimiter) GinLimit

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

Directories

Path Synopsis
Package rate provides a rate limiter.
Package rate provides a rate limiter.

Jump to

Keyboard shortcuts

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