Documentation
¶
Overview ¶
Package meshutil contains helpers for computing networking information from the mesh.
Package peers contains an interface for managing nodes in the mesh.
Index ¶
- Variables
- func FeaturePortEqual(a, b *v1.FeaturePort) bool
- func FeaturePortsEqual(a, b []*v1.FeaturePort) bool
- func MeshNodesEqual(a, b *v1.MeshNode) bool
- func WireGuardPeerEqual(a, b *v1.WireGuardPeer) bool
- func WireGuardPeersEqual(a, b []*v1.WireGuardPeer) bool
- func WireGuardPeersFor(ctx context.Context, st storage.MeshStorage, peerID string) ([]*v1.WireGuardPeer, error)
- type FilterFunc
- type Peers
- type Resolver
- type SortedWireGuardPeers
Constants ¶
This section is empty.
Variables ¶
var ErrNodeNotFound = errors.New("node not found")
ErrNodeNotFound is returned when a node is not found.
Functions ¶
func FeaturePortEqual ¶ added in v0.6.5
func FeaturePortEqual(a, b *v1.FeaturePort) bool
FeaturePortEqual compares two feature ports for equality.
func FeaturePortsEqual ¶ added in v0.6.5
func FeaturePortsEqual(a, b []*v1.FeaturePort) bool
FeaturePortsEqual compares two feature ports for equality.
func MeshNodesEqual ¶ added in v0.6.5
MeshNodesEqual compares two mesh nodes for equality.
func WireGuardPeerEqual ¶ added in v0.6.5
func WireGuardPeerEqual(a, b *v1.WireGuardPeer) bool
WireGuardPeerEqual compares two WireGuard peers for equality.
func WireGuardPeersEqual ¶ added in v0.6.5
func WireGuardPeersEqual(a, b []*v1.WireGuardPeer) bool
WireGuardPeersEqual recurses the WireGuard peers and compares them for equality. Both lists are sorted by ID first.
func WireGuardPeersFor ¶ added in v0.6.5
func WireGuardPeersFor(ctx context.Context, st storage.MeshStorage, peerID string) ([]*v1.WireGuardPeer, error)
WireGuardPeersFor returns the WireGuard peers for the given peer ID. Peers are filtered by network ACLs.
Types ¶
type FilterFunc ¶ added in v0.4.0
FilterFunc is a function that can be used to filter responses returned by a resolver.
type Peers ¶
type Peers interface {
// Resolver returns a resolver backed by the storage
// of this instance.
Resolver() Resolver
// Graph returns the graph of nodes.
Graph() peergraph.Graph
// Put creates or updates a node.
Put(ctx context.Context, n *v1.MeshNode) error
// Get gets a node by ID.
Get(ctx context.Context, id string) (peergraph.MeshNode, error)
// GetByPubKey gets a node by their public key.
GetByPubKey(ctx context.Context, key crypto.PublicKey) (peergraph.MeshNode, error)
// Delete deletes a node.
Delete(ctx context.Context, id string) error
// List lists all nodes.
List(ctx context.Context) ([]peergraph.MeshNode, error)
// ListIDs lists all node IDs.
ListIDs(ctx context.Context) ([]string, error)
// ListPublicNodes lists all public nodes.
ListPublicNodes(ctx context.Context) ([]peergraph.MeshNode, error)
// ListByZoneID lists all nodes in a zone.
ListByZoneID(ctx context.Context, zoneID string) ([]peergraph.MeshNode, error)
// ListByFeature lists all nodes with a given feature.
ListByFeature(ctx context.Context, feature v1.Feature) ([]peergraph.MeshNode, error)
// AddEdge adds an edge between two nodes.
PutEdge(ctx context.Context, edge *v1.MeshEdge) error
// RemoveEdge removes an edge between two nodes.
RemoveEdge(ctx context.Context, from, to string) error
// DrawGraph draws the graph of nodes to the given Writer.
DrawGraph(ctx context.Context, w io.Writer) error
}
Peers is the peers interface.
type Resolver ¶ added in v0.4.0
type Resolver interface {
// NodeIDResolver returns a resolver that resolves node addresses by node ID.
NodeIDResolver() transport.NodeIDResolver
// FeatureResolver returns a resolver that resolves node addresses by feature.
FeatureResolver(filterFn ...FilterFunc) transport.FeatureResolver
}
Resolver provides facilities for creating various transport.Resolver instances.
func NewResolver ¶ added in v0.4.0
func NewResolver(st storage.MeshStorage) Resolver
NewResolver returns a new Resolver instance.
type SortedWireGuardPeers ¶ added in v0.6.5
type SortedWireGuardPeers []*v1.WireGuardPeer
SortedWireGuardPeers implements a sort.Interface for []*v1.WireGuardPeer.
func (SortedWireGuardPeers) Len ¶ added in v0.6.5
func (s SortedWireGuardPeers) Len() int
func (SortedWireGuardPeers) Less ¶ added in v0.6.5
func (s SortedWireGuardPeers) Less(i, j int) bool
func (SortedWireGuardPeers) Swap ¶ added in v0.6.5
func (s SortedWireGuardPeers) Swap(i, j int)