overflow_probes/auth/host.go
crusader 5a9359c3af ing
2017-09-21 20:04:30 +09:00

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
}