Versions in this module Expand all Collapse all v1 v1.0.0 Jan 21, 2020 Changes in this version + type Agent interface + OnClose func() + Run func() + type Conn interface + Close func() + Destroy func() + LocalAddr func() net.Addr + ReadMsg func() ([]byte, error) + RemoteAddr func() net.Addr + WriteMsg func(args ...[]byte) error + type ConnSet map[net.Conn]struct + type MsgParser struct + func NewMsgParser() *MsgParser + func (p *MsgParser) Read(conn *TCPConn) ([]byte, error) + func (p *MsgParser) SetByteOrder(littleEndian bool) + func (p *MsgParser) SetMsgLen(lenMsgLen int, minMsgLen uint32, maxMsgLen uint32) + func (p *MsgParser) Write(conn *TCPConn, args ...[]byte) error + type Processor interface + Marshal func(msg interface{}) ([][]byte, error) + Route func(msg interface{}, userData interface{}) error + Unmarshal func(data []byte) (interface{}, error) + type TCPClient struct + Addr string + AutoReconnect bool + ConnNum int + ConnectInterval time.Duration + LenMsgLen int + LittleEndian bool + MaxMsgLen uint32 + MinMsgLen uint32 + NewAgent func(*TCPConn) Agent + PendingWriteNum int + func (client *TCPClient) Close() + func (client *TCPClient) Start() + type TCPConn struct + func (tcpConn *TCPConn) Close() + func (tcpConn *TCPConn) Destroy() + func (tcpConn *TCPConn) LocalAddr() net.Addr + func (tcpConn *TCPConn) Read(b []byte) (int, error) + func (tcpConn *TCPConn) ReadMsg() ([]byte, error) + func (tcpConn *TCPConn) RemoteAddr() net.Addr + func (tcpConn *TCPConn) Write(b []byte) + func (tcpConn *TCPConn) WriteMsg(args ...[]byte) error + type TCPServer struct + Addr string + LenMsgLen int + LittleEndian bool + MaxConnNum int + MaxMsgLen uint32 + MinMsgLen uint32 + NewAgent func(*TCPConn) Agent + PendingWriteNum int + func (server *TCPServer) Close() + func (server *TCPServer) Start() + type WSClient struct + Addr string + AutoReconnect bool + ConnNum int + ConnectInterval time.Duration + HandshakeTimeout time.Duration + MaxMsgLen uint32 + NewAgent func(*WSConn) Agent + PendingWriteNum int + func (client *WSClient) Close() + func (client *WSClient) Start() + type WSConn struct + func (wsConn *WSConn) Close() + func (wsConn *WSConn) Destroy() + func (wsConn *WSConn) LocalAddr() net.Addr + func (wsConn *WSConn) ReadMsg() ([]byte, error) + func (wsConn *WSConn) RemoteAddr() net.Addr + func (wsConn *WSConn) WriteMsg(args ...[]byte) error + type WSHandler struct + func (handler *WSHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) + type WSServer struct + Addr string + CertFile string + HTTPTimeout time.Duration + KeyFile string + MaxConnNum int + MaxMsgLen uint32 + NewAgent func(*WSConn) Agent + PendingWriteNum int + func (server *WSServer) Close() + func (server *WSServer) Start() + type WebsocketConnSet map[*websocket.Conn]struct