mirror of
https://github.com/fankes/komari-agent.git
synced 2025-10-20 03:29:24 +08:00
feat: 自动发布realease
This commit is contained in:
23
monitoring/os_windows.go
Normal file
23
monitoring/os_windows.go
Normal file
@@ -0,0 +1,23 @@
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package monitoring
|
||||
|
||||
import (
|
||||
"golang.org/x/sys/windows/registry"
|
||||
)
|
||||
|
||||
func OSName() string {
|
||||
key, err := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\Microsoft\Windows NT\CurrentVersion`, registry.QUERY_VALUE)
|
||||
if err != nil {
|
||||
return "Microsoft Windows"
|
||||
}
|
||||
defer key.Close()
|
||||
|
||||
productName, _, err := key.GetStringValue("ProductName")
|
||||
if err != nil {
|
||||
return "Microsoft Windows"
|
||||
}
|
||||
|
||||
return productName
|
||||
}
|
Reference in New Issue
Block a user