Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoBurstAvilable = fmt.Errorf("burst value too low for i/o operation")
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn interface { // Conn implements the net.Conn interface. net.Conn // SetLimit sets the bandwith limit for future i/o ops. SetLimit(bps Bandwidth) // Limit returns the current bandwith limit. Limit() Bandwidth }
Conn is a generic stream-oriented network connection with Bandwith limiting capability.
type LimitedListener ¶
type LimitedListener interface { // Listener implements net.Listener interface. net.Listener // SetLimits sets the per listener and per connection bandwith limits SetLimits(listenerLimit, connLimit Bandwidth) // Limits return the per listener and per connection bandwith limits. Limits() (listenerLimit, connLimit Bandwidth) }
LimitedListener controlls how often read and writes bandwitch for connections spawned by a listener.
func NewLimitedListener ¶
func NewLimitedListener(l net.Listener) LimitedListener
type LimitedReader ¶
type LimitedReader interface { io.Reader // SetReadLimit sets the bandwidth limtis for future read. SetReadLimit(bps Bandwidth) // ReadLimit returns the read i/o bandwidth limit. ReadLimit() Bandwidth }
LimitedReader controlls how often reads are allowed to happen.
func NewLimitedReader ¶
func NewLimitedReader(r io.Reader, bps Bandwidth) LimitedReader
NewLimitedReader creates new LimitedReader.
type LimitedWriter ¶
type LimitedWriter interface { io.Writer // SetWriteLimit sets the bandwidth limit for future write i/o ops. SetWriteLimit(bps Bandwidth) // WriteLimit returns the write i/o bandwidth limit. WriteLimit() Bandwidth }
LimitedWriter controlls how often writes are allowed to happen.
func NewLimitedWriter ¶
func NewLimitedWriter(w io.Writer, bps Bandwidth) LimitedWriter
NewLimitedWriter creates new Writer and sets
Click to show internal directories.
Click to hide internal directories.