throttle - ActiveState ActiveGo 1.8

Package throttle

import ""

Overview ▾

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

type Listener

type Listener struct {
    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