packet

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Err_PacketLength = errors.New("invalid packet length")
)

Functions

This section is empty.

Types

type IDecryptor

type IDecryptor interface {
	Decrypt(dst, src []byte)
}

type IEncryptor

type IEncryptor interface {
	Encrypt(dst, src []byte)
}

type Packet

type Packet []byte

func Assemble

func Assemble(op uint32, body []byte) Packet

func Assemble_B8

func Assemble_B8(op uint32, body []byte, b8 uint64) Packet

func Assemble_B8_Str

func Assemble_B8_Str(op uint32, body []byte, b8 uint64, str string) Packet

func (*Packet) Add_B8

func (self *Packet) Add_B8(b8 uint64)

func (Packet) Body

func (self Packet) Body() []byte

func (Packet) Op

func (self Packet) Op() uint32

func (*Packet) Peek_B8

func (self *Packet) Peek_B8() uint64

func (*Packet) Peek_B8_Str

func (self *Packet) Peek_B8_Str() (b8 uint64, str string)

func (*Packet) Remove_B8

func (self *Packet) Remove_B8() uint64

func (*Packet) Remove_B8_Str

func (self *Packet) Remove_B8_Str() (b8 uint64, str string)

func (Packet) Seq

func (self Packet) Seq() uint32

type Reader

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

func NewReader

func NewReader() *Reader

func (*Reader) Read

func (self *Reader) Read(buf []byte) (p Packet, buf_ptr []byte, err error)

func (*Reader) SetDecryptor

func (self *Reader) SetDecryptor(v IDecryptor)

func (*Reader) SetMaxPacketLen

func (self *Reader) SetMaxPacketLen(n uint32)

type Writer

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

func NewWriter

func NewWriter() *Writer

func (*Writer) SetEncryptor

func (self *Writer) SetEncryptor(v IEncryptor)

func (*Writer) Write

func (self *Writer) Write(p Packet) (buf []byte)

Jump to

Keyboard shortcuts

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