Files
netbird/client/system/static_info.go
Zoltan Papp ad8fcda67b [client] Move some sys info to static place (#4446)
This PR refactors the system information collection code by moving static system information gathering to a dedicated location and separating platform-specific implementations. The primary goal is to improve code organization and maintainability by centralizing static info collection logic.

Key changes:
- Centralized static info collection into dedicated files with platform-specific implementations
- Moved `StaticInfo` struct definition to the main static_info.go file
- Added async initialization function `UpdateStaticInfoAsync()` across all platforms
2025-09-06 10:49:28 +02:00

37 lines
625 B
Go

//go:build (linux && !android) || windows || (darwin && !ios)
package system
import (
"sync"
)
var (
staticInfo StaticInfo
once sync.Once
)
// StaticInfo is an object that contains machine information that does not change
type StaticInfo struct {
SystemSerialNumber string
SystemProductName string
SystemManufacturer string
Environment Environment
// Windows specific fields
OSName string
OSVersion string
BuildVersion string
}
func updateStaticInfo() {
once.Do(func() {
staticInfo = newStaticInfo()
})
}
func getStaticInfo() StaticInfo {
updateStaticInfo()
return staticInfo
}