spath

package
v0.0.0-...-c8fc2fc Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HopFieldVerifyFlags = 0x4 // Forward-only
	HopFieldLength      = common.LineLen
	DefaultHopFExpiry   = 63
	MacLen              = 3
	ErrorHopFTooShort   = "HopF too short"
	ErrorHopFBadMac     = "Bad HopF MAC"
)
View Source
const (
	InfoFieldLength    = common.LineLen
	ErrorInfoFTooShort = "InfoF too short"
)
View Source
const (
	MaxTTL      = 24 * 60 * 60 // One day in seconds
	ExpTimeUnit = MaxTTL / 2 << 8
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HopField

type HopField struct {
	Xover       bool
	VerifyOnly  bool
	ForwardOnly bool
	Recurse     bool
	ExpTime     uint8
	Ingress     common.IFIDType
	Egress      common.IFIDType
	Mac         common.RawBytes
	// contains filtered or unexported fields
}

func HopFFromRaw

func HopFFromRaw(b []byte) (*HopField, error)

func NewHopField

func NewHopField(b common.RawBytes, in common.IFIDType, out common.IFIDType) *HopField

func (*HopField) CalcMac

func (h *HopField) CalcMac(mac hash.Hash, tsInt uint32,
	prev common.RawBytes) (common.RawBytes, error)

CalcMac calculates the MAC of a Hop Field and its preceeding Hop Field, if any.

func (*HopField) Len

func (h *HopField) Len() int

Len returns the length (in bytes)

func (*HopField) String

func (h *HopField) String() string

func (*HopField) Verify

func (h *HopField) Verify(mac hash.Hash, tsInt uint32, prev common.RawBytes) error

func (*HopField) Write

func (h *HopField) Write()

type InfoField

type InfoField struct {
	Up       bool
	Shortcut bool
	Peer     bool
	TsInt    uint32
	ISD      uint16
	Hops     uint8
}

func InfoFFromRaw

func InfoFFromRaw(b []byte) (*InfoField, error)

func (*InfoField) String

func (inf *InfoField) String() string

func (*InfoField) Timestamp

func (inf *InfoField) Timestamp() time.Time

func (*InfoField) Write

func (inf *InfoField) Write(b common.RawBytes)

type Path

type Path struct {
	Raw    common.RawBytes
	InfOff int // Offset of current Info Field
	HopOff int // Offset of current Hop Field
}

func New

func New(raw common.RawBytes) *Path

func (*Path) Copy

func (p *Path) Copy() *Path

func (*Path) IncOffsets

func (path *Path) IncOffsets() error

IncOffsets updates the info and hop indices to the next routing field, while skipping verify only fields.

func (*Path) InitOffsets

func (path *Path) InitOffsets() error

InitOffsets computes the initial Hop Field offset (in bytes) for a newly created packet.

func (*Path) Reverse

func (p *Path) Reverse() error

Jump to

Keyboard shortcuts

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