Versions in this module Expand all Collapse all v0 v0.0.3 May 19, 2023 Changes in this version + const HANDLE + const HANDLE_OVER + const POST_HANDLE + const PRE_HANDLE + const StackBegin + const StackEnd + const WorkerIDWithoutWorkerPool + var AcceptDelay *acceptDelay + func HeatBeatDefaultHandle(req iface.IRequest) + func NewClient(ip string, port int, opts ...ClientOption) iface.IClient + func NewDefaultRouterSlicesServer(opts ...Option) iface.IServer + func NewFuncRequest(conn iface.IConnection, callFunc func()) iface.IRequest + func NewHeartbeatChecker(interval time.Duration) iface.IHeartbeatChecker + func NewRequest(conn iface.IConnection, msg iface.IMessage) iface.IRequest + func NewServer(opts ...Option) iface.IServer + func NewTLSClient(ip string, port int, opts ...ClientOption) iface.IClient + func NewUserConfDefaultRouterSlicesServer(config *conf.Config, opts ...Option) iface.IServer + func NewUserConfServer(config *conf.Config, opts ...Option) iface.IServer + func NewWsClient(ip string, port int, opts ...ClientOption) iface.IClient + func RouterRecovery(request iface.IRequest) + func RouterTime(request iface.IRequest) + type BaseRouter struct + func (br *BaseRouter) Handle(req iface.IRequest) + func (br *BaseRouter) PostHandle(req iface.IRequest) + func (br *BaseRouter) PreHandle(req iface.IRequest) + type Client struct + ErrChan chan error + Ip string + Name string + Port int + func (c *Client) AddInterceptor(interceptor iface.IInterceptor) + func (c *Client) AddRouter(msgID uint32, router iface.IRouter) + func (c *Client) Conn() iface.IConnection + func (c *Client) GetErrChan() chan error + func (c *Client) GetLengthField() *iface.LengthField + func (c *Client) GetMsgHandler() iface.IMsgHandle + func (c *Client) GetName() string + func (c *Client) GetOnConnStart() func(iface.IConnection) + func (c *Client) GetOnConnStop() func(iface.IConnection) + func (c *Client) GetPacket() iface.IDataPack + func (c *Client) Restart() + func (c *Client) SetDecoder(decoder iface.IDecoder) + func (c *Client) SetName(name string) + func (c *Client) SetOnConnStart(hookFunc func(iface.IConnection)) + func (c *Client) SetOnConnStop(hookFunc func(iface.IConnection)) + func (c *Client) SetPacket(packet iface.IDataPack) + func (c *Client) Start() + func (c *Client) StartHeartBeat(interval time.Duration) + func (c *Client) StartHeartBeatWithOption(interval time.Duration, option *iface.HeartBeatOption) + func (c *Client) Stop() + type ClientOption func(c iface.IClient) + func WithNameClient(name string) ClientOption + func WithPacketClient(pack iface.IDataPack) ClientOption + type ConnManager struct + func (connMgr *ConnManager) Add(conn iface.IConnection) + func (connMgr *ConnManager) ClearConn() + func (connMgr *ConnManager) Get(connID uint64) (iface.IConnection, error) + func (connMgr *ConnManager) GetAllConnID() []uint64 + func (connMgr *ConnManager) Len() int + func (connMgr *ConnManager) Range(cb func(uint64, iface.IConnection, interface{}) error, args interface{}) (err error) + func (connMgr *ConnManager) Remove(conn iface.IConnection) + type Connection struct + func (c *Connection) Context() context.Context + func (c *Connection) GetConnID() uint64 + func (c *Connection) GetConnection() net.Conn + func (c *Connection) GetMsgHandler() iface.IMsgHandle + func (c *Connection) GetName() string + func (c *Connection) GetProperty(key string) (interface{}, error) + func (c *Connection) GetTCPConnection() net.Conn + func (c *Connection) GetWsConn() *websocket.Conn + func (c *Connection) IsAlive() bool + func (c *Connection) LocalAddr() net.Addr + func (c *Connection) LocalAddrString() string + func (c *Connection) RemoteAddr() net.Addr + func (c *Connection) RemoteAddrString() string + func (c *Connection) RemoveProperty(key string) + func (c *Connection) Send(data []byte) error + func (c *Connection) SendBuffMsg(msgID uint32, data []byte) error + func (c *Connection) SendMsg(msgID uint32, data []byte) error + func (c *Connection) SendToQueue(data []byte) error + func (c *Connection) SetHeartBeat(checker iface.IHeartbeatChecker) + func (c *Connection) SetProperty(key string, value interface{}) + func (c *Connection) Start() + func (c *Connection) StartReader() + func (c *Connection) StartWriter() + func (c *Connection) Stop() + type GroupRouter struct + Handlers []iface.RouterHandler + func NewGroup(start, end uint32, router *RouterSlices, Handlers ...iface.RouterHandler) *GroupRouter + func (g *GroupRouter) AddHandler(MsgId uint32, Handlers ...iface.RouterHandler) + func (g *GroupRouter) Use(Handlers ...iface.RouterHandler) + type HeartbeatChecker struct + func (h *HeartbeatChecker) BindConn(conn iface.IConnection) + func (h *HeartbeatChecker) BindRouter(msgID uint32, router iface.IRouter) + func (h *HeartbeatChecker) BindRouterSlices(msgID uint32, handlers ...iface.RouterHandler) + func (h *HeartbeatChecker) Clone() iface.IHeartbeatChecker + func (h *HeartbeatChecker) MsgID() uint32 + func (h *HeartbeatChecker) Router() iface.IRouter + func (h *HeartbeatChecker) RouterSlices() []iface.RouterHandler + func (h *HeartbeatChecker) SendHeartBeatMsg() error + func (h *HeartbeatChecker) SetHeartbeatFunc(beatFunc iface.HeartBeatFunc) + func (h *HeartbeatChecker) SetHeartbeatMsgFunc(f iface.HeartBeatMsgFunc) + func (h *HeartbeatChecker) SetOnRemoteNotAlive(f iface.OnRemoteNotAlive) + func (h *HeartbeatChecker) Start() + func (h *HeartbeatChecker) Stop() + type HeatBeatDefaultRouter struct + func (r *HeatBeatDefaultRouter) Handle(req iface.IRequest) + type MsgHandle struct + Apis map[uint32]iface.IRouter + RouterSlices *RouterSlices + TaskQueue []chan iface.IRequest + WorkerPoolSize uint32 + func (mh *MsgHandle) AddInterceptor(interceptor iface.IInterceptor) + func (mh *MsgHandle) AddRouter(msgID uint32, router iface.IRouter) + func (mh *MsgHandle) AddRouterSlices(msgId uint32, handler ...iface.RouterHandler) iface.IRouterSlices + func (mh *MsgHandle) Execute(request iface.IRequest) + func (mh *MsgHandle) GetTaskQueueWorkerId(request iface.IRequest) uint64 + func (mh *MsgHandle) Group(start, end uint32, Handlers ...iface.RouterHandler) iface.IGroupRouterSlices + func (mh *MsgHandle) Intercept(chain iface.IChain) iface.IcResp + func (mh *MsgHandle) SendMsgToTaskQueue(request iface.IRequest) + func (mh *MsgHandle) StartOneWorker(workerID int, taskQueue chan iface.IRequest) + func (mh *MsgHandle) StartWorkerPool() + func (mh *MsgHandle) Use(Handlers ...iface.RouterHandler) iface.IRouterSlices + type Option func(s *Server) + func WithPacket(pack iface.IDataPack) Option + type Request struct + func (r *Request) Abort() + func (r *Request) BindRouter(router iface.IRouter) + func (r *Request) BindRouterSlices(handlers []iface.RouterHandler) + func (r *Request) Call() + func (r *Request) GetConnection() iface.IConnection + func (r *Request) GetData() []byte + func (r *Request) GetMessage() iface.IMessage + func (r *Request) GetMsgID() uint32 + func (r *Request) GetResponse() iface.IcResp + func (r *Request) Goto(step iface.HandleStep) + func (r *Request) RouterSlicesNext() + func (r *Request) SetResponse(response iface.IcResp) + type RequestFunc struct + func (rf *RequestFunc) CallFunc() + func (rf *RequestFunc) GetConnection() iface.IConnection + type RouterSlices struct + Apis map[uint32][]iface.RouterHandler + Handlers []iface.RouterHandler + func NewRouterSlices() *RouterSlices + func (r *RouterSlices) AddHandler(msgId uint32, Handlers ...iface.RouterHandler) + func (r *RouterSlices) GetHandlers(MsgId uint32) ([]iface.RouterHandler, bool) + func (r *RouterSlices) Group(start, end uint32, Handlers ...iface.RouterHandler) iface.IGroupRouterSlices + func (r *RouterSlices) Use(handles ...iface.RouterHandler) + type Server struct + ConnMgr iface.IConnManager + IP string + IPVersion string + Name string + Port int + RouterSlicesMode bool + WsPort int + func (s *Server) AddInterceptor(interceptor iface.IInterceptor) + func (s *Server) AddRouter(msgID uint32, router iface.IRouter) + func (s *Server) AddRouterSlices(msgID uint32, router ...iface.RouterHandler) iface.IRouterSlices + func (s *Server) GetConnMgr() iface.IConnManager + func (s *Server) GetHeartBeat() iface.IHeartbeatChecker + func (s *Server) GetLengthField() *iface.LengthField + func (s *Server) GetMsgHandler() iface.IMsgHandle + func (s *Server) GetOnConnStart() func(iface.IConnection) + func (s *Server) GetOnConnStop() func(iface.IConnection) + func (s *Server) GetPacket() iface.IDataPack + func (s *Server) Group(start, end uint32, Handlers ...iface.RouterHandler) iface.IGroupRouterSlices + func (s *Server) ListenTcpConn() error + func (s *Server) ListenWebsocketConn() error + func (s *Server) Serve() + func (s *Server) ServerName() string + func (s *Server) SetDecoder(decoder iface.IDecoder) + func (s *Server) SetOnConnStart(hookFunc func(iface.IConnection)) + func (s *Server) SetOnConnStop(hookFunc func(iface.IConnection)) + func (s *Server) SetPacket(packet iface.IDataPack) + func (s *Server) SetWebsocketAuth(f func(r *http.Request) error) + func (s *Server) Start(_ context.Context) error + func (s *Server) StartConn(conn iface.IConnection) + func (s *Server) StartHeartBeat(interval time.Duration) + func (s *Server) StartHeartBeatWithOption(interval time.Duration, option *iface.HeartBeatOption) + func (s *Server) Stop(ctx context.Context) error + func (s *Server) Use(Handlers ...iface.RouterHandler) iface.IRouterSlices + type WsConnection struct + func (c *WsConnection) Context() context.Context + func (c *WsConnection) GetConnID() uint64 + func (c *WsConnection) GetConnection() net.Conn + func (c *WsConnection) GetMsgHandler() iface.IMsgHandle + func (c *WsConnection) GetName() string + func (c *WsConnection) GetProperty(key string) (interface{}, error) + func (c *WsConnection) GetTCPConnection() net.Conn + func (c *WsConnection) GetWsConn() *websocket.Conn + func (c *WsConnection) IsAlive() bool + func (c *WsConnection) LocalAddr() net.Addr + func (c *WsConnection) LocalAddrString() string + func (c *WsConnection) RemoteAddr() net.Addr + func (c *WsConnection) RemoteAddrString() string + func (c *WsConnection) RemoveProperty(key string) + func (c *WsConnection) Send(data []byte) error + func (c *WsConnection) SendBuffMsg(msgID uint32, data []byte) error + func (c *WsConnection) SendMsg(msgID uint32, data []byte) error + func (c *WsConnection) SendToQueue(data []byte) error + func (c *WsConnection) SetHeartBeat(checker iface.IHeartbeatChecker) + func (c *WsConnection) SetProperty(key string, value interface{}) + func (c *WsConnection) Start() + func (c *WsConnection) StartReader() + func (c *WsConnection) StartWriter() + func (c *WsConnection) Stop()