31 lines
652 B
Go
31 lines
652 B
Go
package auth
|
|
|
|
import (
|
|
"github.com/shirou/gopsutil/host"
|
|
)
|
|
|
|
type Host struct {
|
|
Name string `json:"name"`
|
|
OS string `json:"os"`
|
|
Platform string `json:"paltform"`
|
|
PlatformFamily string `json:"platformFamily"`
|
|
PlatformVersion string `json:"platformVersion"`
|
|
KernelVersion string `json:"kernelVersion"`
|
|
HostID string `json:"hostID"`
|
|
}
|
|
|
|
func getHost(h *Host) error {
|
|
if i, err := host.Info(); nil == err {
|
|
h.Name = i.Hostname
|
|
h.OS = i.OS
|
|
h.Platform = i.Platform
|
|
h.PlatformFamily = i.PlatformFamily
|
|
h.KernelVersion = i.KernelVersion
|
|
h.HostID = i.HostID
|
|
} else {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|