go4.org: go4.org/net/throttle Index | Files

package throttle

import "go4.org/net/throttle"

Package throttle provides a net.Listener that returns artificially-delayed connections for testing real-world connectivity.

Index

Package Files

throttle.go

type Listener Uses

type Listener struct {
    net.Listener
    Down Rate // server Writes to Client
    Up   Rate // server Reads from client
}

func (*Listener) Accept Uses

func (ln *Listener) Accept() (net.Conn, error)

type Rate Uses

type Rate struct {
    KBps    int // or 0, to not rate-limit bandwidth
    Latency time.Duration
}

Package throttle imports 4 packages (graph) and is imported by 1 packages. Updated 2017-01-10. Refresh now. Tools for package owners.