Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Listen string // local address, e.g. "127.0.0.1:0"
Target string // upstream host:port or URL
Read Direction
Write Direction
DialTimeout time.Duration // 0 uses a 5s default
}
Config describes a test proxy. Read and Write are from the connecting client's point of view: Read impairs data the client receives, Write impairs data the client sends.
type Direction ¶
Direction impairs one direction of traffic, from the connecting client's point of view. FailureRatio is the percent (0-100) of connections that fail in this direction. Latency is applied once, on the first I/O. MaxKBps of 0 means unlimited.
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
func ForTest ¶
ForTest starts a proxy that shuts down when the test ends. Listen errors fail the test; later target dial errors do not.
func (*Proxy) FailureRatio ¶ added in v0.3.0
FailureRatio is the fraction of accepted connections that had a dial failure or an injected/copy failure.