ratelimit

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckGlobal

func CheckGlobal() bool

CheckGlobal checks global rate limit

func WaitGlobal

func WaitGlobal(ctx context.Context) error

WaitGlobal waits for global rate limit

Types

type Limiter

type Limiter struct {
	// contains filtered or unexported fields
}

Limiter implements token bucket rate limiting

func NewLimiter

func NewLimiter(rate float64, capacity int) *Limiter

NewLimiter creates a rate limiter (rate per second, burst capacity)

func (*Limiter) Allow

func (l *Limiter) Allow() bool

Allow checks if request is allowed

func (*Limiter) Wait

func (l *Limiter) Wait(ctx context.Context) error

Wait blocks until request can proceed

Jump to

Keyboard shortcuts

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