ifstate

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package ifstate implements the interface state in memory structure as well as related tasks and handlers.

Interface state

The interface state is stored in the Interfaces struct it can be created by calling the NewInterfaces constructor. The state of a specific interface is stored in the Interface struct.

Revoker

The revoker is a periodic task that revokes interfaces that have timed out and renews revocations of already revoked interfaces. Create it with the NewRevoker costructor.

Handler

The handler handles interface state requests. It can be instantiated with the NewHandler constructor.

Index

Constants

View Source
const (
	// DefaultKeepaliveInterval is the default time between sending IFID
	// keepalive packets to the neighbor.
	DefaultKeepaliveInterval = time.Second
	// DefaultKeepaliveTimeout specifies the default for how long an interface
	// can receive no IFID keepalive packets until it is considered expired.
	DefaultKeepaliveTimeout = 3 * DefaultKeepaliveInterval
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// KeepaliveTimeout specifies for how long an interface can receive no
	// IFID keepalive packets until it is considered expired.
	KeepaliveTimeout time.Duration
}

Config enables configuration of the interfaces.

func (*Config) InitDefaults

func (c *Config) InitDefaults()

InitDefaults initializes the config fields that are not set to the default values.

type Interface

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

Interface keeps track of the interface state.

func (*Interface) Activate deprecated

func (intf *Interface) Activate(remote uint16)

Activate sets the remote interface ID.

Deprecated: Please do not use this anymore. It's only kept for testing purposes.

func (*Interface) LastOriginate

func (intf *Interface) LastOriginate() time.Time

LastOriginate indicates the last time this interface has been originated on.

func (*Interface) LastPropagate

func (intf *Interface) LastPropagate() time.Time

LastPropagate indicates the last time this interface has been propagated on.

func (*Interface) Originate

func (intf *Interface) Originate(now time.Time)

Originate sets the time this interface has been originated on last.

func (*Interface) Propagate

func (intf *Interface) Propagate(now time.Time)

Propagate sets the time this interface has been propagated on last.

func (*Interface) TopoInfo

func (intf *Interface) TopoInfo() InterfaceInfo

TopoInfo returns the topology information.

type InterfaceInfo

type InterfaceInfo struct {
	// ID is the interface ID.
	ID uint16
	// IA is the remote ISD-AS.
	IA       addr.IA
	LinkType topology.LinkType
	// InternalAddr is the AS-internal address of the router that owns this
	// interface.
	InternalAddr netip.AddrPort
	// RemoteID is the remote interface ID.
	RemoteID uint16
	// MTU is the SCION MTU supported on this interface.
	MTU uint16
}

type Interfaces

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

Interfaces keeps track of all interfaces of the AS.

func NewInterfaces

func NewInterfaces(ifInfomap map[uint16]InterfaceInfo, cfg Config) *Interfaces

NewInterfaces initializes the the interfaces with the provided interface info map.

func (*Interfaces) All

func (intfs *Interfaces) All() map[uint16]*Interface

All returns a copy of the map from interface id to interface.

func (*Interfaces) Filtered

func (intfs *Interfaces) Filtered(filter func(*Interface) bool) []*Interface

Filtered returns the subset of interfaces which pass the given filter function.

func (*Interfaces) Get

func (intfs *Interfaces) Get(ifID uint16) *Interface

Get returns the interface for the specified id, or nil if not present.

func (*Interfaces) Reset

func (intfs *Interfaces) Reset()

Reset resets all interface states to inactive. This should be called by the beacon server if it is elected leader.

func (*Interfaces) Update

func (intfs *Interfaces) Update(ifInfomap map[uint16]InterfaceInfo)

Update updates the interface mapping. Interfaces no longer present in the topology are removed. The state of existing interfaces is preserved. New interfaces are added as inactive.

Jump to

Keyboard shortcuts

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