Versions in this module Expand all Collapse all v1 v1.0.0 Sep 1, 2023 Changes in this version + var ErrLimit = errors.New("flowrate: flow rate limit exceeded") + type Limiter interface + Done func() int64 + SetBlocking func(new bool) (old bool) + SetLimit func(new int64) (old int64) + SetTransferSize func(bytes int64) + Status func() Status + type Monitor struct + func New(sampleRate, windowSize time.Duration) *Monitor + func (m *Monitor) Done() int64 + func (m *Monitor) IO(n int, err error) (int, error) + func (m *Monitor) Limit(want int, rate int64, block bool) (n int) + func (m *Monitor) SetREMA(rEMA float64) + func (m *Monitor) SetTransferSize(bytes int64) + func (m *Monitor) Status() Status + func (m *Monitor) Update(n int) int + type Percent uint32 + func (p Percent) Float() float64 + func (p Percent) String() string + type Reader struct + func NewReader(r io.Reader, limit int64) *Reader + func (r *Reader) Close() error + func (r *Reader) Read(p []byte) (n int, err error) + func (r *Reader) SetBlocking(new bool) (old bool) + func (r *Reader) SetLimit(new int64) (old int64) + type Status struct + Active bool + AvgRate int64 + Bytes int64 + BytesRem int64 + CurRate int64 + Duration time.Duration + Idle time.Duration + InstRate int64 + PeakRate int64 + Progress Percent + Samples int64 + Start time.Time + TimeRem time.Duration + type Writer struct + func NewWriter(w io.Writer, limit int64) *Writer + func (w *Writer) Close() error + func (w *Writer) SetBlocking(new bool) (old bool) + func (w *Writer) SetLimit(new int64) (old int64) + func (w *Writer) Write(p []byte) (n int, err error)