Documentation
¶
Overview ¶
Package testproxy is a small TCP forwarder for tests: it sits between a client and a server and can add a delay to every chunk, cut the open connections and refuse new ones. Its listener is open from the start.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Proxy forwards the connections that reach Addr to the target.
func (*Proxy) Close ¶
func (p *Proxy) Close()
Close stops the listener, closes every connection and waits for the goroutines.
func (*Proxy) Cut ¶
func (p *Proxy) Cut()
Cut closes every open connection. New connections are still accepted.
func (*Proxy) SetDelay ¶
SetDelay adds d to every chunk that is forwarded, in both directions (zero: no delay). It applies to the open connections too, from the next chunk.