packet

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2019 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package packet defines packet structure that is sent on the wire between multiple entities

Index

Constants

View Source
const (
	MaxPayloadLength = 32768
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Packet

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

Packet encapsulates a packet sent over the wire that contains some payload and a header

func FromBytes

func FromBytes(data []byte) (*Packet, error)

FromBytes parses byte stream and returns a corresponding packet.

func NewPacket

func NewPacket(payload []byte) *Packet

NewPacket returns new instance of packet with provided payload

func (*Packet) MarshalBinary

func (p *Packet) MarshalBinary() ([]byte, error)

MarshalBinary is an implementation of a method on the BinaryMarshaler interface defined in https://golang.org/pkg/encoding/

func (*Packet) Payload

func (p *Packet) Payload() []byte

Payload returns Payload part of the Packet.

func (*Packet) UnmarshalBinary

func (p *Packet) UnmarshalBinary(data []byte) error

UnmarshalBinary is an implementation of a method on the BinaryUnmarshaler interface defined in https://golang.org/pkg/encoding/

Jump to

Keyboard shortcuts

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