Documentation ¶
Index ¶
- Constants
- type Limit
- type Limiter
- func (lim *Limiter) Burst() int
- func (lim *Limiter) Limit() Limit
- func (lim *Limiter) Reader(r io.Reader) io.Reader
- func (lim *Limiter) ReaderWithContext(ctx context.Context, r io.Reader) io.Reader
- func (lim *Limiter) SetBurst(newBurst int)
- func (lim *Limiter) SetLimit(newLimit Limit)
- func (lim *Limiter) Writer(w io.Writer) io.Writer
- func (lim *Limiter) WriterWithContext(ctx context.Context, w io.Writer) io.Writer
Constants ¶
View Source
const Inf = Limit(rate.Inf)
Inf represents an infinite rate limit; it allows all transfers, even if the burst is zero.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Limit ¶
Limit defines the maximum transfer speed of data. The Limit is represented as a rate limit per second. A zero Limit means no transfers are allowed.
type Limiter ¶
type Limiter struct {
// contains filtered or unexported fields
}
A Limiter controls the speed at which transfers are allowed to happen.
The zero value is a valid Limiter, but it will reject all transfers. Use New to create non-zero Limiters.
func (*Limiter) ReaderWithContext ¶
ReaderWithContext returns a reader with limiting and context.
Click to show internal directories.
Click to hide internal directories.