MCPcopy
hub / github.com/safing/portmaster / AddPlatformInfo

Method AddPlatformInfo

base/utils/debug/debug_default.go:13–43  ·  view source on GitHub ↗

AddPlatformInfo adds OS and platform information.

(ctx context.Context)

Source from the content-addressed store, hash-verified

11
12// AddPlatformInfo adds OS and platform information.
13func (di *Info) AddPlatformInfo(ctx context.Context) {
14 // Get information from the system.
15 info, err := host.InfoWithContext(ctx)
16 if err != nil {
17 di.AddSection(
18 "Platform Information",
19 NoFlags,
20 fmt.Sprintf("Failed to get: %s", err),
21 )
22 return
23 }
24
25 // Check if we want to add virtulization information.
26 var virtInfo string
27 if info.VirtualizationRole == "guest" {
28 if info.VirtualizationSystem != "" {
29 virtInfo = fmt.Sprintf("VM: %s", info.VirtualizationSystem)
30 } else {
31 virtInfo = "VM: unidentified"
32 }
33 }
34
35 // Add section.
36 di.AddSection(
37 fmt.Sprintf("Platform: %s %s", info.Platform, info.PlatformVersion),
38 UseCodeSection|AddContentLineBreaks,
39 fmt.Sprintf("System: %s %s (%s) %s", info.Platform, info.OS, info.PlatformFamily, info.PlatformVersion),
40 fmt.Sprintf("Kernel: %s %s", info.KernelVersion, info.KernelArch),
41 virtInfo,
42 )
43}

Callers 3

debugInfoFunction · 0.80
debugInfoFunction · 0.80
debugInfoFunction · 0.80

Calls 1

AddSectionMethod · 0.95

Tested by

no test coverage detected