packet

package
v0.0.33 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: AGPL-3.0, 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

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

Types

type Packet

type Packet struct {
	Geometry *geo.Geometry

	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.Time
	DispatchAt time.Time

	MustForward   bool
	MustTerminate bool
	// contains filtered or unexported fields
}

func New

func New(raw []byte, g *geo.Geometry) (*Packet, error)

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

func NewPacketFromSURB

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

func NewWithID

func NewWithID(raw []byte, id uint64, g *geo.Geometry) (*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) 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