wings/system/system.go

33 lines
643 B
Go
Raw Permalink Normal View History

2020-04-06 01:00:33 +00:00
package system
import (
"runtime"
2021-01-10 01:22:39 +00:00
"github.com/docker/docker/pkg/parsers/kernel"
)
2020-04-06 01:00:33 +00:00
type Information struct {
Version string `json:"version"`
KernelVersion string `json:"kernel_version"`
Architecture string `json:"architecture"`
OS string `json:"os"`
CpuCount int `json:"cpu_count"`
}
2020-04-06 01:00:33 +00:00
func GetSystemInformation() (*Information, error) {
k, err := kernel.GetKernelVersion()
if err != nil {
return nil, err
}
2020-04-06 01:00:33 +00:00
s := &Information{
Version: Version,
KernelVersion: k.String(),
Architecture: runtime.GOARCH,
OS: runtime.GOOS,
CpuCount: runtime.NumCPU(),
}
return s, nil
}