packet

package
Version: v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 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

This section is empty.

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/

Source Files

Jump to

Keyboard shortcuts

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