Versions in this module Expand all Collapse all v1 v1.0.5 Apr 24, 2024 v1.0.3 Apr 24, 2024 Changes in this version + func CopyMemory(src, dst []byte) int + func GetLengthDataLen(avLen uint32) uint32 + func GetValueDataPtr(v *reflect.Value) uintptr + func Move(src, dst uintptr, size uint32) + func ReadLength(bits []byte) (lengthValue uint32, readLen uint32) + func ReadString(bits []byte) (str string, readLen uint32) + func WiriteLength(bits []byte, aLength uint32) (wirteLen uint32) + func WriteString(bits []byte, str string) (writeLen uint32) + type BufferUtils struct + func NewBufferUtils(buff []byte) *BufferUtils + func (bw *BufferUtils) GetDataLen() int + func (bw *BufferUtils) GetPos() int + func (bw *BufferUtils) GetRemainBuff() []byte + func (bw *BufferUtils) GetRemainLen() int + func (bw *BufferUtils) ReadBuffer(buff []byte) (v int) + func (bw *BufferUtils) ReadUint16() (v uint16) + func (bw *BufferUtils) ReadUint32() (v uint32) + func (bw *BufferUtils) ReadUint64() (v uint64) + func (bw *BufferUtils) ReadUint8() (v uint8) + func (bw *BufferUtils) Reset(buff []byte) + func (bw *BufferUtils) ResetBuffSize(size int) + func (bw *BufferUtils) ResetPos(newPos int) (r bool) + func (bw *BufferUtils) Seek(offset int) bool + func (bw *BufferUtils) Write(a any) bool + type DefaultHeadHandler struct + func NewDefaultHeadHandler(creater IHeaderCreator) *DefaultHeadHandler + func (d *DefaultHeadHandler) ReadPack(reader io.Reader, conn SocketConnection) (pack *PackData) + func (d *DefaultHeadHandler) WritePack(writer io.Writer, datas []byte) bool + type DefaultMsgHead struct + Cmd uint32 + func (d *DefaultMsgHead) CreateMsgHeader() IMsgHeader + func (d *DefaultMsgHead) GetHeaderSize() int + func (d *DefaultMsgHead) ReadHeader(br *BufferUtils) (isOk bool, bodyLen int) + func (d *DefaultMsgHead) WriteHeader(bw *BufferUtils, bodyLen int) bool + type FastLocker struct + func (l *FastLocker) Lock() + func (l *FastLocker) Unlock() + type HashIdType = int32 + type IHeaderCreator interface + CreateMsgHeader func() IMsgHeader + type IMsgHandler interface + OnConnect func(sock SocketConnection) + OnDisconnect func(sock SocketConnection) + OnMessage func(sock SocketConnection, msg *PackData) + type IMsgHeader interface + GetHeaderSize func() int + ReadHeader func(br *BufferUtils) (isOk bool, bodyLen int) + WriteHeader func(bw *BufferUtils, bodyLen int) bool + type IPackHeader interface + ReadPack func(reader io.Reader, conn SocketConnection) (pack *PackData) + WritePack func(writer io.Writer, datas []byte) bool + type MsgBody struct + Datas []byte + MsgHead interface{} + type PByteArray (*[cMaxArrSize]byte) + type PStrArray (*[cMaxArrSize]string) + type PackData struct + Body []byte + Head interface{} + type Serializer struct + func New(isLikeCStruct bool, hashTblSize int) *Serializer + func (s *Serializer) Decode(bits []byte, ptr interface{}) bool + func (s *Serializer) DecodeStruct(id HashIdType, bits []byte) (obj interface{}, isOk bool) + func (s *Serializer) Encode(ptr interface{}) (result []byte, ok bool) + func (s *Serializer) NewStruct(id HashIdType) interface{} + func (s *Serializer) RegisterType(id HashIdType, obj interface{}) bool + type SockOptions struct + HeadHandler IPackHeader + MsgHandler IMsgHandler + type SocketClient interface + Close func() + Connected func() bool + GetConnection func() SocketConnection + Open func() + func NewSocketClient(addr string, avOpts SockOptions) SocketClient + type SocketConnection interface + Disconnect func() + GetData func() interface{} + GetId func() int32 + RemoteAddr func() net.Addr + SendData func(avDatas []byte) bool + SendRawData func(data []byte) bool + SetData func(usrData interface{}) + type SocketServer interface + Close func() + Foreach func(f enum_callback) + GetConnectCount func() int32 + Open func(avPort uint16) bool + SendData func(SockId int32, Data []byte) bool + SendRawData func(SockId int32, avBytes []byte) bool + func NewSocketServer(avOpts SockOptions) SocketServer