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
- type Manager
- func (m *Manager) Confirm(gen uint64)
- func (m *Manager) Kick()
- func (m *Manager) PublicKey() string
- func (m *Manager) Ready() error
- func (m *Manager) Run(ctx context.Context)
- func (m *Manager) Status() *agentv1.NetworkStatus
- func (m *Manager) Submit(cfg *agentv1.NetworkConfig)
- func (m *Manager) SubmitDiscovery(d *agentv1.Discovery)
Constants ¶
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" )
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 ¶
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 ¶
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) Ready ¶
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 ¶
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 ¶
SubmitDiscovery installs a new service directory: DNS answers change at once, VIP rules on the next apply (immediately).