bandwidth

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MinLimit represents the minimum allowed bandwidth, constrained by the maximum record size (8 Mb).
	MinLimit = 8 * 1024 * 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Limiter

type Limiter struct {
	*rate.Limiter
	// contains filtered or unexported fields
}

Limiter wrapper around standard rate.Limiter.

func NewLimiter

func NewLimiter(limit int) *Limiter

NewLimiter returns new bandwidth limiter.

func (*Limiter) Wait

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

Wait blocks until lim permits n events to happen.

Jump to

Keyboard shortcuts

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