Versions in this module Expand all Collapse all v0 v0.0.1 Aug 28, 2023 Changes in this version + type Agent interface + OnClose func() + Run func() + type Conn interface + Close func() + LocalAddr func() net.Addr + Read func(buffer []byte) (int, error) + ReadMsg func(buf *bytes.Buffer) error + RemoteAddr func() net.Addr + WriteMessage func(buf []byte) error + type ConnSet map[net.Conn]struct + type MsgParser struct + func NewMsgParser() *MsgParser + func (p *MsgParser) Read(conn *TCPConn) (uint32, []byte, error) + func (p *MsgParser) SetByteOrder(littleEndian bool) + func (p *MsgParser) SetMsgLen(lenMsgLen int, minMsgLen uint32, maxMsgLen uint32) + func (p *MsgParser) Write(conn *TCPConn, respId uint32, data []byte) error + type TCPClient struct + Addr string + AutoReconnect bool + ConnNum int + ConnectInterval time.Duration + LenMsgLen int + LittleEndian bool + MaxMsgLen uint32 + MinMsgLen uint32 + MsgParser *MsgParser + NewAgent func(*TCPConn) Agent + func (client *TCPClient) Close() + func (client *TCPClient) Start() + type TCPConn struct + func (tcpConn *TCPConn) Close() + func (tcpConn *TCPConn) LocalAddr() net.Addr + func (tcpConn *TCPConn) Read(buffer []byte) (int, error) + func (tcpConn *TCPConn) ReadMsg(buf *bytes.Buffer) error + func (tcpConn *TCPConn) RemoteAddr() net.Addr + func (tcpConn *TCPConn) WriteMessage(buf []byte) error + type TCPServer struct + Addr string + MaxConnNum int + NewAgent func(*TCPConn) Agent + 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) LocalAddr() net.Addr + func (wsConn *WSConn) Read(buffer []byte) (int, error) + func (wsConn *WSConn) ReadMsg(buf *bytes.Buffer) error + func (wsConn *WSConn) RemoteAddr() net.Addr + func (wsConn *WSConn) WriteMessage(buf []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 + func (server *WSServer) Close() + func (server *WSServer) Start() + type WebsocketConnSet map[*websocket.Conn]struct