Documentation ¶
Overview ¶
Package beaconing implements tasks and handlers related to beacon propagation and registration.
Handler ¶
Call NewHandler to create a beacon handler that implements infra.Handler. The handler validates the received beacon and verifies all signatures. If successful, the beacon is added to the beacon store.
Originator ¶
The originator should only be instantiated by core beacon servers. It periodically creates fresh beacons and propagates them on all core and child links. In case the task is run before a full period has passed, beacons are originated on all interfaces that have last been originated on more than one period ago.
Registrar ¶
The registrar is a periodic task to register segments with the appropriate path server. Core and Up segments are registered with the local path server. Down segments are registered with the originating core AS. In case the task is run before a full period has passed, segments are only registered, if there has not been a successful registration in the last period.
Propagator ¶
The propagator is a periodic task to propagate beacons to the appropriate neighboring ASes. In a core AS, the beacons are propagated to the neighbors on all core link, unless they will create an AS loop. In a non-core AS, the beacons are propagated to the neighbors on all child links. In case the task is run before a full period has passed, beacons are propagated on all interfaces that have last been propagated on more than one period ago.
Index ¶
- type BeaconInserter
- type BeaconProvider
- type DefaultExtender
- type Extender
- type Handler
- type InterfaceBandwidths
- type InterfaceGeodata
- type InterfaceHops
- type InterfaceLatencies
- type LinkType
- type LocalWriter
- type Originator
- type Pather
- type Propagator
- type RPC
- type RemoteWriter
- type SegmentProvider
- type SegmentStore
- type Sender
- type SenderFactory
- type Signer
- type SignerGen
- type SignerGenFunc
- type StaticInfoCfg
- type Tick
- type WriteScheduler
- type WriteStats
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BeaconInserter ¶
type BeaconInserter interface { PreFilter(beacon beacon.Beacon) error InsertBeacon(ctx context.Context, beacon beacon.Beacon) (beacon.InsertStats, error) }
BeaconInserter inserts beacons into the beacon store.
type BeaconProvider ¶
BeaconProvider provides beacons to send to neighboring ASes.
type DefaultExtender ¶
type DefaultExtender struct { // IA is the local IA IA addr.IA // SignerGen is used to sign path segments. SignerGen SignerGen // MAC is used to calculate the hop field MAC. MAC func() hash.Hash // Intfs holds all interfaces in the AS. Intfs *ifstate.Interfaces // MTU is the MTU value set in the AS entries. MTU uint16 // GetMaxExpTime returns the maximum relative expiration time. MaxExpTime func() uint8 // Task contains an identifier specific to the task that uses the extender. Task string // StaticInfo contains the configuration used for the StaticInfo Extension. StaticInfo func() *StaticInfoCfg // EPIC defines whether the EPIC authenticators should be added when the segment is extended. EPIC bool // SegmentExpirationDeficient is a gauge that is set to 1 if the expiration time of the segment // is below the maximum expiration time. This happens when the signer expiration time is lower // than the maximum segment expiration time. SegmentExpirationDeficient metrics.Gauge }
DefaultExtender extends provided path segments with entries for the local AS.
func (*DefaultExtender) Extend ¶
func (s *DefaultExtender) Extend( ctx context.Context, pseg *seg.PathSegment, ingress, egress uint16, peers []uint16, ) error
Extend extends the beacon with hop fields.
type Extender ¶
type Extender interface { // Extend extends the path segment. The zero value for ingress indicates // that the created AS entry is the initial entry in a path. The zero value // for egress indicates that the created AS entry is the last entry in the // path, and the beacon is terminated. Extend(ctx context.Context, seg *seg.PathSegment, ingress, egress uint16, peers []uint16) error }
Extender extends path segments.
type Handler ¶
type Handler struct { LocalIA addr.IA Inserter BeaconInserter Verifier infra.Verifier Interfaces *ifstate.Interfaces BeaconsHandled metrics.Counter }
Handler handles beacons.
type InterfaceBandwidths ¶
type InterfaceGeodata ¶
type InterfaceHops ¶
type InterfaceLatencies ¶
type LinkType ¶
type LinkType staticinfo.LinkType
func (*LinkType) MarshalText ¶
func (*LinkType) UnmarshalText ¶
type LocalWriter ¶
type LocalWriter struct { // InternalErrors counts errors that happened before being able to send a // segment to a remote. This can for example be during the termination of // the segment. If the counter is nil errors are not counted. InternalErrors metrics.Counter // Registered counts the amount of registered segments. A label is used to // indicate the status of the registration. Registered metrics.Counter // Type is the type of segment that is handled by this writer. Type seg.Type // Store is used to store the terminated segments. Store SegmentStore // Extender is used to terminate the beacon. Extender Extender // Intfs gives access to the interfaces this CS beacons over. Intfs *ifstate.Interfaces }
LocalWriter can be used to write segments in the SegmentStore.
func (*LocalWriter) Write ¶
func (r *LocalWriter) Write( ctx context.Context, segments []beacon.Beacon, peers []uint16, ) (WriteStats, error)
Write terminates the segments and registers them in the SegmentStore.
type Originator ¶
type Originator struct { Extender Extender SenderFactory SenderFactory IA addr.IA Signer seg.Signer AllInterfaces *ifstate.Interfaces OriginationInterfaces func() []*ifstate.Interface Originated metrics.Counter // Tick is mutable. Tick Tick }
Originator originates beacons. It should only be used by core ASes.
func (*Originator) Run ¶
func (o *Originator) Run(ctx context.Context)
Run originates core and downstream beacons.
type Propagator ¶
type Propagator struct { Extender Extender SenderFactory SenderFactory Provider BeaconProvider IA addr.IA Signer seg.Signer AllInterfaces *ifstate.Interfaces PropagationInterfaces func() []*ifstate.Interface AllowIsdLoop bool Propagated metrics.Counter InternalErrors metrics.Counter // Tick is mutable. Tick Tick }
Propagator forwards beacons to neighboring ASes. In a core AS, the beacons are propagated to neighbors on core links. In a non-core AS, the beacons are forwarded on child links. Selection of the beacons is handled by the beacon provider, the propagator only filters AS loops.
func (*Propagator) Run ¶
func (p *Propagator) Run(ctx context.Context)
Run propagates beacons provided by the beacon provider on all active target interfaces. In a core beacon server, core interfaces are the target interfaces. In a non-core beacon server, child interfaces are the target interfaces.
type RemoteWriter ¶
type RemoteWriter struct { // InternalErrors counts errors that happened before being able to send a // segment to a remote. This can be during terminating the segment, looking // up the remote etc. If the counter is nil errors are not counted. InternalErrors metrics.Counter // Registered counts the amount of registered segments. A label is used to // indicate the status of the registration. Registered metrics.Counter // Intfs gives access to the interfaces this CS beacons over. Intfs *ifstate.Interfaces // Extender is used to terminate the beacon. Extender Extender // Type is the type of segment that is handled by this writer. Type seg.Type // RPC is used to send the segment to a remote. RPC RPC // Pather is used to find paths to a remote. Pather Pather }
RemoteWriter writes segments via an RPC to the source AS of a segment.
func (*RemoteWriter) Write ¶
func (r *RemoteWriter) Write( ctx context.Context, segments []beacon.Beacon, peers []uint16, ) (WriteStats, error)
Write writes the segment at the source AS of the segment.
type SegmentProvider ¶
type SegmentProvider interface { // SegmentsToRegister returns the segments that should be registered for the // given segment type. The returned slice must not be nil if the returned // error is nil. SegmentsToRegister(ctx context.Context, segType seg.Type) ([]beacon.Beacon, error) }
SegmentProvider provides segments to register for the specified type.
type SegmentStore ¶
type SegmentStore interface {
StoreSegs(context.Context, []*seg.Meta) (seghandler.SegStats, error)
}
SegmentStore stores segments in the path database.
type Sender ¶
type Sender interface { // Send sends the beacon on an established connection Send(ctx context.Context, b *seg.PathSegment) error // Close closes the resources associated with the sender. It must be invoked to avoid leaking // connections. Close() error }
Sender sends beacons on an established connection.
type SenderFactory ¶
type SenderFactory interface { // NewSender creates a new beacon sender to the specified ISD-AS over the given egress // interface. Nexthop is the internal router endpoint that owns the egress interface. The caller // is required to close the sender once it's not used anymore. NewSender( ctx context.Context, dst addr.IA, egress uint16, nexthop *net.UDPAddr, ) (Sender, error) }
SenderFactory can be used to create a new beacon sender.
type SignerGen ¶ added in v0.9.0
type SignerGen interface { // Generate generates a signer it. Generate(ctx context.Context) ([]Signer, error) }
SignerGen generates signers and returns their expiration time.
type SignerGenFunc ¶ added in v0.11.0
type StaticInfoCfg ¶
type StaticInfoCfg struct { Latency map[iface.ID]InterfaceLatencies `json:"Latency"` Bandwidth map[iface.ID]InterfaceBandwidths `json:"Bandwidth"` LinkType map[iface.ID]LinkType `json:"LinkType"` Geo map[iface.ID]InterfaceGeodata `json:"Geo"` Hops map[iface.ID]InterfaceHops `json:"Hops"` Note string `json:"Note"` }
StaticInfoCfg is used to parse data from config.json.
func ParseStaticInfoCfg ¶
func ParseStaticInfoCfg(file string) (*StaticInfoCfg, error)
ParseStaticInfoCfg parses data from a config file into a StaticInfoCfg struct.
func (StaticInfoCfg) Generate ¶
func (cfg StaticInfoCfg) Generate(intfs *ifstate.Interfaces, ingress, egress uint16) *staticinfo.Extension
Generate creates a StaticInfoExtn struct and populates it with data extracted from the configuration.
type Tick ¶
type Tick struct {
// contains filtered or unexported fields
}
Tick keeps track whether the period has passed compared to the last time.
If the Tick's clock has never been set, its value is the default Go time.Time.
func (*Tick) Overdue ¶
Overdue returns true if the Tick's period has elapsed since timestamp in the past up to the Tick's Now time.
func (*Tick) Passed ¶
Passed returns true if the Tick's period has elapsed since the last UpdateLast call up to the Tick's Now time.
func (*Tick) UpdateLast ¶
func (t *Tick) UpdateLast()
UpdateLast updates the last time to the current time, if the period has passed since last.
type WriteScheduler ¶
type WriteScheduler struct { // Provider is used to query for segments. Provider SegmentProvider // Intfs gives access to the interfaces this CS beacons over. Intfs *ifstate.Interfaces // Type is the type of segments that should be queried from the Provider. Type seg.Type // Write is used to write the segments once the scheduling determines it is // time to write. Writer Writer // Tick is mutable. It's used to determine when to call write. Tick Tick // contains filtered or unexported fields }
WriteScheduler is used to periodically write path segments at the configured writer.
func (*WriteScheduler) Run ¶
func (r *WriteScheduler) Run(ctx context.Context)
Run writes path segments using the configured writer.
type WriteStats ¶
type WriteStats struct { // Count is the number of successfully written segments. Count int // StartIAs lists the AS. StartIAs map[addr.IA]struct{} }
WriteStats provides statistics about segment writing.
type Writer ¶
type Writer interface { // Write writes passed slice of segments.Peers indicate the peering // interface IDs of the local IA. The returned statistics should provide // insights about how many segments have been successfully written. The // method should return an error if the writing did fail. Write(ctx context.Context, segs []beacon.Beacon, peers []uint16) (WriteStats, error) }
Writer writes segments.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package mock_beaconing is a generated GoMock package.
|
Package mock_beaconing is a generated GoMock package. |