alg

package
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PacketMaxLen = 343 * 1024 // 最大应用层包长度
)

Variables

This section is empty.

Functions

func DecodeBinToPayload

func DecodeBinToPayload(data []byte, kcpMsgList *[]*PackMsg, xorKey []byte)

func DecodeLoop

func DecodeLoop(data []byte, kcpMsgList *[]*PackMsg)

func DecodePayloadToProto

func DecodePayloadToProto(msg *PackMsg) (protoObj pb.Message)

func EncodePayloadToBin

func EncodePayloadToBin(kcpMsg *PackMsg, xorKey []byte) (bin []byte)

func GetAppId

func GetAppId() string

func GetEc2b

func GetEc2b() *random.Ec2b

Types

type PackMsg

type PackMsg struct {
	CmdId     uint16
	HeadData  []byte
	ProtoData []byte
}

func EncodeProtoToPayload

func EncodeProtoToPayload(protoMsg *ProtoMsg) (serviceMsg *PackMsg)

type ProtoMsg

type ProtoMsg struct {
	CmdId          uint16
	PayloadMessage pb.Message
}

type SnowflakeWorker

type SnowflakeWorker struct {
	// contains filtered or unexported fields
}

func NewSnowflakeWorker

func NewSnowflakeWorker(workerId int64) *SnowflakeWorker

func (*SnowflakeWorker) GenId

func (s *SnowflakeWorker) GenId() int64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL