Documentation
¶
Index ¶
- type Agent
- type Conn
- type ConnSet
- type MsgParser
- type Processor
- type TCPClient
- type TCPConn
- 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
- type WSClient
- type WSConn
- type WSHandler
- type WSServer
- type WebsocketConnSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn interface {
ReadMsg() ([]byte, error)
WriteMsg(args ...[]byte) error
LocalAddr() net.Addr
RemoteAddr() net.Addr
Close()
Destroy()
}
Conn .
type MsgParser ¶
type MsgParser struct {
// contains filtered or unexported fields
}
MsgParser . -------------- | len | data | --------------
func (*MsgParser) SetByteOrder ¶
SetByteOrder . It's dangerous to call the method on reading or writing
type Processor ¶
type Processor interface {
// must goroutine safe
Route(msg interface{}, userData interface{}) error
// must goroutine safe
Unmarshal(data []byte) (interface{}, error)
// must goroutine safe
Marshal(msg interface{}) ([][]byte, error)
}
Processor .
type TCPClient ¶
type TCPClient struct {
sync.Mutex
Addr string
ConnNum int
ConnectInterval time.Duration
PendingWriteNum int
AutoReconnect bool
NewAgent func(*TCPConn) Agent
// msg parser
LenMsgLen int
MinMsgLen uint32
MaxMsgLen uint32
LittleEndian bool
// contains filtered or unexported fields
}
TCPClient .
type TCPServer ¶
type TCPServer struct {
Addr string
MaxConnNum int
PendingWriteNum int
NewAgent func(*TCPConn) Agent
// msg parser
LenMsgLen int
MinMsgLen uint32
MaxMsgLen uint32
LittleEndian bool
// contains filtered or unexported fields
}
TCPServer .
type WSClient ¶
type WSClient struct {
sync.Mutex
Addr string
ConnNum int
ConnectInterval time.Duration
PendingWriteNum int
MaxMsgLen uint32
HandshakeTimeout time.Duration
AutoReconnect bool
NewAgent func(*WSConn) Agent
// contains filtered or unexported fields
}
WSClient .
Source Files
¶
Click to show internal directories.
Click to hide internal directories.