throttle

package
v0.5.15 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Throttle

type Throttle struct {
	MaxQps    int64
	IpSplit   bool
	BreakTime time.Duration
	// contains filtered or unexported fields
}

func NewThrottle

func NewThrottle(maxQps int64, breakTime time.Duration, ipSplit bool) *Throttle

NewThrottle 实例化限速中间件 maxRateSecond:每秒最大请求数 breakTime:限制时长

func (Throttle) Func

func (w Throttle) Func() app.MiddlewareFunc

Func implements Middleware interface.

Jump to

Keyboard shortcuts

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