Documentation
¶
Index ¶
- Constants
- func Gather(ctx context.Context, exec executor.Executor) model.Device
- func GatherWSL(ctx context.Context, exec executor.Executor) *model.WSLInfo
- func ID(dev model.Device) string
- func IDForGuest(dev model.Device, hostDeviceID, distroID string) string
- func ResetIDCache()
- func SerialNumber(ctx context.Context, exec executor.Executor) string
- func SystemID(ctx context.Context, exec executor.Executor, cachePath string, ...) string
Constants ¶
const SystemProbeTimeout = 60 * time.Second
SystemProbeTimeout bounds the hardware probe (the WMI subprocess) for the update task, which isn't latency-sensitive.
Variables ¶
This section is empty.
Functions ¶
func GatherWSL ¶ added in v1.17.0
GatherWSL detects Windows Subsystem for Linux on the host. It returns nil on non-Windows platforms — WSL detection is host-side only; the Linux binary runs inside a distro and identifies itself separately. It never errors: every failure degrades to WSLPresenceUnknown so a partial probe can't read as a confident "no WSL".
func ID ¶ added in v1.18.0
ID returns the configured device identity, falling back to the machine serial, or "" when neither is usable (never a placeholder like "unknown"). Keep SerialNumber separate so telemetry retains the hardware identity.
func IDForGuest ¶ added in v1.18.0
IDForGuest gives the host/distro identity precedence over an inherited host config. Partial guest metadata falls back to the ordinary device identity.
func ResetIDCache ¶ added in v1.18.0
func ResetIDCache()
ResetIDCache drops the process-wide identity. For tests.
func SerialNumber ¶ added in v1.15.0
SerialNumber resolves the machine identity (the device_id absent a configured override) once per process, so the run gate, scan, enforcers and hooks can't disagree. It runs before any network beacon. With no source it generates and persists an ID; an exhausted ctx or an ID that can't be persisted yields "unknown" (not cached, so a later caller retries).
func SystemID ¶ added in v1.18.0
func SystemID(ctx context.Context, exec executor.Executor, cachePath string, probeTimeout time.Duration) string
SystemID is the device identity for the SYSTEM self-updater. probeTimeout bounds the hardware probe (the self-check passes a short one so its smoke test can't time out on a wedged WMI). It never reads the shared ProgramData device-id file, which users can write (M-9). Order: the configured device_id; the hardware probe (BIOS serial from the registry, then WMI); cachePath (state\device-id: protected, written only by SYSTEM, only from a hardware or configured result); MachineGuid. Only a hardware or configured result is cached, and only a hardware result rewrites the shared file, so a probe that fell back to MachineGuid never changes the identity user scans read (U4). "" when nothing is usable.
Types ¶
This section is empty.