ifstate

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: Apache-2.0 Imports: 4 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 common.IFIDType)

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() topology.IFInfo

TopoInfo returns the topology information.

type Interfaces

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

Interfaces keeps track of all interfaces of the AS.

func NewInterfaces

func NewInterfaces(ifInfomap topology.IfInfoMap, cfg Config) *Interfaces

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

func (*Interfaces) All

func (intfs *Interfaces) All() map[common.IFIDType]*Interface

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

func (*Interfaces) Get

func (intfs *Interfaces) Get(ifid common.IFIDType) *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 topology.IfInfoMap)

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