proxy

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 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 added in v1.0.0

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 added in v1.0.0

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

HTTP

func (*HTTPProxy) Close added in v1.0.0

func (pxy *HTTPProxy) Close()

func (*HTTPProxy) InWorkConn added in v1.0.0

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

func (*HTTPProxy) Run added in v1.0.0

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

type HTTPSProxy added in v1.0.0

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

HTTPS

func (*HTTPSProxy) Close added in v1.0.0

func (pxy *HTTPSProxy) Close()

func (*HTTPSProxy) InWorkConn added in v1.0.0

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

func (*HTTPSProxy) Run added in v1.0.0

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

type Manager added in v1.0.0

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

func NewManager added in v1.0.0

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

func (*Manager) Close added in v1.0.0

func (pm *Manager) Close()

func (*Manager) GetAllProxyStatus added in v1.0.0

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

func (*Manager) HandleEvent added in v1.0.0

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

func (*Manager) HandleWorkConn added in v1.0.0

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

func (*Manager) Reload added in v1.0.0

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

func (*Manager) StartProxy added in v1.0.0

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 added in v1.0.0

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

STCP

func (*STCPProxy) Close added in v1.0.0

func (pxy *STCPProxy) Close()

func (*STCPProxy) InWorkConn added in v1.0.0

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

func (*STCPProxy) Run added in v1.0.0

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

type SUDPProxy added in v1.0.0

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

func (*SUDPProxy) Close added in v1.0.0

func (pxy *SUDPProxy) Close()

func (*SUDPProxy) InWorkConn added in v1.0.0

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

func (*SUDPProxy) Run added in v1.0.0

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

type TCPMuxProxy added in v1.0.0

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

TCP Multiplexer

func (*TCPMuxProxy) Close added in v1.0.0

func (pxy *TCPMuxProxy) Close()

func (*TCPMuxProxy) InWorkConn added in v1.0.0

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

func (*TCPMuxProxy) Run added in v1.0.0

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

type TCPProxy added in v1.0.0

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

TCP

func (*TCPProxy) Close added in v1.0.0

func (pxy *TCPProxy) Close()

func (*TCPProxy) InWorkConn added in v1.0.0

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

func (*TCPProxy) Run added in v1.0.0

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

type UDPProxy added in v1.0.0

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

UDP

func (*UDPProxy) Close added in v1.0.0

func (pxy *UDPProxy) Close()

func (*UDPProxy) InWorkConn added in v1.0.0

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

func (*UDPProxy) Run added in v1.0.0

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

type WorkingStatus added in v1.0.0

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 added in v1.0.0

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

func NewWrapper added in v1.0.0

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

func (*Wrapper) GetStatus added in v1.0.0

func (pw *Wrapper) GetStatus() *WorkingStatus

func (*Wrapper) InWorkConn added in v1.0.0

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

func (*Wrapper) SetRunningStatus added in v1.0.0

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

func (*Wrapper) Start added in v1.0.0

func (pw *Wrapper) Start()

func (*Wrapper) Stop added in v1.0.0

func (pw *Wrapper) Stop()

type XTCPProxy added in v1.0.0

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

XTCP

func (*XTCPProxy) Close added in v1.0.0

func (pxy *XTCPProxy) Close()

func (*XTCPProxy) InWorkConn added in v1.0.0

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

func (*XTCPProxy) Run added in v1.0.0

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

Jump to

Keyboard shortcuts

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