Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DataPackage ¶
DataPackage .
func (*DataPackage) Unmarshal ¶
func (d *DataPackage) Unmarshal(buf []byte) (uint64, error)
Unmarshal .
type ID ¶
type ID string
ID is an identifier used to mark the module which the net msg belong to.
const ( // TestingPID is a protocol id for testing. TestingPID ID = "/_testing" )
type Package ¶
type Package struct {
// contains filtered or unexported fields
}
Package is a container for net message.
func NewPackage ¶
NewPackage create a Package contains message payload with protocol.
func (*Package) FromBytes ¶
FromBytes parse bytes received from receive stream into Package. determine whether the payload is compressed according to the Compress field in the structure object. if Compress is true, the data is compressed and needs to be decompressed
func (*Package) Payload ¶
Payload return the message payload bytes.
func (*Package) ProtocolID ¶
ProtocolID return the protocol id that the message marked.
Click to show internal directories.
Click to hide internal directories.