proxy

package
v0.39.3 Latest Latest
Warning

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

Go to latest
Published: May 14, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProxyPhaseNew         = "new"
	ProxyPhaseWaitStart   = "wait start"
	ProxyPhaseStartErr    = "start error"
	ProxyPhaseRunning     = "running"
	ProxyPhaseCheckFailed = "check failed"
	ProxyPhaseClosed      = "closed"
)

Variables

This section is empty.

Functions

func HandleTCPWorkConnection

func HandleTCPWorkConnection(ctx context.Context, localInfo *config.LocalSvrConf, proxyPlugin plugin.Plugin,
	baseInfo *config.BaseProxyConf, limiter *rate.Limiter, workConn net.Conn, encKey []byte, m *msg.StartWorkConn)

Common handler for tcp work connections.

Types

type BaseProxy

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

type HTTPProxy

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

HTTP

func (*HTTPProxy) Close

func (pxy *HTTPProxy) Close()

func (*HTTPProxy) InWorkConn

func (pxy *HTTPProxy) InWorkConn(conn net.Conn, m *msg.StartWorkConn)

func (*HTTPProxy) Run

func (pxy *HTTPProxy) Run() (err error)

type HTTPSProxy

type HTTPSProxy struct {
	*BaseProxy
	// contains filtered or unexported fields
}

HTTPS

func (*HTTPSProxy) Close

func (pxy *HTTPSProxy) Close()

func (*HTTPSProxy) InWorkConn

func (pxy *HTTPSProxy) InWorkConn(conn net.Conn, m *msg.StartWorkConn)

func (*HTTPSProxy) Run

func (pxy *HTTPSProxy) Run() (err error)

type Manager

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

func NewManager

func NewManager(ctx context.Context, msgSendCh chan (msg.Message), clientCfg config.ClientCommonConf, serverUDPPort int) *Manager

func (*Manager) Close

func (pm *Manager) Close()

func (*Manager) GetAllProxyStatus

func (pm *Manager) GetAllProxyStatus() []*WorkingStatus

func (*Manager) HandleEvent

func (pm *Manager) HandleEvent(evType event.Type, payload interface{}) error

func (*Manager) HandleWorkConn

func (pm *Manager) HandleWorkConn(name string, workConn net.Conn, m *msg.StartWorkConn)

func (*Manager) Reload

func (pm *Manager) Reload(pxyCfgs map[string]config.ProxyConf)

func (*Manager) StartProxy

func (pm *Manager) StartProxy(name string, remoteAddr string, serverRespErr string) error

type Proxy

type Proxy interface {
	Run() error

	// InWorkConn accept work connections registered to server.
	InWorkConn(net.Conn, *msg.StartWorkConn)

	Close()
}

Proxy defines how to handle work connections for different proxy type.

func NewProxy

func NewProxy(ctx context.Context, pxyConf config.ProxyConf, clientCfg config.ClientCommonConf, serverUDPPort int) (pxy Proxy)

type STCPProxy

type STCPProxy struct {
	*BaseProxy
	// contains filtered or unexported fields
}

STCP

func (*STCPProxy) Close

func (pxy *STCPProxy) Close()

func (*STCPProxy) InWorkConn

func (pxy *STCPProxy) InWorkConn(conn net.Conn, m *msg.StartWorkConn)

func (*STCPProxy) Run

func (pxy *STCPProxy) Run() (err error)

type SUDPProxy

type SUDPProxy struct {
	*BaseProxy
	// contains filtered or unexported fields
}

func (*SUDPProxy) Close

func (pxy *SUDPProxy) Close()

func (*SUDPProxy) InWorkConn

func (pxy *SUDPProxy) InWorkConn(conn net.Conn, m *msg.StartWorkConn)

func (*SUDPProxy) Run

func (pxy *SUDPProxy) Run() (err error)

type TCPMuxProxy

type TCPMuxProxy struct {
	*BaseProxy
	// contains filtered or unexported fields
}

TCP Multiplexer

func (*TCPMuxProxy) Close

func (pxy *TCPMuxProxy) Close()

func (*TCPMuxProxy) InWorkConn

func (pxy *TCPMuxProxy) InWorkConn(conn net.Conn, m *msg.StartWorkConn)

func (*TCPMuxProxy) Run

func (pxy *TCPMuxProxy) Run() (err error)

type TCPProxy

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

TCP

func (*TCPProxy) Close

func (pxy *TCPProxy) Close()

func (*TCPProxy) InWorkConn

func (pxy *TCPProxy) InWorkConn(conn net.Conn, m *msg.StartWorkConn)

func (*TCPProxy) Run

func (pxy *TCPProxy) Run() (err error)

type UDPProxy

type UDPProxy struct {
	*BaseProxy
	// contains filtered or unexported fields
}

UDP

func (*UDPProxy) Close

func (pxy *UDPProxy) Close()

func (*UDPProxy) InWorkConn

func (pxy *UDPProxy) InWorkConn(conn net.Conn, m *msg.StartWorkConn)

func (*UDPProxy) Run

func (pxy *UDPProxy) Run() (err error)

type WorkingStatus

type WorkingStatus struct {
	Name  string           `json:"name"`
	Type  string           `json:"type"`
	Phase string           `json:"status"`
	Err   string           `json:"err"`
	Cfg   config.ProxyConf `json:"cfg"`

	// Got from server.
	RemoteAddr string `json:"remote_addr"`
}

type Wrapper

type Wrapper struct {
	WorkingStatus
	// contains filtered or unexported fields
}

func NewWrapper

func NewWrapper(ctx context.Context, cfg config.ProxyConf, clientCfg config.ClientCommonConf, eventHandler event.Handler, serverUDPPort int) *Wrapper

func (*Wrapper) GetStatus

func (pw *Wrapper) GetStatus() *WorkingStatus

func (*Wrapper) InWorkConn

func (pw *Wrapper) InWorkConn(workConn net.Conn, m *msg.StartWorkConn)

func (*Wrapper) SetRunningStatus

func (pw *Wrapper) SetRunningStatus(remoteAddr string, respErr string) error

func (*Wrapper) Start

func (pw *Wrapper) Start()

func (*Wrapper) Stop

func (pw *Wrapper) Stop()

type XTCPProxy

type XTCPProxy struct {
	*BaseProxy
	// contains filtered or unexported fields
}

XTCP

func (*XTCPProxy) Close

func (pxy *XTCPProxy) Close()

func (*XTCPProxy) InWorkConn

func (pxy *XTCPProxy) InWorkConn(conn net.Conn, m *msg.StartWorkConn)

func (*XTCPProxy) Run

func (pxy *XTCPProxy) Run() (err error)

Jump to

Keyboard shortcuts

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