ratelimit

package
v0.0.104-dev Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2025 License: AGPL-3.0 Imports: 2 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 implements a simple token-bucket rate limiter. Tokens are replenished over time.

func NewLimiter

func NewLimiter(rate float64) *Limiter

func (*Limiter) Wait

func (l *Limiter) Wait(n int)

type Writer

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

func NewWriter

func NewWriter(w io.Writer, l *Limiter) *Writer

func (*Writer) Write

func (rw *Writer) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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