Documentation ¶
Index ¶
- Constants
- func RegisterProxyFactory(proxyConfType reflect.Type, factory func(*BaseProxy, v1.ProxyConfigurer) Proxy)
- type BaseProxy
- func (pxy *BaseProxy) Close()
- func (pxy *BaseProxy) HandleTCPWorkConnection(workConn net.Conn, m *msg.StartWorkConn, encKey []byte)
- func (pxy *BaseProxy) InWorkConn(conn net.Conn, m *msg.StartWorkConn)
- func (pxy *BaseProxy) Run() error
- func (pxy *BaseProxy) SetInWorkConnCallback(cb func(*v1.ProxyBaseConfig, net.Conn, *msg.StartWorkConn) bool)
- type GeneralTCPProxy
- type Manager
- func (pm *Manager) Close()
- func (pm *Manager) GetAllProxyStatus() []*WorkingStatus
- func (pm *Manager) GetProxyStatus(name string) (*WorkingStatus, bool)
- func (pm *Manager) HandleEvent(payload interface{}) error
- func (pm *Manager) HandleWorkConn(name string, workConn net.Conn, m *msg.StartWorkConn)
- func (pm *Manager) SetInWorkConnCallback(cb func(*v1.ProxyBaseConfig, net.Conn, *msg.StartWorkConn) bool)
- func (pm *Manager) StartProxy(name string, remoteAddr string, serverRespErr string) error
- func (pm *Manager) UpdateAll(proxyCfgs []v1.ProxyConfigurer)
- type Proxy
- func NewGeneralTCPProxy(baseProxy *BaseProxy, _ v1.ProxyConfigurer) Proxy
- func NewProxy(ctx context.Context, pxyConf v1.ProxyConfigurer, ...) (pxy Proxy)
- func NewSUDPProxy(baseProxy *BaseProxy, cfg v1.ProxyConfigurer) Proxy
- func NewUDPProxy(baseProxy *BaseProxy, cfg v1.ProxyConfigurer) Proxy
- func NewXTCPProxy(baseProxy *BaseProxy, cfg v1.ProxyConfigurer) Proxy
- type SUDPProxy
- type UDPProxy
- type WorkingStatus
- type Wrapper
- func (pw *Wrapper) GetStatus() *WorkingStatus
- func (pw *Wrapper) InWorkConn(workConn net.Conn, m *msg.StartWorkConn)
- func (pw *Wrapper) SetInWorkConnCallback(cb func(*v1.ProxyBaseConfig, net.Conn, *msg.StartWorkConn) bool)
- func (pw *Wrapper) SetRunningStatus(remoteAddr string, respErr string) error
- func (pw *Wrapper) Start()
- func (pw *Wrapper) Stop()
- type XTCPProxy
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 RegisterProxyFactory ¶
Types ¶
type BaseProxy ¶
type BaseProxy struct {
// contains filtered or unexported fields
}
func (*BaseProxy) HandleTCPWorkConnection ¶
func (pxy *BaseProxy) HandleTCPWorkConnection(workConn net.Conn, m *msg.StartWorkConn, encKey []byte)
Common handler for tcp work connections.
func (*BaseProxy) InWorkConn ¶
func (pxy *BaseProxy) InWorkConn(conn net.Conn, m *msg.StartWorkConn)
func (*BaseProxy) SetInWorkConnCallback ¶
func (pxy *BaseProxy) SetInWorkConnCallback(cb func(*v1.ProxyBaseConfig, net.Conn, *msg.StartWorkConn) bool)
type GeneralTCPProxy ¶
type GeneralTCPProxy struct {
*BaseProxy
}
GeneralTCPProxy is a general implementation of Proxy interface for TCP protocol. If the default GeneralTCPProxy cannot meet the requirements, you can customize the implementation of the Proxy interface.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager( ctx context.Context, clientCfg *v1.ClientCommonConfig, msgTransporter transport.MessageTransporter, ) *Manager
func (*Manager) GetAllProxyStatus ¶
func (pm *Manager) GetAllProxyStatus() []*WorkingStatus
func (*Manager) GetProxyStatus ¶
func (pm *Manager) GetProxyStatus(name string) (*WorkingStatus, bool)
func (*Manager) HandleEvent ¶
func (*Manager) HandleWorkConn ¶
func (*Manager) SetInWorkConnCallback ¶
func (pm *Manager) SetInWorkConnCallback(cb func(*v1.ProxyBaseConfig, net.Conn, *msg.StartWorkConn) bool)
func (*Manager) StartProxy ¶
func (*Manager) UpdateAll ¶
func (pm *Manager) UpdateAll(proxyCfgs []v1.ProxyConfigurer)
type Proxy ¶
type Proxy interface { Run() error // InWorkConn accept work connections registered to server. InWorkConn(net.Conn, *msg.StartWorkConn) SetInWorkConnCallback(func(*v1.ProxyBaseConfig, net.Conn, *msg.StartWorkConn) bool) Close() }
Proxy defines how to handle work connections for different proxy type.
func NewGeneralTCPProxy ¶
func NewGeneralTCPProxy(baseProxy *BaseProxy, _ v1.ProxyConfigurer) Proxy
func NewProxy ¶
func NewProxy( ctx context.Context, pxyConf v1.ProxyConfigurer, clientCfg *v1.ClientCommonConfig, msgTransporter transport.MessageTransporter, ) (pxy Proxy)
func NewSUDPProxy ¶
func NewSUDPProxy(baseProxy *BaseProxy, cfg v1.ProxyConfigurer) Proxy
func NewUDPProxy ¶
func NewUDPProxy(baseProxy *BaseProxy, cfg v1.ProxyConfigurer) Proxy
func NewXTCPProxy ¶
func NewXTCPProxy(baseProxy *BaseProxy, cfg v1.ProxyConfigurer) Proxy
type SUDPProxy ¶
type SUDPProxy struct { *BaseProxy // contains filtered or unexported fields }
func (*SUDPProxy) InWorkConn ¶
func (pxy *SUDPProxy) InWorkConn(conn net.Conn, _ *msg.StartWorkConn)
type UDPProxy ¶
type UDPProxy struct { *BaseProxy // contains filtered or unexported fields }
func (*UDPProxy) InWorkConn ¶
func (pxy *UDPProxy) InWorkConn(conn net.Conn, _ *msg.StartWorkConn)
type WorkingStatus ¶
type Wrapper ¶
type Wrapper struct { WorkingStatus // contains filtered or unexported fields }
func NewWrapper ¶
func NewWrapper( ctx context.Context, cfg v1.ProxyConfigurer, clientCfg *v1.ClientCommonConfig, eventHandler event.Handler, msgTransporter transport.MessageTransporter, ) *Wrapper
func (*Wrapper) GetStatus ¶
func (pw *Wrapper) GetStatus() *WorkingStatus
func (*Wrapper) InWorkConn ¶
func (pw *Wrapper) InWorkConn(workConn net.Conn, m *msg.StartWorkConn)
func (*Wrapper) SetInWorkConnCallback ¶
func (pw *Wrapper) SetInWorkConnCallback(cb func(*v1.ProxyBaseConfig, net.Conn, *msg.StartWorkConn) bool)
func (*Wrapper) SetRunningStatus ¶
type XTCPProxy ¶
type XTCPProxy struct { *BaseProxy // contains filtered or unexported fields }
func (*XTCPProxy) InWorkConn ¶
func (pxy *XTCPProxy) InWorkConn(conn net.Conn, startWorkConnMsg *msg.StartWorkConn)
Click to show internal directories.
Click to hide internal directories.