rate

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Limiter

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

Limiter holds a collection of buckets to track global and per-route rate limits. Create one with NewLimiter.

func NewLimiter

func NewLimiter() *Limiter

NewLimiter returns an initialized and ready to use Limiter.

func (*Limiter) Update

func (r *Limiter) Update(key string, header http.Header)

Update updates the rate limit for an endpoint given its key.

func (*Limiter) Wait

func (r *Limiter) Wait(key string)

Wait waits for a request to be theoretically safe to be sent (meaning it should not result in a 429 TO MANY REQUESTS) given the requested endpoint's key.

Jump to

Keyboard shortcuts

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