Documentation
¶
Overview ¶
Package segment wraps the vendored control-plane protobuf path segment messages in CION-owned domain types: parsing path-construction beacons, creating and signing AS entries, computing hop-field MACs, and building data-plane paths from registered segments.
Index ¶
- Constants
- func Compose(parts ...*scion.Decoded) (*scion.Decoded, error)
- func EdgeDelay(up, down *ASEntry) (time.Duration, bool)
- type ASEntry
- type EntryOptions
- type Info
- type LinkID
- type PCB
- func (p *PCB) AppendEntry(ctx context.Context, ia addr.IA, opts EntryOptions, ...) error
- func (p *PCB) AppendRouteHop(ia addr.IA, opts EntryOptions, macFactory func() hash.Hash) (path.HopField, error)
- func (p *PCB) AssociatedData(i int) [][]byte
- func (p *PCB) Clone() (*PCB, error)
- func (p *PCB) ContainsIA(ia addr.IA) bool
- func (p *PCB) Expiration() time.Time
- func (p *PCB) FirstIA() addr.IA
- func (p *PCB) ForwardPath() *scion.Decoded
- func (p *PCB) ForwardPathFrom(i int) (*scion.Decoded, error)
- func (p *PCB) ID() uint16
- func (p *PCB) IndexOfIA(ia addr.IA) int
- func (p *PCB) LastIA() addr.IA
- func (p *PCB) ReversePath() *scion.Decoded
- func (p *PCB) ReversePathTo(m int) (*scion.Decoded, error)
- func (p *PCB) RouteKey() string
- func (p *PCB) Timestamp() time.Time
- type Signer
Constants ¶
const ( // HopExpTime is the expiration time of created hop fields: a hop expires // (1+HopExpTime) hop-field units after the segment timestamp — six hours. HopExpTime uint8 = 63 // MTU is the intra-AS MTU advertised in created AS entries (draft Section // 2.2.2.2; a fixed default, like the reference implementation's). MTU uint32 = 1500 )
Variables ¶
This section is empty.
Functions ¶
func Compose ¶
Compose concatenates segment paths into one end-to-end data-plane path: up (reversed), core, and down segments in travel order. The result starts at the first part's current position.
func EdgeDelay ¶ added in v0.0.10
EdgeDelay returns the declared one-way delay of the link between two consecutive entries, from up's egress interface to down's ingress interface, whichever direction travel runs: the higher of the two ends' declarations where both declare, false where neither does — an undeclared edge is unknown, not free.
Types ¶
type ASEntry ¶
type ASEntry struct {
// IA is the ISD-AS of the AS that created this entry.
IA addr.IA
// Next is the ISD-AS of the downstream AS the beacon is forwarded to;
// zero on a terminating entry (Section 3.1.1).
Next addr.IA
// IngressMTU is the MTU of the ingress interface in beaconing direction.
IngressMTU uint32
// Hop is the data-plane hop field of this entry.
Hop path.HopField
// Latency holds the one-way delays the entry's signed extension declares
// (the StaticInfoExtension the drafts name for segment latency), keyed by
// the declaring ISD-AS and interface. Each AS attests its own links
// alone; nil when the entry declares none.
Latency map[LinkID]time.Duration
// Signed is the raw signed component, the input to signature
// verification.
Signed *cryptopb.SignedMessage
}
ASEntry is one decoded AS entry: the signed body's fields together with the raw signed component they were extracted from.
type EntryOptions ¶
type EntryOptions struct {
// Next is the ISD-AS of the neighbor the beacon is propagated to; zero
// terminates the segment (Section 3.1.1).
Next addr.IA
// IngressIfID is the interface the beacon entered this AS on; zero on
// the originating core.
IngressIfID uint16
// EgressIfID is the interface the beacon leaves on; zero on a
// terminating entry.
EgressIfID uint16
// EgressLatency is the egress link's declared one-way delay, carried in
// the signed extension the drafts define — the node's latest measured
// echo round trip halved. Zero declares nothing: a link without a sample
// declares none.
EgressLatency time.Duration
}
EntryOptions describes the AS entry to append to the segment.
type Info ¶
Info is the decoded segment information (Section 2.2.1): the creation timestamp set by the originating core, and the 16-bit segment identifier seeding the hop-field MAC chain.
type LinkID ¶
type LinkID struct {
// IA is the ISD-AS of the interface's end.
IA addr.IA
// IfID is the interface ID at that end.
IfID uint16
}
LinkID identifies one link by an ISD-AS and one of its interface IDs — either end names the link — the identity interface-down signals name and composed paths' link sets carry.
type PCB ¶
type PCB struct {
// PB is the wire form; it is mutated by AppendEntry.
PB *cppb.PathSegment
// Info is the decoded segment information.
Info Info
// Entries are the decoded AS entries, in construction direction.
Entries []ASEntry
}
PCB is a parsed path-construction beacon or path segment: the wire message with its segment information and AS entries decoded (control plane draft, Section 2.2).
func NewPCB ¶
NewPCB creates a fresh beacon's wire form: new segment information with a cryptographically random 16-bit segment ID and the creation timestamp (Section 2.2.1). The caller appends the originating core's AS entry.
func ParsePCB ¶
func ParsePCB(pb *cppb.PathSegment) (*PCB, error)
ParsePCB decodes the wire message's segment information and AS entries.
func (*PCB) AppendEntry ¶
func (p *PCB) AppendEntry( ctx context.Context, ia addr.IA, opts EntryOptions, macFactory func() hash.Hash, signer Signer, ) error
AppendEntry appends this AS's signed entry to the segment and MACs the hop field with the data-plane forwarding key — the same MAC algorithm the processor verifies — chaining the segment ID through the existing hops (dataplane draft, Section 4.1).
func (*PCB) AppendRouteHop ¶
func (p *PCB) AppendRouteHop( ia addr.IA, opts EntryOptions, macFactory func() hash.Hash, ) (path.HopField, error)
AppendRouteHop appends this AS's hop field to the segment without signing an entry: the enrollment route built from an unverified beacon, whose reversed path needs the node's own hop to leave its router. The appended entry carries no signature — it is a route, never a stored, propagated, or registered segment.
func (*PCB) AssociatedData ¶
AssociatedData returns the signature input association for entry i (Section 2.2.2.6): the segment information followed by the signed component and signature of every previous entry.
func (*PCB) Clone ¶
Clone returns a deep copy of the segment's current state, for extending one candidate into several propagated or terminated segments.
func (*PCB) ContainsIA ¶
ContainsIA reports whether any entry names the given ISD-AS.
func (*PCB) Expiration ¶
Expiration returns the earliest absolute hop expiration of the segment (Section 2.2.2.5): each hop expires its ExpTime units after the segment timestamp.
func (*PCB) ForwardPath ¶
ForwardPath returns the data-plane path in construction direction: originator to terminator, hop fields as beaconed.
func (*PCB) ForwardPathFrom ¶
ForwardPathFrom returns the data-plane path in construction direction beginning mid-segment at entry i: the hop fields of entries i onward, the segment ID chained through the entries the travel skips — the state at position i, the same arithmetic ReversePath performs for the terminator. A hop field's MAC depends on the hops before it in construction direction, never on the hops after it, so starting past the skipped entries verifies unchanged. The result carries at least two hop fields, the minimum the data plane accepts of a segment without the peering flag.
func (*PCB) IndexOfIA ¶
IndexOfIA returns the index of the first entry naming the given ISD-AS, or -1 when none does.
func (*PCB) ReversePath ¶
ReversePath returns the data-plane path against construction direction: terminator to originator, hop fields reversed, and the segment ID chained through every hop but the terminator's own — the value the info field holds when a packet starts at this end (dataplane draft, Section 4.1).
func (*PCB) ReversePathTo ¶
ReversePathTo returns the data-plane path against construction direction ending mid-segment at entry m: reversed travel starts at the terminator whatever the ending, so the info field is ReversePath's own — its chained state covers entries 0 to n-2 independent of m — and the hop fields run from the terminator down to m. Removing trailing hops changes no state a kept router reads. The result carries at least two hop fields, the minimum the data plane accepts of a segment without the peering flag.