beaconing

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: Apache-2.0 Imports: 27 Imported by: 0

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

Constants

View Source
const (
	// DefaultIfidSize is the default bit-size for ifids in the hop-fields.
	DefaultIfidSize = 12
)

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(ia addr.IA, intfs *ifstate.Interfaces, beaconInserter BeaconInserter,
	verifier infra.Verifier) infra.Handler

NewHandler returns an infra.Handler for beacon messages. Both the beacon inserter and verifier must not be nil. Otherwise, the handler might panic.

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

type BeaconProvider interface {
	BeaconsToPropagate(ctx context.Context) (<-chan beacon.BeaconOrErr, error)
}

BeaconProvider provides beacons to send to neighboring ASes.

type ExtenderConf

type ExtenderConf struct {
	// Signer is used to sign path segments.
	Signer infra.Signer
	// Mac is used to calculate the hop field MAC.
	Mac hash.Hash
	// Intfs holds all interfaces in the AS.
	Intfs *ifstate.Interfaces
	// MTU is the MTU value set in the AS entries.
	MTU uint16
	// IfidSize is the bit-size of the ifid in the hop-fields.
	IfidSize uint8
	// GetMaxExpTime returns the maximum relative expiration time.
	GetMaxExpTime func() spath.ExpTimeType
	// contains filtered or unexported fields
}

ExtenderConf is the configuration used when extending beacons.

func (*ExtenderConf) InitDefaults

func (cfg *ExtenderConf) InitDefaults()

InitDefaults initializes the default values, if not set.

func (*ExtenderConf) Validate

func (cfg *ExtenderConf) Validate() error

Validate checks that the config contains a signer.

type Originator

type Originator struct {
	// contains filtered or unexported fields
}

Originator originates beacons. It should only be used by core ASes.

func (Originator) IntfActive

func (s Originator) IntfActive(ifid common.IFIDType) bool

IntfActive returns whether the interface is active.

func (*Originator) Name

func (o *Originator) Name() string

Name returns the tasks name.

func (*Originator) Run

func (o *Originator) Run(ctx context.Context)

Run originates core and downstream beacons.

type OriginatorConf

type OriginatorConf struct {
	Config       ExtenderConf
	BeaconSender *onehop.BeaconSender
	Period       time.Duration
}

OriginatorConf is the configuration to create a new originator.

func (OriginatorConf) New

func (cfg OriginatorConf) New() (*Originator, error)

New creates a new originator.

type Propagator

type Propagator struct {
	// contains filtered or unexported fields
}

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) IntfActive

func (s Propagator) IntfActive(ifid common.IFIDType) bool

IntfActive returns whether the interface is active.

func (*Propagator) Name

func (p *Propagator) Name() string

Name returns the tasks name.

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 PropagatorConf

type PropagatorConf struct {
	Config         ExtenderConf
	BeaconProvider BeaconProvider
	BeaconSender   *onehop.BeaconSender
	Period         time.Duration
	Core           bool
	AllowIsdLoop   bool
}

PropagatorConf is the configuration to create a new propagator.

func (PropagatorConf) New

func (cfg PropagatorConf) New() (*Propagator, error)

New creates a new beacon propagation task.

type Registrar

type Registrar struct {
	// contains filtered or unexported fields
}

Registrar is used to periodically register path segments with the appropriate path servers. Core and Up segments are registered with the local path server. Down segments are registered at the core.

func (Registrar) IntfActive

func (s Registrar) IntfActive(ifid common.IFIDType) bool

IntfActive returns whether the interface is active.

func (*Registrar) Name

func (r *Registrar) Name() string

Name returns the tasks name.

func (*Registrar) Run

func (r *Registrar) Run(ctx context.Context)

Run registers path segments for the specified type to path servers.

type RegistrarConf

type RegistrarConf struct {
	Config       ExtenderConf
	SegProvider  SegmentProvider
	TopoProvider itopo.ProviderI
	Msgr         infra.Messenger
	Period       time.Duration
	SegType      proto.PathSegType
}

RegistrarConf is the configuration to create a new registrar.

func (RegistrarConf) New

func (cfg RegistrarConf) New() (*Registrar, error)

New creates a new segment regsitration task.

type SegmentProvider

type SegmentProvider interface {
	SegmentsToRegister(ctx context.Context, segType proto.PathSegType) (
		<-chan beacon.BeaconOrErr, error)
}

SegmentProvider provides segments to register for the specified type.

Directories

Path Synopsis
Package mock_beaconing is a generated GoMock package.
Package mock_beaconing is a generated GoMock package.

Jump to

Keyboard shortcuts

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