datapackage

package
v0.0.0-...-e18b226 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataPackage

type DataPackage struct {
	Protocol string
	Payload  []byte
	Compress bool
}

func (*DataPackage) Marshal

func (d *DataPackage) Marshal(buf []byte) ([]byte, error)

func (*DataPackage) Size

func (d *DataPackage) Size() (s uint64)

func (*DataPackage) Unmarshal

func (d *DataPackage) Unmarshal(buf []byte) (uint64, error)

type Package

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

Package is a container for net message.

func NewPackage

func NewPackage(protocol string, payload []byte) *Package

NewPackage create a Package contains message payload with protocol.

func (*Package) FromBytes

func (m *Package) FromBytes(data []byte) error

FromBytes parse bytes received from receive stream into Package.

func (*Package) Payload

func (m *Package) Payload() []byte

Payload return the message payload bytes.

func (*Package) Protocol

func (m *Package) Protocol() string

Protocol return the protocol id that the message marked.

func (*Package) ToBytes

func (m *Package) ToBytes(enableCompress bool) ([]byte, error)

ToBytes parse Package to bytes for sending on stream finally.

Jump to

Keyboard shortcuts

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