routeLimiter

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 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 (
	RouterLimiterApp 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) Single

func (RouteLimiter) Single() *RouteLimiter

Single 单例化:路由限流

Jump to

Keyboard shortcuts

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