Documentation
¶
Overview ¶
Package wireguard generates per-node WireGuard configuration for a cluster mesh. The server is the topology brain: given each node's public key, mesh IP, and (optional) public endpoint, it emits a wg0.conf for a target node with one Peer per other node, AllowedIPs pinned to each peer's /32 (so a node can only impersonate its own mesh IP), and a keepalive so NAT-bound nodes hold the tunnel open. The node's private key never reaches the server; the emitted config carries the PrivateKeyPlaceholder token, which the agent substitutes from its local key file at apply time.
Index ¶
Constants ¶
const PrivateKeyPlaceholder = "__LATTICE_WG_PRIVATE_KEY__"
PrivateKeyPlaceholder is replaced by the agent with the node's local private key when the config is applied. It is safe to display in an approval diff.
Variables ¶
This section is empty.
Functions ¶
func BuildMesh ¶
BuildMesh computes the interface and peer list for target from the cluster's nodes. Nodes without a public key or mesh IP, and the target itself, are skipped. listenPort overrides the target's reported port when > 0.
func GenerateConfig ¶
GenerateConfig renders a wg0.conf. It validates keys and the interface name so attacker-influenced metadata cannot break out of the config structure.