//go:build linux package originclient import ( "os" "strings" ) // machineID reads the systemd/dbus machine ID, which is stable across // reboots and unique per Linux install (but not per container, since it is // typically inherited from the image unless explicitly reset). func machineID() (string, error) { for _, path := range []string{"/etc/machine-id", "/var/lib/dbus/machine-id"} { data, err := os.ReadFile(path) if err != nil { continue } if id := strings.TrimSpace(string(data)); id != "" { return id, nil } } return "", errMachineIDUnavailable }