mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-04-05 10:06:25 +00:00
Both `device_id` and `device_info` are used by the headless-client and the GUI client / IPC service. They should therefore be defined in the `bin-shared` crate.
23 lines
581 B
Rust
23 lines
581 B
Rust
pub fn serial() -> Option<String> {
|
|
const DEFAULT_SERIAL: &str = "123456789";
|
|
let data = smbioslib::table_load_from_device().ok()?;
|
|
|
|
let serial = data.find_map(|sys_info: smbioslib::SMBiosSystemInformation| {
|
|
sys_info.serial_number().to_utf8_lossy()
|
|
})?;
|
|
|
|
if serial == DEFAULT_SERIAL {
|
|
return None;
|
|
}
|
|
|
|
Some(serial)
|
|
}
|
|
|
|
pub fn uuid() -> Option<String> {
|
|
let data = smbioslib::table_load_from_device().ok()?;
|
|
|
|
let uuid = data.find_map(|sys_info: smbioslib::SMBiosSystemInformation| sys_info.uuid());
|
|
|
|
uuid?.to_string().into()
|
|
}
|