packet

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildHeader

func BuildHeader(seq uint8, id uint8) []byte

BuildHeader 建立数据包通用头部

func GetNextSeq

func GetNextSeq(seq *uint8) uint8

GetNextSeq 获取下一次的seq数据包序号

func SendPacket

func SendPacket(data []byte, client net.Conn)

SendPacket 发送数据包

Types

type InUDPmsg

type InUDPmsg struct {
	Signature uint8
	UserId    uint32
	PortId    uint16
	IpAddress uint32
	Port      uint16
	Seq       uint8

	PacketData         []byte
	Datalen            int
	CurOffset          int //可能32位
	ParsedSuccessfully bool
}

func (InUDPmsg) IsHeartbeat

func (p InUDPmsg) IsHeartbeat() bool

func (*InUDPmsg) PraseUDPpacket

func (dest *InUDPmsg) PraseUDPpacket(data []byte, len int) bool

type PacketData

type PacketData struct {
	Data      []byte
	Sequence  uint8
	Length    uint16
	Id        uint8
	CurOffset int
}

PacketData ,data part of packet

type PacketHeader

type PacketHeader struct {
	Data     []byte
	Sequence uint8
	Length   uint16
}

PacketHeader ,header of packet , 4 bytes len

Jump to

Keyboard shortcuts

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