overflow_probes/auth/host.go
crusader 726b24f878 ing
2017-09-21 17:38:05 +09:00

33 lines
677 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() (*Host, error) {
h := &Host{}
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 nil, err
}
return h, nil
}