Documentation ¶
Index ¶
- func ParseCommands()
- type ChanMsgPack
- type CheckOriginHFunc
- type Connector
- func (c *Connector) AddExceptionHandler(handler gnError.ExceptionHandleFunc)
- func (c *Connector) AddRouterRearEndHandler(serverType string, handler RouteRearEndHFunc)
- func (c *Connector) CMDHandler(cmd string, handler gn.HandlerFunc)
- func (c *Connector) Done()
- func (c *Connector) ErrorToClient(cid string, code string, errorMsg string)
- func (c *Connector) ExceptionHandler(exception *gnError.GnException)
- func (c *Connector) GetLinker() linker.ILinker
- func (c *Connector) GetServerIdByRouter(serverType string, LogicBindId string, cid string, ...) string
- func (c *Connector) ListenAndRun() error
- func (c *Connector) LoopClientReadChan(ctx context.Context)
- func (c *Connector) LoopLinkerChan(ctx context.Context)
- func (c *Connector) Run() error
- func (c *Connector) SendPack(serverAddress, router, bindId, cid string, data []byte)
- func (c *Connector) SetCheckOriginHandler(handler CheckOriginHFunc)
- func (c *Connector) SetVerifyConnectHandler(handler VerifyClientConnectHFunc)
- type IConnection
- type IConnector
- type RouteRearEndHFunc
- type VerifyClientConnectHFunc
- type WSConnection
- func (wc *WSConnection) CloseHandler(code int, text string) error
- func (wc *WSConnection) Done()
- func (wc *WSConnection) GetBindId() string
- func (wc *WSConnection) GetConnection() interface{}
- func (wc *WSConnection) GetConnectionCid() string
- func (wc *WSConnection) ReadMsg(ctx context.Context)
- func (wc *WSConnection) Run()
- func (wc *WSConnection) SendMessage(data []byte)
- func (wc *WSConnection) SetBindId(bindId string)
- func (wc *WSConnection) WriteMsg(ctx context.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseCommands ¶
func ParseCommands()
Types ¶
type ChanMsgPack ¶
type ChanMsgPack struct {
// contains filtered or unexported fields
}
用户 接收消息 封装 channel 传输用
type CheckOriginHFunc ¶
type Connector ¶
type Connector struct { CRChan chan *ChanMsgPack CWChan chan []byte CRRoutineCan context.CancelFunc CWRoutineCan context.CancelFunc LinkerClient linker.ILinker // contains filtered or unexported fields }
func (*Connector) AddExceptionHandler ¶
func (c *Connector) AddExceptionHandler(handler gnError.ExceptionHandleFunc)
func (*Connector) AddRouterRearEndHandler ¶
func (c *Connector) AddRouterRearEndHandler(serverType string, handler RouteRearEndHFunc)
func (*Connector) CMDHandler ¶ added in v0.1.4
func (c *Connector) CMDHandler(cmd string, handler gn.HandlerFunc)
func (*Connector) ErrorToClient ¶
func (*Connector) ExceptionHandler ¶
func (c *Connector) ExceptionHandler(exception *gnError.GnException)
func (*Connector) GetServerIdByRouter ¶
func (*Connector) ListenAndRun ¶
func (*Connector) LoopClientReadChan ¶
func (*Connector) LoopLinkerChan ¶
func (*Connector) SetCheckOriginHandler ¶
func (c *Connector) SetCheckOriginHandler(handler CheckOriginHFunc)
func (*Connector) SetVerifyConnectHandler ¶
func (c *Connector) SetVerifyConnectHandler(handler VerifyClientConnectHFunc)
type IConnection ¶
type IConnection interface { SendMessage(data []byte) Run() Done() // for read or write msg WriteMsg(ctx context.Context) ReadMsg(ctx context.Context) GetConnectionCid() string GetConnection() interface{} SetBindId(bindId string) GetBindId() string }
client Connection interface
type IConnector ¶
type IConnector interface { Run() error Done() AddRouterRearEndHandler(serverType string, handler RouteRearEndHFunc) // set checkOrigin 跨域 func SetCheckOriginHandler(handler CheckOriginHFunc) // set verify Connect func SetVerifyConnectHandler(handler VerifyClientConnectHFunc) AddExceptionHandler(handler gnError.ExceptionHandleFunc) CMDHandler(cmd string, handler gn.HandlerFunc) LoopClientReadChan(ctx context.Context) LoopLinkerChan(ctx context.Context) ListenAndRun() error GetLinker() linker.ILinker SendPack(serverAddress, router, bindId, cid string, data []byte) GetServerIdByRouter(serverType string, LogicBindId string, cid string, serverList []*config.ServersConfig) string }
connector interface
func DefaultConnector ¶
func DefaultConnector(config *config.Config) (IConnector, error)
type RouteRearEndHFunc ¶
type RouteRearEndHFunc func(cid, bindId string, serverList []*config.ServersConfig) (serverId string)
type WSConnection ¶
type WSConnection struct { RChan chan []byte WChan chan *ChanMsgPack // contains filtered or unexported fields }
func NewWSConnection ¶
func NewWSConnection(conn *websocket.Conn, outChan chan *ChanMsgPack, detect *gnError.GnExceptionDetect) *WSConnection
func (*WSConnection) CloseHandler ¶
func (wc *WSConnection) CloseHandler(code int, text string) error
func (*WSConnection) Done ¶
func (wc *WSConnection) Done()
func (*WSConnection) GetBindId ¶
func (wc *WSConnection) GetBindId() string
func (*WSConnection) GetConnection ¶
func (wc *WSConnection) GetConnection() interface{}
func (*WSConnection) GetConnectionCid ¶
func (wc *WSConnection) GetConnectionCid() string
func (*WSConnection) ReadMsg ¶
func (wc *WSConnection) ReadMsg(ctx context.Context)
read Message from WS
func (*WSConnection) Run ¶
func (wc *WSConnection) Run()
func (*WSConnection) SendMessage ¶
func (wc *WSConnection) SendMessage(data []byte)
func (*WSConnection) SetBindId ¶
func (wc *WSConnection) SetBindId(bindId string)
func (*WSConnection) WriteMsg ¶
func (wc *WSConnection) WriteMsg(ctx context.Context)
send Message to WS
Click to show internal directories.
Click to hide internal directories.