Documentation
¶
Overview ¶
Package config manages proximo's persisted user configuration and the on-disk paths it uses (TLS material, the embedded stack, etc.).
Index ¶
- Constants
- func AddressHeld(addr string, addrs []net.Addr) bool
- func DataDir() (string, error)
- func Dir() (string, error)
- func HomePath() (string, error)
- func InventoryDir() (string, error)
- func NormalizeMachine(raw string) (string, error)
- func NormalizePeerSuffix(raw string) (string, error)
- func NormalizeTLD(raw string) (string, error)
- func ParseAddress(raw string) (string, error)
- func PeerSuffixWarning(suffix string) string
- func RemoveHome() error
- func SubDir(name string) (string, error)
- func TLDWarning(tld string) string
- type Config
Constants ¶
const ( // DefaultTLD is the default top-level domain used for local routing. // ".test" is reserved by RFC 6761 and never collides with mDNS (".local"). DefaultTLD = "test" // DNSPort is the loopback UDP host port the DNS server is published on. A // high port avoids any privileged bind to :53; 5353 is intentionally // avoided because macOS mDNSResponder (Bonjour) already binds it. DNSPort = 5354 // PeerDNSPort is the port the peer DNS service answers on, on this // machine's mesh address — the port a mesh routes the peer subtree to. It // shares the loopback port's number, on another address. PeerDNSPort = 5354 // PeerRelayPort is the port the peer relay accepts on, on this machine's // mesh address: the one a colleague's browser connects to. PeerRelayPort = 443 // ObsHubPort is the loopback TCP host port the metrics hub is published on // (only when the observability profile is active) so the one-shot bootstrap // can reach the hub API directly, without depending on DNS/Traefik/TLS being // converged yet. A high, uncommon port avoids colliding with the hub's // default 8090. ObsHubPort = 48090 // InspectAPIPort is the loopback TCP host port the Inspection hop publishes // its read API on, so `proximo errors` can reach it. The proxy side of the // hop is never published: only Traefik talks to it, over the stack network. InspectAPIPort = 48091 // WatcherAPIPort is the loopback TCP host port the watcher publishes its // Incident read API on, so `proximo errors` can ask what the runtime declared // about a container. The watcher has no other listener: it is the one stack // service holding both the Docker socket and the event subscription, and this // is the only way anything on the host reads what it observed. WatcherAPIPort = 48092 )
const AddressNotHeld = "is held by no interface of this machine"
AddressNotHeld is the one cause of a failed peer bind proximo can see, worded once for every place that reports it.
const AddressRule = "" /* 176-byte string literal not displayed */
AddressRule is printed on every `config address`: the held-by-an-interface check catches a typo or a stale value, never a wrong-but-local address.
const ( // InventorySubdir is the inventory's directory under DataDir; the stack's // compose file mounts __DATADIR__/inventory, the same name. InventorySubdir = "inventory" )
const MachineRule = "" /* 186-byte string literal not displayed */
MachineRule is printed on every `config machine`, unconditionally: the one intervention available for a value whose fault cannot be detected.
Variables ¶
This section is empty.
Functions ¶
func AddressHeld ¶ added in v0.16.0
AddressHeld reports whether one of addrs (as net.InterfaceAddrs returns them) is exactly addr. Exact, never subnet membership: a mesh range is typically a /8, and membership in it asserts almost nothing.
func DataDir ¶ added in v0.3.0
DataDir returns (creating if needed) the directory holding the stack's bind-mounted runtime data (Traefik routes/certs, Beszel metrics). It is the host side of the data bind mounts the materialized compose declares.
func HomePath ¶ added in v0.4.0
HomePath resolves the state-home path ($HOME/.proximo) without creating it, so callers that only need the location (RemoveHome, `config ca-path`) don't trigger side effects.
func InventoryDir ¶ added in v0.16.0
InventoryDir resolves, without creating it, the directory the watcher keeps the effective-route inventory in. It is a directory rather than the file because the file is replaced by rename: a consumer bind-mounting the file itself would keep the first inode it saw. `config inventory-dir` prints it.
func NormalizeMachine ¶ added in v0.16.0
NormalizeMachine validates a machine label: one DNS label of [a-z0-9-], lowercased, at most 63 octets. Whether it names a person is not something a machine can judge, so it is not checked — MachineRule is printed instead.
func NormalizePeerSuffix ¶ added in v0.16.0
NormalizePeerSuffix validates a Peer suffix: at least two DNS labels of [a-z0-9-], lowercased, leading and trailing dots stripped. NormalizeTLD does not fit: it accepts exactly one label.
func NormalizeTLD ¶
NormalizeTLD validates and normalizes a user-supplied TLD: it strips a leading dot, lowercases, enforces a single DNS label, and rejects reserved values.
func ParseAddress ¶ added in v0.16.0
ParseAddress validates the address proximo answers peer names with.
func PeerSuffixWarning ¶ added in v0.16.0
PeerSuffixWarning returns advice for a suffix whose right-most label nobody reserved, or "" for a reserved one. It never rejects, as TLDWarning does not.
func RemoveHome ¶ added in v0.3.0
func RemoveHome() error
RemoveHome deletes the entire ~/.proximo state home (CA, secret, config, materialized stack, and bind-mounted data). uninstall calls it after the stack is down and host trust/resolver are reversed, for a full reversal. It resolves the path without creating it.
func TLDWarning ¶ added in v0.12.0
TLDWarning returns advice for a TLD with no reservation behind it, or "" for a reserved one. It never rejects: the choice is the user's, but a label someone else may own shadows every public name under it.
Types ¶
type Config ¶
type Config struct {
// TLD is the top-level domain routed to the local proximo (without a dot).
TLD string `json:"tld"`
// Machine is this machine's label in its peer names.
Machine string `json:"machine,omitempty"`
// PeerSuffix is the multi-label suffix every peer name lives under.
PeerSuffix string `json:"peer_suffix,omitempty"`
// Address is the address proximo answers this machine's peer names with:
// the machine's own address on the mesh.
Address string `json:"address,omitempty"`
// TeamRoot is the absolute path of the team root certificate (PEM).
TeamRoot string `json:"team_root,omitempty"`
// TeamRootTrusted is the SHA-1 fingerprint of the team root last installed
// in the trust stores: what uninstall removes, and what a replaced root
// takes out first, whether or not TeamRoot still names that file.
TeamRootTrusted string `json:"team_root_trusted,omitempty"`
// MeshRemedy overrides the Remedy the mesh Check offers. Stored verbatim.
MeshRemedy string `json:"mesh_remedy,omitempty"`
}
Config holds the user-configurable settings persisted to disk.