Documentation
¶
Overview ¶
Package proxychaintest provides an in-process HTTP CONNECT forward proxy for tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClosedAddr ¶ added in v1.6.0
ClosedAddr returns a local address nothing listens on.
func FirstBytes ¶ added in v1.6.0
FirstBytes starts a TCP server that reports the first n bytes the client sends on the first connection that sends them (a protocol header, a TLS ClientHello), then hangs up. Closed on test cleanup.
Types ¶
type Proxy ¶
type Proxy struct {
*httptest.Server
// Reject, if set, is consulted for each CONNECT; a non-zero status short
// circuits with that status and headers.
Reject func(target string) (int, http.Header)
// Hold, if set, is closed by the test to release a CONNECT that is
// deliberately left unanswered.
Hold chan struct{}
// contains filtered or unexported fields
}
Proxy is an httptest forward proxy: CONNECT is hijacked and piped to the requested authority, plain requests are forwarded absolute-URI style. It records every CONNECT authority and Proxy-Authorization it saw.
Click to show internal directories.
Click to hide internal directories.