2023-12-18 11:46:58 +01:00
|
|
|
//go:build ios
|
|
|
|
// +build ios
|
|
|
|
|
|
|
|
package system
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"runtime"
|
|
|
|
|
|
|
|
"github.com/netbirdio/netbird/version"
|
|
|
|
)
|
|
|
|
|
|
|
|
// GetInfo retrieves and parses the system information
|
|
|
|
func GetInfo(ctx context.Context) *Info {
|
|
|
|
|
|
|
|
// Convert fixed-size byte arrays to Go strings
|
|
|
|
sysName := extractOsName(ctx, "sysName")
|
|
|
|
swVersion := extractOsVersion(ctx, "swVersion")
|
|
|
|
|
2024-02-20 09:59:56 +01:00
|
|
|
gio := &Info{Kernel: sysName, OSVersion: swVersion, Platform: "unknown", OS: sysName, GoOS: runtime.GOOS, CPUs: runtime.NumCPU(), KernelVersion: swVersion}
|
2023-12-18 11:46:58 +01:00
|
|
|
gio.Hostname = extractDeviceName(ctx, "hostname")
|
|
|
|
gio.WiretrusteeVersion = version.NetbirdVersion()
|
|
|
|
gio.UIVersion = extractUserAgent(ctx)
|
|
|
|
|
|
|
|
return gio
|
|
|
|
}
|
|
|
|
|
2024-06-13 13:24:24 +02:00
|
|
|
// checkFileAndProcess checks if the file path exists and if a process is running at that path.
|
|
|
|
func checkFileAndProcess(paths []string) ([]File, error) {
|
|
|
|
return []File{}, nil
|
|
|
|
}
|
|
|
|
|
2023-12-18 11:46:58 +01:00
|
|
|
// extractOsVersion extracts operating system version from context or returns the default
|
|
|
|
func extractOsVersion(ctx context.Context, defaultName string) string {
|
|
|
|
v, ok := ctx.Value(OsVersionCtxKey).(string)
|
|
|
|
if !ok {
|
|
|
|
return defaultName
|
|
|
|
}
|
|
|
|
return v
|
|
|
|
}
|
|
|
|
|
|
|
|
// extractOsName extracts operating system name from context or returns the default
|
|
|
|
func extractOsName(ctx context.Context, defaultName string) string {
|
|
|
|
v, ok := ctx.Value(OsNameCtxKey).(string)
|
|
|
|
if !ok {
|
|
|
|
return defaultName
|
|
|
|
}
|
|
|
|
return v
|
|
|
|
}
|