packet

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Handshake    = 0x01
	HandshakeAck = 0x02
	Heartbeat    = 0x03
	Data         = 0x04
	Kick         = 0x05
)

*

  • ==========================
  • Packet
  • ========================== *
  • Handshake 01 - Client-to-server handshake request and server-to-client handshake response
  • HandshakeAck 02 - Client to server handshake ack
  • Heartbeat 03 - Heartbeat packet
  • Data 04 - Data packet
  • Kick 05 - Server active disconnect notification *

Variables

View Source
var (
	ErrWrongPacketType = errors.New("wrong packet type")
)

*

  • ==========================
  • Packet
  • ========================== *
  • ErrWrongPacketType Packet *

Functions

This section is empty.

Types

type Packet

type Packet struct {
	Type   byte //
	Length int  // body Content length, a big-endian integer of 3 bytes, so the maximum packet length is 2^24 bytes。
	Data   []byte
}

Packet --

func New

func New() *Packet

New --

func (*Packet) String

func (p *Packet) String() string

String --

Jump to

Keyboard shortcuts

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