babel

package module
v0.1.27 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

README

GitHub Workflow Status goreportcard Codecov branch License GitHub go.mod Go version Go Reference

go-babel is an implementation of the Babel routing protocol in the Go programming language.

RFCs / Status

go-babel aims at implementing the following RFCs and drafts:

Under implementation

Planned

Limitations

  • Link cost calculation is only supported for wired links using the 2-out-of-3 strategy. ETX is not (yet) supported.

References

Contact

Please have a look at the contact page: cunicu.li/docs/contact.

License

go-babel is licensed under the Apache 2.0 license.

  • SPDX-FileCopyrightText: 2023-2024 Steffen Vogel post@steffenvogel.de
  • SPDX-License-Identifier: Apache-2.0

Documentation

Overview

SPDX-FileCopyrightText: 2023-2024 Steffen Vogel <post@steffenvogel.de> SPDX-License-Identifier: Apache-2.0

Index

Constants

View Source
const (
	DefaultIHUInterval            = 12 * time.Second // 3 * DefaultMulticastHelloInterval
	DefaultInitialRequestTimeout  = 2 * time.Second
	DefaultMulticastHelloInterval = 4 * time.Second
	DefaultRouteExpiryTime        = 56 // 3.5 * DefaultUpdateInterval
	DefaultSourceGCTime           = 3 * time.Minute
	DefaultUnicastHelloInterval   = 0                // infinitive, no Hellos are send
	DefaultUpdateInterval         = 16 * time.Second // 4 * DefaultMulticastHelloInterval
	DefaultUrgentTimeout          = 200 * time.Millisecond

	DefaultIHUHoldTimeFactor = 3.5 // times the advertised IHU interval
	DefaultWiredLinkCost     = 96
)
View Source
const (
	// TrafficClassNetworkControl represents a class selector code-point
	// as defined by RFC 2474.
	// Routing protocols are recommended to use the __network control_ service class (CS6)
	// as recommended by RFC 4594.
	// We shift it by 2 bits to account for the ECN bits of the traffic class octet.
	//
	// See:
	// - https://datatracker.ietf.org/doc/html/rfc2474#autoid-9
	// - https://datatracker.ietf.org/doc/html/rfc4594#section-3.1
	TrafficClassNetworkControl = 48 << 2 // DiffServ / DSCP name CS6
)

Variables

View Source
var (
	Port               = 6697
	MulticastGroupIPv6 = netip.MustParseAddr("ff02::1:6")
	MulticastGroupIPv4 = netip.MustParseAddr("224.0.0.111")
)

5. IANA Considerations https://datatracker.ietf.org/doc/html/rfc8966#name-iana-considerations

View Source
var DefaultParameters = Parameters{
	MulticastHelloInterval: DefaultMulticastHelloInterval,
	UnicastHelloInterval:   DefaultUnicastHelloInterval,
	UpdateInterval:         DefaultUpdateInterval,
	IHUInterval:            DefaultIHUInterval,
	RouteExpiryTime:        DefaultRouteExpiryTime,
	InitialRequestTimeout:  DefaultInitialRequestTimeout,
	UrgentTimeout:          DefaultUrgentTimeout,
	SourceGCTime:           DefaultSourceGCTime,
	NominalLinkCost:        DefaultWiredLinkCost,
}

Functions

This section is empty.

Types

type FeasibilityDistance

type FeasibilityDistance struct {
	SeqNo  proto.SequenceNumber
	Metric uint
}

func (FeasibilityDistance) IsBetter

Less checks if the the feasibility is better than the provided one

https://datatracker.ietf.org/doc/html/rfc8966#section-3.5.1

type Interface

type Interface struct {
	*net.Interface

	Neighbours NeighbourTable
	// contains filtered or unexported fields
}

func (*Interface) Close

func (i *Interface) Close() error

func (*Interface) NewNeighbour

func (i *Interface) NewNeighbour(addr proto.Address) (*Neighbour, error)

type InterfaceHandler

type InterfaceHandler interface {
	InterfaceAdded(*Interface)
	InterfaceRemoved(*Interface)
}

type InterfaceTable

type InterfaceTable table.Table[int, *Interface]

func NewInterfaceTable

func NewInterfaceTable() InterfaceTable

func (*InterfaceTable) Foreach

func (t *InterfaceTable) Foreach(cb func(int, *Interface) error) error

