bwlimit

package
v2.7.1 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadCloser

func ReadCloser(ctx context.Context, reader io.ReadCloser, limiter *Limiter) io.ReadCloser

func Reader

func Reader(ctx context.Context, reader io.Reader, limiter *Limiter) io.Reader

Types

type Limiter

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

func New

func New(maxBytesPerSecond uint64) *Limiter

func (*Limiter) SameRate

func (l *Limiter) SameRate(maxBytesPerSecond uint64) bool

SameRate reports whether the limiter already enforces maxBytesPerSecond. It is nil-safe: a nil limiter matches only a zero (disabled) rate.

func (*Limiter) Wait

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

Jump to

Keyboard shortcuts

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