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 }