Documentation ¶
Overview ¶
Package proxy allows running an http proxy server on the DUT for tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthCredentials ¶
AuthCredentials can be used to specify an authenticated user with the Basic scheme for the proxy.
type Server ¶
type Server struct { HostAndPort string // contains filtered or unexported fields }
Server represents a HTTP proxy server running on the DUT.
func (*Server) Start ¶
func (s *Server) Start(ctx context.Context, port int, auth *AuthCredentials, allowlist []string) (retErr error)
Start starts a proxy server. `port` must be a valid port number where the proxy will listen for connections. The proxy address will be assigned by patchpanel. If `auth` is specified, access to the proxy is only granted for authenticated users. If proxy configuration and setup are successful, `s.HostAndPort` will be set to the host and port of the local proxy in the format <host>:<port>. If `allowlist` is not empty, only connection to hosts specified in `allowlist` are allowed. The hostnames will be matched using reqular expressions.