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.


Package Files


type Listener Uses

type Listener struct {
    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 4 packages. Updated 2018-12-03. Refresh now. Tools for package owners.