Documentation ¶
Index ¶
- Variables
- func GetProtobufPayload(data []byte) (uint16, proto.Message, error)
- func ParseProtobuf(msgName protoreflect.FullName, data []byte) (proto.Message, error)
- func PutProtobufPayload(msgID uint16, msg proto.Message) ([]byte, error)
- func RegisterPayload(msgID uint16, msgName protoreflect.FullName) error
- type Cipher
- type DefTcpProcessor
- type HandleFunc
- type MsgHander
- type MsgParser
- type PingPongFunc
- type Rc4Cipher
- type Session
- func (slf *Session) Close()
- func (slf *Session) GetActiveTime() int64
- func (slf *Session) GetID() uint32
- func (slf *Session) LocalAddr() net.Addr
- func (slf *Session) RemoteAddr() net.Addr
- func (slf *Session) SetCipher(recv, send Cipher)
- func (slf *Session) SetPingPong(pingpong PingPongFunc, interval uint32)
- func (slf *Session) SetWritable(bWrite bool)
- func (slf *Session) Start()
- func (slf *Session) SyncWriteMsg(msg []byte) error
- func (slf *Session) WriteMsg(msg []byte) error
- type TCPClient
- type TcpProcessor
Constants ¶
This section is empty.
Variables ¶
View Source
var ( TCP_TIMEOUT = 20 MaxMsgLen = uint16(10 * 1024) MinMsgLen = uint16(2) )
Functions ¶
func ParseProtobuf ¶
func RegisterPayload ¶
func RegisterPayload(msgID uint16, msgName protoreflect.FullName) error
Types ¶
type DefTcpProcessor ¶
func (*DefTcpProcessor) HandleRecvMsg ¶
func (slf *DefTcpProcessor) HandleRecvMsg(session *Session, msgData []byte)
func (*DefTcpProcessor) RegisterMsg ¶
func (slf *DefTcpProcessor) RegisterMsg(msgID uint16, name protoreflect.FullName, handle HandleFunc)
type HandleFunc ¶
type MsgParser ¶
type MsgParser struct {
// contains filtered or unexported fields
}
func NewMsgParser ¶
type PingPongFunc ¶
type PingPongFunc func(session *Session)
type Rc4Cipher ¶
type Rc4Cipher struct {
// contains filtered or unexported fields
}
func NewRc4Cipher ¶
type Session ¶
func (*Session) GetActiveTime ¶
func (*Session) RemoteAddr ¶
func (*Session) SetPingPong ¶
func (slf *Session) SetPingPong(pingpong PingPongFunc, interval uint32)
func (*Session) SetWritable ¶
func (*Session) SyncWriteMsg ¶
Click to show internal directories.
Click to hide internal directories.