mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-16 15:26:40 +00:00
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
37 lines
625 B
Go
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
|
|
}
|