Documentation
¶
Overview ¶
Package fakeproxy is a fake HTTP proxy (CONNECT tunnels and requests in absolute form, optionally over TLS) and a fake SOCKS5 proxy (CONNECT, optionally with username and password authentication), for the tests of the outbound package and for `muster dev`. Both record every target they connect to, and resolve the names in their Hosts first, so that a test can name a target only the proxy can resolve. Both also answer GET /_fake/requests on their own port with the connections they made, so that a live check can see what went through them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
Connection is a connection the proxy made: the target as the client asked for it, and the local address of the proxy's connection to it, which is the remote address the target sees.
type Options ¶
type Options struct {
// Username and Password, when set, are required: Proxy-Authorization Basic for HTTP, RFC 1929 for SOCKS5.
Username, Password string
// Hosts maps names that only the proxy resolves to the host:port it connects to instead.
Hosts map[string]string
// TLS, when set, makes an HTTP proxy serve TLS, as an https proxy.
TLS *tls.Config
}
Options configure a fake proxy.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a running fake proxy.
func Start ¶
Start starts a fake proxy of kind on addr, such as 127.0.0.1:0; it runs until Close or the end of ctx.
func (*Server) Connections ¶
func (s *Server) Connections() []Connection
Connections lists the connections the proxy made, oldest first.