packet

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2021 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package packet implements the Katzenpost server side packet structure.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseForwardPacket added in v0.0.2

func ParseForwardPacket(pkt *Packet) ([]byte, []byte, error)

Types

type Packet

type Packet struct {
	Raw     []byte
	Payload []byte

	// The parsed out routing commands.
	NextNodeHop *commands.NextNodeHop
	NodeDelay   *commands.NodeDelay
	Recipient   *commands.Recipient
	SurbReply   *commands.SURBReply

	ID         uint64
	Delay      time.Duration
	RecvAt     time.Duration
	DispatchAt time.Duration

	MustForward   bool
	MustTerminate bool
}

func New

func New(raw []byte) (*Packet, error)

New allocates a new Packet, with the specified raw payload.

func NewPacketFromSURB added in v0.0.2

func NewPacketFromSURB(pkt *Packet, surb, payload []byte) (*Packet, error)

func NewWithID

func NewWithID(raw []byte, id uint64) (*Packet, error)

NewWithID allocates a new Packet, with the specified raw payload and ID. Most callers should use New, this exists to support serializing packets to external memory.

func (*Packet) CmdsToString

func (pkt *Packet) CmdsToString() string

CmdsToString returns an abbreviated list of the packet's routing commands, suitable for debugging.

func (*Packet) Dispose

func (pkt *Packet) Dispose()

Dispose clears the packet structure and returns it to the allocation pool.

func (*Packet) IsForward

func (pkt *Packet) IsForward() bool

IsForward returns true iff the packet has routing commands indicating it is a forward packet destined for another hop.

func (*Packet) IsSURBReply

func (pkt *Packet) IsSURBReply() bool

IsSURBReply returns true iff the packet has routing commands indicating it is a SURB Reply destined for a local user.

func (*Packet) IsToUser

func (pkt *Packet) IsToUser() bool

IsToUser returns true iff the packet has routing commands indicating it is a forward packet destined for a local user.

func (*Packet) IsUnreliableToUser

func (pkt *Packet) IsUnreliableToUser() bool

IsUnreliableToUser returns true iff the packet has routing commands indicating it is an unreliable forward packet destined for a local user.

func (*Packet) Set

func (pkt *Packet) Set(payload []byte, cmds []commands.RoutingCommand) error

Set sets the Packet's internal components.

Jump to

Keyboard shortcuts

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