server: github.com/katzenpost/server/internal/packet Index | Files

package packet

import "github.com/katzenpost/server/internal/packet"

Package packet implements the Katzenpost server side packet structure.

Index

Package Files

packet.go

func ParseForwardPacket Uses

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

type Packet Uses

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 Uses

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

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

func NewPacketFromSURB Uses

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

func NewWithID Uses

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 Uses

func (pkt *Packet) CmdsToString() string

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

func (*Packet) Dispose Uses

func (pkt *Packet) Dispose()

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

func (*Packet) IsForward Uses

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 Uses

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 Uses

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 Uses

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 Uses

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

Set sets the Packet's internal components.

Package packet imports 8 packages (graph) and is imported by 8 packages. Updated 2018-09-06. Refresh now. Tools for package owners.