limiter

package
v0.20.6 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(every time.Duration, burst int) zeroapi.Handler

New 全局限流器,每隔 every 时间放入一个令牌,满 burst 个令牌后不放入新令牌

func NewIP

func NewIP(every time.Duration, burst int) zeroapi.Handler

NewIP 针对 ip 的限流器,每隔 every 时间放入一个令牌,满 burst 个令牌后不放入新令牌

func SetBurst

func SetBurst(burst int)

SetBurst 动态修改令牌桶大小

func SetLimit

func SetLimit(every time.Duration)

SetLimit 动态修改放入令牌的速率

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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