Documentation
¶
Overview ¶
Package proxy exposes the router through the two entry points a client can reach it by: an HTTP CONNECT proxy that terminates TLS for the intercepted hosts, and a direct TLS listener presenting the intercepted host's name.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Serve ¶
func Serve(ctx context.Context, name, addr string, handler http.Handler, authority *ca.Bundle, fallbackHost string) error
Serve runs handler on addr until ctx is cancelled. When authority is non-nil the listener speaks TLS, presenting a certificate for whichever name the client asks for and falling back to fallbackHost without SNI. This is the entry point for clients redirected by DNS or a hosts file rather than by proxy settings.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the HTTP CONNECT proxy.
func NewServer ¶
func NewServer(cfg *config.Config, authority *ca.Bundle, handler http.Handler, transport http.RoundTripper, dial Dialer) *Server
NewServer builds the CONNECT proxy around handler. transport forwards plain-HTTP requests for hosts that are not intercepted and must not route through this proxy; dial opens the CONNECT tunnels. Both fall back to the operating system's defaults when nil.