packet

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PACKET_LIMIT = 65535
	PACKET_POOL  = 10000
)

Variables

This section is empty.

Functions

func Pack

func Pack(tos int16, tbl interface{}, writer *Packet) []byte

----------------------------------------------- export struct fields with packet writer.

Types

type FastPack

type FastPack interface {
	Pack(w *Packet)
}

type Packet

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

func Reader

func Reader(data []byte) *Packet

func Writer

func Writer() *Packet

func (*Packet) Data

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

func (*Packet) Length

func (p *Packet) Length() int

func (*Packet) ReadBool

func (p *Packet) ReadBool() (ret bool, err error)

=============================================== Readers

func (*Packet) ReadByte

func (p *Packet) ReadByte() (ret byte, err error)

func (*Packet) ReadBytes

func (p *Packet) ReadBytes() (ret []byte, err error)

func (*Packet) ReadFloat32

func (p *Packet) ReadFloat32() (ret float32, err error)

func (*Packet) ReadFloat64

func (p *Packet) ReadFloat64() (ret float64, err error)

func (*Packet) ReadS16

func (p *Packet) ReadS16() (ret int16, err error)

func (*Packet) ReadS24

func (p *Packet) ReadS24() (ret int32, err error)

func (*Packet) ReadS32

func (p *Packet) ReadS32() (ret int32, err error)

func (*Packet) ReadS64

func (p *Packet) ReadS64() (ret int64, err error)

func (*Packet) ReadString

func (p *Packet) ReadString() (ret string, err error)

func (*Packet) ReadU16

func (p *Packet) ReadU16() (ret uint16, err error)

func (*Packet) ReadU24

func (p *Packet) ReadU24() (ret uint32, err error)

func (*Packet) ReadU32

func (p *Packet) ReadU32() (ret uint32, err error)

func (*Packet) ReadU64

func (p *Packet) ReadU64() (ret uint64, err error)

func (*Packet) WriteBool

func (p *Packet) WriteBool(v bool)

func (*Packet) WriteByte

func (p *Packet) WriteByte(v byte)

func (*Packet) WriteBytes

func (p *Packet) WriteBytes(v []byte)

func (*Packet) WriteFloat32

func (p *Packet) WriteFloat32(f float32)

func (*Packet) WriteFloat64

func (p *Packet) WriteFloat64(f float64)

func (*Packet) WriteRawBytes

func (p *Packet) WriteRawBytes(v []byte)

func (*Packet) WriteS16

func (p *Packet) WriteS16(v int16)

func (*Packet) WriteS32

func (p *Packet) WriteS32(v int32)

func (*Packet) WriteS64

func (p *Packet) WriteS64(v int64)

func (*Packet) WriteString

func (p *Packet) WriteString(v string)

func (*Packet) WriteU16

func (p *Packet) WriteU16(v uint16)

func (*Packet) WriteU24

func (p *Packet) WriteU24(v uint32)

func (*Packet) WriteU32

func (p *Packet) WriteU32(v uint32)

func (*Packet) WriteU64

func (p *Packet) WriteU64(v uint64)

func (*Packet) WriteZeros

func (p *Packet) WriteZeros(n int)

================================================ Writers

Jump to

Keyboard shortcuts

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