netstatus

package
v3.0.0-rc72 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package netstatus holds what the setup of a network made on a node: the device it set up, the part of the network the node hands out, how the node reaches each other node of the network, and what failed. Each node records it for itself, from the decisions its setup made on what only the node knows, as its interface addresses, and publishes it in the cluster data.

Index

Constants

View Source
const (
	ViaTunnel = "tunnel"
	ViaRoute  = "route"
	ViaVXLAN  = "vxlan"
)

The ways a node reaches a peer of a network.

Variables

View Source
var StatusData = NewData()

StatusData holds the statuses of the networks on every node the daemon knows.

Functions

func Load

func Load(dir string) (map[string]Status, error)

Load returns the statuses saved in dir, by network name. A file that does not parse is skipped.

func Remove

func Remove(dir, name string) error

Remove removes the status of the network name from dir, absent being no error.

func Save

func Save(dir, name string, st Status) error

Save writes the status of the network name in dir, through a temporary file renamed in place.

Types

type Data

type Data struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Data holds the statuses of the networks of the cluster nodes.

func NewData

func NewData() *Data

NewData returns an empty holder of network statuses.

func (*Data) GetAll

func (t *Data) GetAll() []Element

GetAll returns the statuses of every network on every node.

func (*Data) GetByNode

func (t *Data) GetByNode(node string) []Element

GetByNode returns the statuses of the networks on node.

func (*Data) Set

func (t *Data) Set(name, node string, v *Status)

Set records the status of the network name on node.

func (*Data) Unset

func (t *Data) Unset(name, node string)

Unset forgets the status of the network name on node.

type Element

type Element struct {
	Name  string
	Node  string
	Value *Status
}

Element is the status of a network on a node.

type Peer

type Peer struct {
	// Nodename is the name of the peer node.
	Nodename string `json:"nodename"`

	// Local is the address of this node the network reaches the peer
	// from, and Remote the address of the peer it reaches.
	Local  net.IP `json:"local"`
	Remote net.IP `json:"remote"`

	// Subnet is the part of the network the peer hands out.
	Subnet string `json:"subnet"`

	// Tunnel is the device of the tunnel carrying the network to the
	// peer, empty when the network is routed to it.
	Tunnel string `json:"tunnel"`

	// TunnelMode is the mode of the tunnel, as ipip, ip6ip6 or gre,
	// empty when the peer is reached by no tunnel.
	TunnelMode string `json:"tunnel_mode"`

	// Via says how the node reaches the peer: ViaTunnel, ViaRoute or
	// ViaVXLAN.
	Via string `json:"via"`

	// Error is why the setup could not reach the peer, empty when it
	// did.
	Error string `json:"error,omitempty"`
}

Peer is another node of a network, as this node reaches it.

type Port

type Port struct {
	// Name is the port the configuration names.
	Name string `json:"name"`

	// Dev is the device enslaved: the port, or the vlan interface the
	// setup created on it.
	Dev string `json:"dev"`

	// Error is why the setup could not enslave it, empty when it did.
	Error string `json:"error,omitempty"`
}

Port is a device of the node the setup of a network enslaved, or failed to.

type Status

type Status struct {
	// Type is the type of the network.
	Type string `json:"type"`

	// Network is the address range of the network, empty for a
	// network with no address, as a l2_bridge.
	Network string `json:"network"`

	// Dev is the device of the node the network is on, as its bridge,
	// empty for a network on none.
	Dev string `json:"dev,omitempty"`

	// Subnet is the part of the network this node hands out, empty
	// when the node hands out the whole network, or none of it.
	Subnet string `json:"subnet,omitempty"`

	// Peers are the other nodes of the network the node reaches
	// itself, by a route or a tunnel, as the setup reached them.
	Peers []Peer `json:"peers,omitempty"`

	// Ports are the devices of the node the setup enslaved to the
	// device of the network, as the ports of a l2_bridge.
	Ports []Port `json:"ports,omitempty"`

	// Skipped says why the setup left the network alone, as a
	// network disabled.
	Skipped string `json:"skipped,omitempty"`

	// Error is the failure of the setup, empty when it succeeded.
	Error string `json:"error,omitempty"`

	// AppliedAt is when the setup ended, by the clock of the node.
	AppliedAt time.Time `json:"applied_at"`
}

Status is what the last setup of a network made on a node.

func (*Status) DeepCopy

func (t *Status) DeepCopy() *Status

DeepCopy returns a copy of t sharing nothing with it.

Jump to

Keyboard shortcuts

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