go4.orggo4.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

Types

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
}

Source Files

throttle.go

Version
v0.0.0-20230225012048-214862532bf5 (latest)
Published
Feb 25, 2023
Platform
linux/amd64
Imports
4 packages
Last checked
1 month ago

Tools for package owners.