datapackage

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 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
}

DataPackage .

func (*DataPackage) Marshal

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

Marshal DataPackage.

func (*DataPackage) Size

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

Size DataPackage.

func (*DataPackage) Unmarshal

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

Unmarshal DataPackage.

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 . @Description: create a Package contains message payload with protocol. @param protocol: @param payload: @return *Package:

func (*Package) FromBytes

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

FromBytes . @Description: parse bytes received from receive stream into Package. @receiver m @param data: @return error:

func (*Package) Payload

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

Payload . @Description: return the message payload bytes. @receiver m @return []byte:

func (*Package) Protocol

func (m *Package) Protocol() string

Protocol . @Description: return the protocol id that the message marked. @receiver m @return string:

func (*Package) ToBytes

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

ToBytes . @Description: parse Package to bytes for sending on stream finally. @receiver m @param enableCompress: @return []byte: @return error:

Jump to

Keyboard shortcuts

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