Documentation
¶
Overview ¶
Package meshpath answers one question for the ingress and application controllers: can this control plane reach a remote node's published ports over the WireGuard mesh right now, and on which address.
Index ¶
Constants ¶
const ( DefaultDatabasePortMin = 21000 DefaultDatabasePortMax = 21999 )
Default range for database mesh ports, overridable with APP_MESH_DB_PORT_MIN and APP_MESH_DB_PORT_MAX.
const StaleAfter = 3 * time.Minute
StaleAfter is how old a WireGuard handshake may be before the path counts as down. Persistent keepalive keeps a healthy peer well inside it.
Variables ¶
This section is empty.
Functions ¶
func DatabasePortRange ¶
DatabasePortRange reads the database mesh port range, falling back to the defaults when either bound is unset or the pair is invalid.
func ValidateBindIP ¶
ValidateBindIP is the single guard every mesh bind goes through: only a concrete unicast address may be bound, never a wildcard, loopback or multicast one, so a mesh bind can never widen a port to every interface.
Types ¶
type EndpointResolver ¶
EndpointResolver reports the mesh address services on a node are published on and dialed at, the control plane's own node included.
type Path ¶
type Path struct {
// Local is true for the control plane's own node, which needs no mesh.
Local bool
// Usable is true when Address can be dialed and bound to right now.
Usable bool
// Address is the node's mesh IP, set only when Usable.
Address string
// NoMesh is true when the node has no mesh to reach it over (mesh off, or
// the node never joined), so callers may use its ordinary address.
NoMesh bool
// Reason says why the path is not usable, with the next action.
Reason string
}
Path is the mesh route from this control plane to one node.
type StatusReader ¶
StatusReader is the slice of network.Mesh the tracker needs.
type Tracker ¶
type Tracker struct {
// contains filtered or unexported fields
}
Tracker derives Paths from the control plane's live WireGuard device.
func NewTracker ¶
func NewTracker(localID string, mesh StatusReader, nodes NodeStore) *Tracker
NewTracker builds a Tracker. mesh may be nil when mesh networking is off.
func (*Tracker) Endpoint ¶
Endpoint is Path, except the control plane's own node also resolves to its mesh address, since remote nodes reach services there over the mesh.