codec

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(data []byte) (uint32, message.PacketType, protocol.PeerID, []byte, error)

func Encode

func Encode(typ message.PacketType, cipher noise.Cipher, peerID protocol.PeerID, payload []byte) []byte

Encode encodes byte slice payload into binary format

func EncodeMessage

func EncodeMessage(typ message.PacketType, cipher noise.Cipher, peerID protocol.PeerID, msg proto.Message) ([]byte, error)

Types

type RawPacket

type RawPacket struct {
	Type    message.PacketType
	Nonce   uint32
	Payload []byte
}

type RelayCodec

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

func NewCodec

func NewCodec() *RelayCodec

func (*RelayCodec) Decode

func (c *RelayCodec) Decode(input []byte) ([]RawPacket, error)

Decode decodes the protobuf message into MERP command.

func (*RelayCodec) Encode

func (c *RelayCodec) Encode(nonce uint32, typ message.PacketType, data []byte) ([]byte, error)

Encode encodes the protobuf message in relay command form into bytes.

Directories

Path Synopsis
Package serder is used to serialize/deserialize network packets.
Package serder is used to serialize/deserialize network packets.

Jump to

Keyboard shortcuts

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