Documentation ¶
Index ¶
Constants ¶
View Source
const ( ErrBurstToNormalRatioOverflow = "overflow in burst-to-normal ratio: %v vs %v" ErrZeroSpeed = "zero speed is not allowed" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SLReader ¶
type SLReader struct {
// contains filtered or unexported fields
}
SLReader is a speed-limited reader.
func NewReader ¶
func NewReader(r io.Reader, normalLimit float64, burstLimit int, bnr float64) (slr *SLReader, err error)
NewReader creates a new SLReader. 'normalLimit' and 'burstLimit' are speed limits set in bytes per second. 'bnr' is the maximum burst-to-normal ratio allowed, i.e. max(burst/normal).
func (*SLReader) ChangeLimits ¶
ChangeLimits changes the speed limit settings.
Click to show internal directories.
Click to hide internal directories.