netcfg

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 26 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 netcfg applies the controller's mesh configuration on a node (§8): the WireGuard interface and peers, routes for container subnets, the Docker network "syncloud" with the node's subnet, and the nftables rules that keep container traffic un-NATed inside the mesh and masqueraded to the internet.

Index

Constants

View Source
const (
	// Interface is the WireGuard interface (not "wg0", which users often have).
	Interface = "wg-syncloud"
	// Bridge is the Linux bridge of the Docker network Network.
	Bridge = "syncloud0"
	// Network is the Docker network every task joins.
	Network = "syncloud"
	// ProbePort is a TCP port on the node's mesh address used to measure RTT.
	ProbePort = "7444"
)
View Source
const DNSZone = "syncloud.internal"

DNSZone is the internal zone served to tasks (§8.1).

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager applies the latest NetworkConfig and reports status.

func New

func New(dataDir string, d *docker.Client, log *slog.Logger, enabled bool) (*Manager, error)

New loads (or creates) the node's WireGuard key. With enabled false the manager does nothing and the node stays out of the mesh.

func (*Manager) Confirm

func (m *Manager) Confirm(gen uint64)

Confirm marks the pending firewall as good (the controller still hears us).

func (*Manager) Kick

func (m *Manager) Kick()

Kick re-applies soon, e.g. when a container starts and must join its security sets.

func (*Manager) PublicKey

func (m *Manager) PublicKey() string

PublicKey is sent in Hello ("" when networking is disabled).

func (*Manager) Ready

func (m *Manager) Ready() error

Ready reports whether the "syncloud" Docker network exists with this node's subnet, so tasks can be started. Always nil when disabled.

func (*Manager) Run

func (m *Manager) Run(ctx context.Context)

Run applies configs as they arrive, re-applies every 30s to repair drift, and probes peers. It returns when ctx ends.

func (*Manager) Status

func (m *Manager) Status() *agentv1.NetworkStatus

Status is reported in every heartbeat (nil when disabled).

func (*Manager) Submit

func (m *Manager) Submit(cfg *agentv1.NetworkConfig)

Submit queues cfg; the newest config wins.

func (*Manager) SubmitDiscovery

func (m *Manager) SubmitDiscovery(d *agentv1.Discovery)

SubmitDiscovery installs a new service directory: DNS answers change at once, VIP rules on the next apply (immediately).

Jump to

Keyboard shortcuts

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