Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ToxicRegistry map[string]Toxic
Functions ¶
Types ¶
type BandwidthToxic ¶
type BandwidthToxic struct { // Rate in KB/s Rate int64 `json:"rate"` }
The BandwidthToxic passes data through at a limited rate
func (*BandwidthToxic) Pipe ¶
func (t *BandwidthToxic) Pipe(stub *ToxicStub)
type BufferedToxic ¶
type BufferedToxic interface { // Defines the size of buffer this toxic should use GetBufferSize() int }
type LatencyToxic ¶
type LatencyToxic struct { // Times in milliseconds Latency int64 `json:"latency"` Jitter int64 `json:"jitter"` }
The LatencyToxic passes data through with the a delay of latency +/- jitter added.
func (*LatencyToxic) GetBufferSize ¶
func (t *LatencyToxic) GetBufferSize() int
func (*LatencyToxic) Pipe ¶
func (t *LatencyToxic) Pipe(stub *ToxicStub)
type NoopToxic ¶
type NoopToxic struct{}
The NoopToxic passes all data through without any toxic effects.
type SlicerToxic ¶
type SlicerToxic struct { // Average number of bytes to slice at AverageSize int `json:"average_size"` // +/- bytes to vary sliced amounts. Must be less than // the average size SizeVariation int `json:"size_variation"` // Microseconds to delay each packet. May be useful since there's // usually some kind of buffering of network data Delay int `json:"delay"` }
The SlicerToxic slices data into multiple smaller packets to simulate real-world TCP behaviour.
func (*SlicerToxic) Pipe ¶
func (t *SlicerToxic) Pipe(stub *ToxicStub)
type SlowCloseToxic ¶
type SlowCloseToxic struct { // Times in milliseconds Delay int64 `json:"delay"` }
The SlowCloseToxic stops the TCP connection from closing until after a delay.
func (*SlowCloseToxic) Pipe ¶
func (t *SlowCloseToxic) Pipe(stub *ToxicStub)
type TimeoutToxic ¶
type TimeoutToxic struct { // Times in milliseconds Timeout int64 `json:"timeout"` }
The TimeoutToxic stops any data from flowing through, and will close the connection after a timeout. If the timeout is set to 0, then the connection will not be closed.
func (*TimeoutToxic) Pipe ¶
func (t *TimeoutToxic) Pipe(stub *ToxicStub)
type Toxic ¶
type Toxic interface { // Defines how packets flow through a ToxicStub. Pipe() blocks until the link is closed or interrupted. Pipe(*ToxicStub) }
func New ¶
func New(wrapper *ToxicWrapper) Toxic
type ToxicStub ¶
type ToxicStub struct { Input <-chan *stream.StreamChunk Output chan<- *stream.StreamChunk Interrupt chan struct{} // contains filtered or unexported fields }
func NewToxicStub ¶
func NewToxicStub(input <-chan *stream.StreamChunk, output chan<- *stream.StreamChunk) *ToxicStub
func (*ToxicStub) InterruptToxic ¶
Interrupt the flow of data so that the toxic controlling the stub can be replaced. Returns true if the stream was successfully interrupted, or false if the stream is closed.
func (*ToxicStub) Run ¶
func (s *ToxicStub) Run(toxic *ToxicWrapper)
Begin running a toxic on this stub, can be interrupted. Runs a noop toxic randomly depending on toxicity