Documentation ¶
Index ¶
- func ShouldPropagateUpdate(pfx *net.Prefix, p *route.Path, n *Neighbor) bool
- 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 ClientOptions
- type ContributingASNs
- type Neighbor
- type RIB
- type RTMockClient
- func (m *RTMockClient) AddPath(pfx *net.Prefix, p *route.Path) error
- func (m *RTMockClient) ClientCount() uint64
- func (m *RTMockClient) Dump() []*route.Route
- 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
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClientManager ¶
type ClientManager struct {
// contains filtered or unexported fields
}
ClientManager manages clients of routing tables (observer pattern)
func NewClientManager ¶
func NewClientManager(master RouteTableClient) *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 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 Neighbor ¶
type Neighbor struct { // Address is the IPv4 address of the neighbor as integer representation Address *bnet.IP // Local address is the local address of the BGP TCP connection LocalAddress *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 // 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 }
Neighbor represents the attributes identifying a neighbor relationship
type RTMockClient ¶
type RTMockClient struct { FakeRouteCount int64 // contains filtered or unexported fields }
func NewRTMockClient ¶
func NewRTMockClient() *RTMockClient
func (*RTMockClient) ClientCount ¶
func (m *RTMockClient) ClientCount() uint64
func (*RTMockClient) Dump ¶
func (m *RTMockClient) Dump() []*route.Route
Dump is here to fulfill an interface
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(*net.Prefix, *route.Path) error RemovePath(*net.Prefix, *route.Path) bool ReplacePath(*net.Prefix, *route.Path, *route.Path) UpdateNewClient(RouteTableClient) error Register(RouteTableClient) Unregister(RouteTableClient) RouteCount() int64 ClientCount() uint64 Dump() []*route.Route ReplaceFilterChain(filter.Chain) RefreshRoute(*net.Prefix, []*route.Path) }
RouteTableClient is the interface that every type of RIB 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`