proxy

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MaybeStartProxy

func MaybeStartProxy(
	host string,
	port int,
	user string,
	usePass bool,
	identity string,
	logger *logprinter.Logger,
) error

MaybeStartProxy maybe starts an inner http/tcp proxies

func MaybeStopProxy

func MaybeStopProxy()

MaybeStopProxy stops the http/tcp proxies if it has been started before

Types

type HTTPProxy

type HTTPProxy struct {
	// contains filtered or unexported fields
}

HTTPProxy stands for a http proxy based on SSH connection

func NewHTTPProxy

func NewHTTPProxy(host string,
	port int,
	user, password, keyFile, passphrase string,
	logger *logprinter.Logger,
) *HTTPProxy

NewHTTPProxy creates and initializes a new http proxy

func (*HTTPProxy) ServeHTTP

func (s *HTTPProxy) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler

type TCPProxy

type TCPProxy struct {
	// contains filtered or unexported fields
}

TCPProxy represents a simple TCP proxy unlike HTTP proxies, TCP proxies are point-to-point

func GetTCPProxy

func GetTCPProxy() *TCPProxy

GetTCPProxy returns the tcp proxy

func NewTCPProxy

func NewTCPProxy(
	host string,
	port int,
	user, password, keyFile, passphrase string,
	logger *logprinter.Logger,
) *TCPProxy

NewTCPProxy starts a 1to1 TCP proxy

func (*TCPProxy) Close

func (p *TCPProxy) Close(c chan struct{})

Close closes a proxy

func (*TCPProxy) GetEndpoints

func (p *TCPProxy) GetEndpoints() []string

GetEndpoints returns the endpoint list

func (*TCPProxy) Run

func (p *TCPProxy) Run(upstream []string) chan struct{}

Run runs proxy all traffic to upstream

func (*TCPProxy) Stop

func (p *TCPProxy) Stop() error

Stop stops the tcp proxy

Jump to

Keyboard shortcuts

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