pkg

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TYPE_NULL          = iota
	TYPE_HANDSHAKE     //1
	TYPE_HANDSHAKE_ACK //2
	TYPE_HEARTBEAT     //3
	TYPE_DATA          //4
	TYPE_KICK          //5

	PKG_HEAD_BYTES = 4
)

Variables

This section is empty.

Functions

func Decode

func Decode(buffer []byte) (pkgType int, body []byte)

*

  • Package protocol decode.
  • See encode for package format.

func Encode

func Encode(pkgType int, body []byte) *[]byte

*

  • Package protocol encode. *
  • Pomelo package format:
  • +------+-------------+------------------+
  • | type | body length | body |
  • +------+-------------+------------------+ *
  • Head: 4bytes
  • 0: package type,
  • 1 - handshake,
  • 2 - handshake ack,
  • 3 - heartbeat,
  • 4 - data
  • 5 - kick
  • 1 - 3: big-endian body length
  • Body: body length bytes

Types

This section is empty.

Jump to

Keyboard shortcuts

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