proxy

package
v0.32.3 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2020 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProxyStatusNew         = "new"
	ProxyStatusWaitStart   = "wait start"
	ProxyStatusStartErr    = "start error"
	ProxyStatusRunning     = "running"
	ProxyStatusCheckFailed = "check failed"
	ProxyStatusClosed      = "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 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 ProxyManager

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

func NewProxyManager

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

func (*ProxyManager) Close

func (pm *ProxyManager) Close()

func (*ProxyManager) GetAllProxyStatus

func (pm *ProxyManager) GetAllProxyStatus() []*ProxyStatus

func (*ProxyManager) HandleEvent

func (pm *ProxyManager) HandleEvent(evType event.EventType, payload interface{}) error

func (*ProxyManager) HandleWorkConn

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

func (*ProxyManager) Reload

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

func (*ProxyManager) StartProxy

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

type ProxyStatus

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

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

type ProxyWrapper

type ProxyWrapper struct {
	ProxyStatus
	// contains filtered or unexported fields
}

func NewProxyWrapper

func NewProxyWrapper(ctx context.Context, cfg config.ProxyConf, clientCfg config.ClientCommonConf, eventHandler event.EventHandler, serverUDPPort int) *ProxyWrapper

func (*ProxyWrapper) GetStatus

func (pw *ProxyWrapper) GetStatus() *ProxyStatus

func (*ProxyWrapper) InWorkConn

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

func (*ProxyWrapper) SetRunningStatus

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

func (*ProxyWrapper) Start

func (pw *ProxyWrapper) Start()

func (*ProxyWrapper) Stop

func (pw *ProxyWrapper) Stop()

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 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 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