routeLimiter

package
v2.16.6 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RouteLimiter

type RouteLimiter struct {
	RouteSetMap *sync.Map
}

RouteLimiter 路由限流器

var (
	App RouteLimiter
)

func (*RouteLimiter) Add

func (r *RouteLimiter) Add(router string, t time.Duration, maxVisitTimes uint64) *RouteLimiter

Add 添加限流规则

func (*RouteLimiter) Affirm

func (r *RouteLimiter) Affirm(router, ip string) (*ipLimiter.Visit, bool)

Affirm 检查是否通过限流

func (RouteLimiter) Once added in v2.1.0

func (RouteLimiter) Once() *RouteLimiter

Once 单例化:路由限流

Jump to

Keyboard shortcuts

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