func (*InterfaceTable) Insert

func (t *InterfaceTable) Insert(i *Interface)

func (*InterfaceTable) Lookup

func (t *InterfaceTable) Lookup(idx int) (*Interface, bool)

type Neighbour

type Neighbour struct {
	Address proto.Address

	TxCost uint16
	// contains filtered or unexported fields
}

func (*Neighbour) Cost

func (n *Neighbour) Cost() uint16

func (*Neighbour) RxCost

func (n *Neighbour) RxCost() uint16

A.2.1. k-out-of-j See: https://datatracker.ietf.org/doc/html/rfc8966#section-a.2.1

type NeighbourHandler

type NeighbourHandler interface {
	NeighbourAdded(*Neighbour)
	NeighbourRemoved(*Neighbour)
}

type NeighbourTable

type NeighbourTable table.Table[proto.Address, *Neighbour]

func NewNeighbourTable

func NewNeighbourTable() NeighbourTable

func (*NeighbourTable) Foreach

func (t *NeighbourTable) Foreach(cb func(*Neighbour) error) error

func (*NeighbourTable) Insert

func (t *NeighbourTable) Insert(n *Neighbour)

func (*NeighbourTable) Lookup

func (t *NeighbourTable) Lookup(a proto.Address) (*Neighbour, bool)

type Parameters

type Parameters struct {
	IHUHoldTimeFactor      float32
	IHUInterval            time.Duration
	InitialRequestTimeout  time.Duration
	MulticastHelloInterval time.Duration
	RouteExpiryTime        time.Duration
	SourceGCTime           time.Duration
	UnicastHelloInterval   time.Duration
	UpdateInterval         time.Duration
	UrgentTimeout          time.Duration
	NominalLinkCost        uint16
}

type PendingSeqNoRequest

type PendingSeqNoRequest struct {
	Prefix   proto.Prefix
	RouterID proto.RouterID

	Neighbour *Neighbour
	Resent    int
}

type PendingSeqNoRequestTable

type PendingSeqNoRequestTable table.Table[pendingSeqNoRequestKey, *PendingSeqNoRequest]

func (*PendingSeqNoRequestTable) Insert

func (*PendingSeqNoRequestTable) Lookup

type Route

type Route struct {
	Source    *Source
	Neighbour *Neighbour

	Metric         uint16
	SmoothedMetric uint16
	SeqNo          proto.SequenceNumber
	NextHop        proto.Address
	Selected       bool
}

3.2.6. The Route Table https://datatracker.ietf.org/doc/html/rfc8966#section-3.2.6

func (*Route) SetMetric

func (r *Route) SetMetric(metric uint16)

type RouteTable

type RouteTable table.Table[routeKey, *Route]

func (*RouteTable) Insert

func (t *RouteTable) Insert(r *Route)

func (*RouteTable) Lookup

func (t *RouteTable) Lookup(pfx proto.Prefix, rid proto.RouterID) (*Route, bool)

type Source

type Source struct {
	Prefix   netip.Prefix
	RouterID proto.RouterID

	Metric int
	SeqNo  uint16
}

type SourceTable

type SourceTable table.Table[sourceKey, *Source]

func (*SourceTable) Insert

func (t *SourceTable) Insert(s *Source)

func (*SourceTable) Lookup

func (t *SourceTable) Lookup(pfx netip.Prefix, rid proto.RouterID) (*Source, bool)

type Speaker

type Speaker struct {
	Interfaces InterfaceTable
	Sources    SourceTable
	Routes     RouteTable
	// contains filtered or unexported fields
}

func NewSpeaker

func NewSpeaker(cfg *SpeakerConfig) (*Speaker, error)

func (*Speaker) Close

func (s *Speaker) Close() error

type SpeakerConfig

type SpeakerConfig struct {
	*Parameters

	Handler         any
	RouterID        proto.RouterID
	InterfaceFilter func(string) bool
	RouteFilter     func(*Route) proto.Metric
	UnicastPeers    []net.UDPAddr
	Multicast       bool
	Logger          *slog.Logger
}

func (*SpeakerConfig) SetDefaults

func (c *SpeakerConfig) SetDefaults() error

Directories

Path Synopsis
internal
history
Package history implements a history vector keep track of received Hellos
Package history implements a history vector keep track of received Hellos
net

Jump to

Keyboard shortcuts

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