device

package
v1.18.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
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 Gather

func Gather(ctx context.Context, exec executor.Executor) model.Device

Gather collects device information (hostname, serial, OS version, user identity).

func GatherWSL added in v1.17.0

func GatherWSL(ctx context.Context, exec executor.Executor) *model.WSLInfo

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

func ID(dev model.Device) string

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

func IDForGuest(dev model.Device, hostDeviceID, distroID string) string

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

func SerialNumber(ctx context.Context, exec executor.Executor) string

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL