Documentation
¶
Overview ¶
Package modedetect suggests where this instance runs, from local facts only.
Index ¶
Constants ¶
const ( ModeLaptop = "laptop" ModeHomelab = "homelab" ModeVPSSingle = "vps-single" ModeVPSMulti = "vps-multi" ModeTeamK8s = "team-k8s" ModeIaC = "iac" )
Modes mirrors UI_MODES in web/src/lib/uiMode.ts.
const ( High = "high" Medium = "medium" Low = "low" )
Confidence levels. Low never carries a mode.
const ( ReasonManagedVM = "managed_vm" ReasonLocalMode = "local_mode" ReasonKubernetes = "kubernetes" ReasonGitSync = "git_sync" ReasonSeveralPublic = "several_public" ReasonSeveralHome = "several_home" ReasonOnePublic = "one_public" ReasonOneCloud = "one_cloud" ReasonOneHome = "one_home" ReasonNotEnoughSignal = "unsure" )
Reason codes, translated by the dashboard.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Facts ¶
type Facts struct {
ManagedVM bool
LocalMode bool
// Agents is the number of joined servers besides the control plane host.
Agents int
K8sClusters int
GitSyncs int
// PublicIPv4 is true when an interface holds a public IPv4 address.
PublicIPv4 bool
// HomeLAN is true when every private IPv4 address is in 192.168.0.0/16.
HomeLAN bool
// CloudHost is true when the machine's own firmware names a cloud provider.
CloudHost bool
}
Facts are what the server can see without asking anything outside itself.
type Interface ¶
Interface is one network interface name with its addresses.
func HostInterfaces ¶
func HostInterfaces() []Interface
HostInterfaces reads the local interface table.
type Suggestion ¶
Suggestion is a mode guess. An empty Mode means nothing should be preselected.
func Detect ¶
func Detect(f Facts) Suggestion
Detect ranks the facts: what the instance is, then how it is used, then its network.