proxy

package
v0.0.0-...-683b059 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2022 License: BSD-3-Clause Imports: 13 Imported by: 0

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

type AuthCredentials struct {
	Username string
	Password string
}

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 NewServer

func NewServer() *Server

NewServer creates a new Server.

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.

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

Stop stops the proxy server instance.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL