packet

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: MIT Imports: 2 Imported by: 0

README

xxx

介绍
  1. xxxx
  2. xxxx
  3. xxxx
安装教程

go get github.com/jageros/hawox

使用例子
package main

import (
	"fmt"
	"github.com/jageros/hawox/xxx"
)

func main() {
	/*
	xxxxx
	xxxxx
	xxxxx
	*/
}
使用说明
  1. xxxx
  2. xxxx
  3. xxxx

Documentation

Index

Constants

View Source
const (
	SeqSize     = 4
	MsgIDSize   = 4
	MsgTypeSize = 1
	ErrcodeSize = 4
	PktSizeSize = 4
)

Variables

View Source
var (
	PingPacket = &Packet{
		msgType: MsgPing,
	}
	PongPacket = &Packet{
		msgType: MsgPong,
	}
)

Functions

func PutPacket

func PutPacket(pk *Packet)

Types

type MessageType

type MessageType = byte
const (
	MsgReq MessageType = 1 + iota // need reply
	MsgReply
	MsgPush // no reply
	MsgErr  // error reply
	MsgPing
	MsgPong
)

type Packet

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

func GetPacket

func GetPacket() *Packet

func (*Packet) GetErrcode

func (p *Packet) GetErrcode() int32

func (*Packet) GetMsgID

func (p *Packet) GetMsgID() int32

func (*Packet) GetMsgType

func (p *Packet) GetMsgType() MessageType

func (*Packet) GetPayload

func (p *Packet) GetPayload() []byte

func (*Packet) GetSeq

func (p *Packet) GetSeq() uint32

func (*Packet) Reset

func (p *Packet) Reset()

func (*Packet) SetPayload

func (p *Packet) SetPayload(payload []byte)

Jump to

Keyboard shortcuts

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