mesh

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package mesh is the VM side of dynamic WireGuard mesh updates. weft publishes a VM's full desired wg0 config on the event bus whenever the mesh membership changes; the VM subscribes and re-applies it (replace-set, idempotent). State is pushed whole rather than diffed, so a missed message self-heals on the next publish.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleMessage

func HandleMessage(data []byte, apply ApplyFunc) error

HandleMessage decodes a published mesh update and applies it. Pure aside from the injected apply, so the decode/validate path is testable without a kernel or a broker.

func Subject

func Subject(vmID string) string

Subject is the per-VM event-bus subject weft publishes mesh updates on.

Types

type ApplyFunc

type ApplyFunc func(*pod.WireGuard) error

ApplyFunc applies a desired WireGuard config to the kernel. The real implementation is network.ApplyWireGuard (Linux); tests inject a stub.

type Subscriber

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

Subscriber listens for this VM's mesh updates and applies each one.

func NewSubscriber

func NewSubscriber(nc *nats.Conn, vmID string, apply ApplyFunc, logger *log.Logger) *Subscriber

NewSubscriber builds a Subscriber for vmID that applies updates via apply.

func (*Subscriber) Start

func (s *Subscriber) Start() (*nats.Subscription, error)

Start subscribes to the VM's mesh subject. The returned subscription is live until unsubscribed or the connection drops.

Jump to

Keyboard shortcuts

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