Documentation ¶
Index ¶
- func ShouldPropagateUpdate(pfx *net.Prefix, p *route.Path, sa *SessionAttrs) bool
- type AdjRIB
- type AdjRIBIn
- type AdjRIBOut
- type ClientManager
- func (c *ClientManager) ClientCount() uint64
- func (c *ClientManager) Clients() []RouteTableClient
- func (c *ClientManager) GetOptions(client RouteTableClient) ClientOptions
- func (c *ClientManager) RegisterWithOptions(client RouteTableClient, opt ClientOptions)
- func (c *ClientManager) Unregister(client RouteTableClient) bool
- type ClientManagerMaster
- type ClientOptions
- type ContributingASNs
- type RIB
- type RTMockClient
- func (m *RTMockClient) AddPath(pfx *net.Prefix, p *route.Path) error
- func (m *RTMockClient) AddPathInitialDump(pfx *net.Prefix, p *route.Path) error
- func (m *RTMockClient) ClientCount() uint64
- func (m *RTMockClient) Dispose()
- func (m *RTMockClient) Dump() []*route.Route
- func (m *RTMockClient) EndOfRIB()
- func (m *RTMockClient) Flush()
- func (m *RTMockClient) RefreshRoute(*net.Prefix, []*route.Path)
- func (m *RTMockClient) Register(RouteTableClient)
- func (m *RTMockClient) RegisterWithOptions(RouteTableClient, ClientOptions)
- func (m *RTMockClient) RemovePath(pfx *net.Prefix, p *route.Path) bool
- func (m *RTMockClient) Removed() []*RemovePathParams
- func (m *RTMockClient) ReplaceFilterChain(filter.Chain)
- func (m *RTMockClient) ReplacePath(*net.Prefix, *route.Path, *route.Path)
- func (m *RTMockClient) RouteCount() int64
- func (m *RTMockClient) Unregister(RouteTableClient)
- func (m *RTMockClient) UpdateNewClient(client RouteTableClient) error
- type RemovePathParams
- type RouteTableClient
- type RoutingTable
- func (rt *RoutingTable) AddPath(pfx *net.Prefix, p *route.Path) error
- func (rt *RoutingTable) Dump() []*route.Route
- func (rt *RoutingTable) Get(pfx *net.Prefix) *route.Route
- func (rt *RoutingTable) GetLonger(pfx *net.Prefix) (res []*route.Route)
- func (rt *RoutingTable) GetRouteCount() int64
- func (rt *RoutingTable) LPM(pfx *net.Prefix) (res []*route.Route)
- func (rt *RoutingTable) RemovePath(pfx *net.Prefix, p *route.Path)
- func (rt *RoutingTable) RemovePfx(pfx *net.Prefix) []*route.Path
- func (rt *RoutingTable) ReplacePath(pfx *net.Prefix, p *route.Path) []*route.Path
- type SessionAttrs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ShouldPropagateUpdate ¶
ShouldPropagateUpdate performs some default checks and returns if an route update should be propagated to a neighbor
Types ¶
type AdjRIBIn ¶
type AdjRIBIn interface { AdjRIB Flush() }
AdjRIBIn is the interface any AdjRIBIn must implement
type AdjRIBOut ¶
type AdjRIBOut interface { AdjRIB EndOfRIB() AddPathInitialDump(pfx *net.Prefix, path *route.Path) error ReplacePath(*net.Prefix, *route.Path, *route.Path) RefreshRoute(*net.Prefix, []*route.Path) // A call to Dispose() signals that no more updates are to be expected from the RIB the client is registered to. Dispose() }
AdjRIBOut is the interface any AdjRIBOut must implement
type ClientManager ¶
type ClientManager struct {
// contains filtered or unexported fields
}
ClientManager manages clients of routing tables (observer pattern)
func NewClientManager ¶
func NewClientManager(master ClientManagerMaster) *ClientManager
NewClientManager creates and initializes a new client manager
func (*ClientManager) ClientCount ¶
func (c *ClientManager) ClientCount() uint64
ClientCount gets the number of registred clients
func (*ClientManager) Clients ¶
func (c *ClientManager) Clients() []RouteTableClient
Clients returns a list of registered clients
func (*ClientManager) GetOptions ¶
func (c *ClientManager) GetOptions(client RouteTableClient) ClientOptions
GetOptions gets the options for a registered client
func (*ClientManager) RegisterWithOptions ¶
func (c *ClientManager) RegisterWithOptions(client RouteTableClient, opt ClientOptions)
RegisterWithOptions registers a client with options for updates
func (*ClientManager) Unregister ¶
func (c *ClientManager) Unregister(client RouteTableClient) bool
Unregister unregisters a client
type ClientManagerMaster ¶
type ClientManagerMaster interface {
UpdateNewClient(RouteTableClient) error
}
type ClientOptions ¶
ClientOptions represents options for a client
func (*ClientOptions) GetMaxPaths ¶
func (c *ClientOptions) GetMaxPaths(ecmpPaths uint) uint
GetMaxPaths calculates the maximum amount of wanted paths given that ecmpPaths paths exist
type ContributingASNs ¶
type ContributingASNs struct {
// contains filtered or unexported fields
}
ContributingASNs contains a list of contributing ASN to a LocRIB to check ASPaths for possible routing loops.
func NewContributingASNs ¶
func NewContributingASNs() *ContributingASNs
NewContributingASNs creates a list of contributing ASNs to a LocRIB for routing loop prevention.
func (*ContributingASNs) Add ¶
func (c *ContributingASNs) Add(asn uint32)
Add a new ASN to the list of contributing ASNs or add the ref count of an existing one.
func (*ContributingASNs) IsContributingASN ¶
func (c *ContributingASNs) IsContributingASN(asn uint32) bool
IsContributingASN checks if a given ASN is part of the contributing ASNs
func (*ContributingASNs) Remove ¶
func (c *ContributingASNs) Remove(asn uint32)
Remove a ASN to the list of contributing ASNs or decrement the ref count of an existing one.
type RTMockClient ¶
type RTMockClient struct { FakeRouteCount int64 // contains filtered or unexported fields }
func NewRTMockClient ¶
func NewRTMockClient() *RTMockClient
func (*RTMockClient) AddPathInitialDump ¶
func (*RTMockClient) ClientCount ¶
func (m *RTMockClient) ClientCount() uint64
func (*RTMockClient) Dispose ¶
func (m *RTMockClient) Dispose()
func (*RTMockClient) Dump ¶
func (m *RTMockClient) Dump() []*route.Route
Dump is here to fulfill an interface
func (*RTMockClient) EndOfRIB ¶ added in v0.1.1
func (m *RTMockClient) EndOfRIB()
func (*RTMockClient) Flush ¶
func (m *RTMockClient) Flush()
func (*RTMockClient) RefreshRoute ¶
func (m *RTMockClient) RefreshRoute(*net.Prefix, []*route.Path)
func (*RTMockClient) Register ¶
func (m *RTMockClient) Register(RouteTableClient)
func (*RTMockClient) RegisterWithOptions ¶
func (m *RTMockClient) RegisterWithOptions(RouteTableClient, ClientOptions)
func (*RTMockClient) RemovePath ¶
RemovePath removes the path for prefix `pfx`
func (*RTMockClient) Removed ¶
func (m *RTMockClient) Removed() []*RemovePathParams
func (*RTMockClient) ReplaceFilterChain ¶
func (m *RTMockClient) ReplaceFilterChain(filter.Chain)
func (*RTMockClient) ReplacePath ¶
func (*RTMockClient) RouteCount ¶
func (m *RTMockClient) RouteCount() int64
func (*RTMockClient) Unregister ¶
func (m *RTMockClient) Unregister(RouteTableClient)
func (*RTMockClient) UpdateNewClient ¶
func (m *RTMockClient) UpdateNewClient(client RouteTableClient) error
type RouteTableClient ¶
type RouteTableClient interface { AddPath(pfx *net.Prefix, path *route.Path) error AddPathInitialDump(pfx *net.Prefix, path *route.Path) error EndOfRIB() RemovePath(*net.Prefix, *route.Path) bool ReplacePath(*net.Prefix, *route.Path, *route.Path) RefreshRoute(*net.Prefix, []*route.Path) // A call to Dispose() signals that no more updates are to be expected from the RIB the client is registered to. Dispose() }
RouteTableClient is the interface that every route table client must implement
type RoutingTable ¶
type RoutingTable struct {
// contains filtered or unexported fields
}
RoutingTable is a binary trie that stores prefixes and their paths
func NewRoutingTable ¶
func NewRoutingTable() *RoutingTable
NewRoutingTable creates a new routing table
func (*RoutingTable) Dump ¶
func (rt *RoutingTable) Dump() []*route.Route
Dump dumps all routes in table rt into a slice
func (*RoutingTable) Get ¶
func (rt *RoutingTable) Get(pfx *net.Prefix) *route.Route
Get gets the route for pfx from the LPM
func (*RoutingTable) GetLonger ¶
func (rt *RoutingTable) GetLonger(pfx *net.Prefix) (res []*route.Route)
GetLonger gets prefix pfx and all it's more specifics from the LPM
func (*RoutingTable) GetRouteCount ¶
func (rt *RoutingTable) GetRouteCount() int64
GetRouteCount gets the amount of stored routes
func (*RoutingTable) LPM ¶
func (rt *RoutingTable) LPM(pfx *net.Prefix) (res []*route.Route)
LPM performs a longest prefix match for pfx on lpm
func (*RoutingTable) RemovePath ¶
func (rt *RoutingTable) RemovePath(pfx *net.Prefix, p *route.Path)
RemovePath removes a path from the trie
func (*RoutingTable) RemovePfx ¶
func (rt *RoutingTable) RemovePfx(pfx *net.Prefix) []*route.Path
RemovePfx removes all paths for prefix `pfx`
func (*RoutingTable) ReplacePath ¶
ReplacePath replaces all paths for prefix `pfx` with path `p`
type SessionAttrs ¶
type SessionAttrs struct { // RouterID is the ID of the local router RouterID uint32 // PeerIP is the IP address of the neighbor PeerIP *bnet.IP // LocalIP is the local address of the BGP TCP connection LocalIP *bnet.IP // Type is the type / protocol used for routing inforation communitation Type uint8 // IBGP returns if local ASN is equal to remote ASN IBGP bool // Local ASN of session LocalASN uint32 // Peer ASN for this neighbor PeerASN uint32 // RouteServerClient indicates if the peer is a route server client RouteServerClient bool // RouteReflectorClient indicates if the peer is a route reflector client RouteReflectorClient bool // ClusterID is our route reflectors clusterID ClusterID uint32 // AddPathRX indicates if AddPath receive is active AddPathRX bool // AddPathTX indicates if AddPath send is active AddPathTX bool // RouterIP indicates the IP address of the remote BMP peer (only for BMP) RouterIP bnet.IP // PeerRoleEnabled indicates if Peer Role validation is activated locally PeerRoleEnabled bool // PeerRoleStrictMode indicates if strict Peer Role validation is activated PeerRoleStrictMode bool // PeerRoleLocal denotes our role PeerRoleLocal uint8 // PeerRoleAdvByPeer indicates if the peer did advertise the PeerRole capability PeerRoleAdvByPeer bool // PeerRoleRemote denotes the peers role PeerRoleRemote uint8 }
SessionAttrs represents the attributes identifying a neighbor relationship