table

package
v1.44.3 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package table provides a Routing Table implementation which allows looking up the peer that should be used to route a given IP address.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RoutingTable

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

RoutingTable provides a mapping from IP addresses to peers identified by their public node key. It is used to find the peer that should be used to route a given IP address. It is immutable after creation.

It is safe for concurrent use.

func (*RoutingTable) Lookup

func (t *RoutingTable) Lookup(ip netip.Addr) (_ key.NodePublic, ok bool)

Lookup returns the peer that would be used to route the given IP address. If no peer is found, Lookup returns the zero value.

type RoutingTableBuilder

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

RoutingTableBuilder is a builder for a RoutingTable. It is not safe for concurrent use.

func (*RoutingTableBuilder) Build

func (t *RoutingTableBuilder) Build() *RoutingTable

Build returns a RoutingTable that can be used to look up peers. Build resets the RoutingTableBuilder to its zero value.

func (*RoutingTableBuilder) InsertOrReplace

func (t *RoutingTableBuilder) InsertOrReplace(peer key.NodePublic, pfxs ...netip.Prefix)

InsertOrReplace inserts the given peer and prefixes into the routing table.

func (*RoutingTableBuilder) Remove

func (t *RoutingTableBuilder) Remove(peer key.NodePublic)

Remove removes the given peer from the routing table.

Jump to

Keyboard shortcuts

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