throttle - ActiveState ActiveGo 1.8
...

Package throttle

import "go4.org/net/throttle"
Overview
Index

Overview ▾

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

type Listener

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

func (*Listener) Accept

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

type Rate

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