Documentation ¶
Index ¶
- Constants
- func DeleteFile(name string) (err error)
- func Exists(path string) bool
- func ExternalIP() (net.IP, error)
- func GetCpuCores() (cores int, err error)
- func GetHostname() string
- func GetKernelVersion() string
- func GetOsArch() string
- func GetOsType() string
- func GetUnameMachine() (string, error)
- func GetUptimeOfMs() uint64
- func GetVersion() string
- func GetVirtualType() string
- func IsSystemShutdown(ctx context.Context) (bool, error)
- func OriginPlatformName() (name string, err error)
- func PlatformName() (name string, err error)
- func PlatformType() (value string, err error)
- func PlatformVersion() (version string, err error)
- func ReadFile(filename string) (content string, err error)
- func WriteFile(filename string, content string) (err error)
Constants ¶
const ( OSWin = "windows" OSLinux = "linux" OSFreebsd = "freebsd" )
const ( ARCH_64 = "amd64" ARCH_32 = "386" ARCH_ARM = "arm64" ARCH_UNKNOWN = "unknown" )
const PlatformAliyun = "aliyun"
PlatformAliyun uses Ohai identifier for aliyun platform
const PlatformAlpine = "alpine"
PlatformAlpine uses Ohai identifier for alpine platform
const PlatformArch = "arch"
PlatformArch uses Ohai identifier for arch platform
const PlatformCentos = "centos"
PlatformCentos uses Ohai identifier for centos platform
const PlatformDarwin = "mac_os_x"
PlatformDarwin uses Ohai identifier for darwin platform
const PlatformDebian = "debian"
PlatformDebian uses Ohai identifier for debian platform
const PlatformFamilyAlpine = "alpine"
PlatformFamilyAlpine uses Ohai identifier for alpine platform family
const PlatformFamilyArch = "arch"
PlatformFamilyArch uses Ohai identifier for arch linux platform family
const PlatformFamilyDarwin = "mac_os_x"
PlatformFamilyDarwin uses Ohai identifier for darwin platform family
const PlatformFamilyDebian = "debian"
PlatformFamilyDebian uses Ohai identifier for debian platform family
const PlatformFamilyFedora = "fedora"
PlatformFamilyFedora uses Ohai identifier for fedora platform family
const PlatformFamilyGentoo = "gentoo"
PlatformFamilyGentoo uses Ohai identifier for gentoo linux platform family
const PlatformFamilyRhel = "rhel"
PlatformFamilyRhel uses Ohai identifier for rhel platform family
const PlatformFamilySuse = "suse"
PlatformFamilySuse uses Ohai identifier for opensuse platform family
const PlatformFamilyWindows = "windows"
PlatformFamilyWindows uses Ohai identifier for windows platform family
const PlatformFedora = "fedora"
PlatformFedora uses Ohai identifier for fedora platform
const PlatformGentoo = "gentoo"
PlatformGentoo uses Ohai identifier for gentoo platform
const PlatformOpensuse = "opensuse"
PlatformOpensuse uses Ohai identifier for opensuse platform version < 42
const PlatformOpensuseLeap = "opensuseleap"
PlatformOpensuseLeap uses Ohai identifier for aliyun platform version >= 42
const PlatformOracleLinux = "oracle"
PlatformOracleLinux uses Ohai identifier for oracle linux platform
const PlatformRaspbian = "raspbian"
PlatformRaspbian uses Ohai identifier for raspbian platform
const PlatformRedhat = "redhat"
PlatformRedhat uses Ohai identifier for redhat platform
const PlatformSuse = "suse"
PlatformSuse uses Ohai identifier for suse platform
const PlatformUbuntu = "ubuntu"
PlatformUbuntu uses Ohai identifier for ubuntu platform
const PlatformWindows = "windows"
PlatformWindows uses Ohai identifier for windows platform
Variables ¶
This section is empty.
Functions ¶
func DeleteFile ¶
func ExternalIP ¶
func GetCpuCores ¶
func GetHostname ¶
func GetHostname() string
func GetKernelVersion ¶
func GetKernelVersion() string
func GetUnameMachine ¶
func GetUptimeOfMs ¶
func GetUptimeOfMs() uint64
GetUptimeOfMs returns system uptime in millisecond precision, which would be simply 0 when error occurs internally.
func GetVersion ¶
func GetVersion() string
func GetVirtualType ¶
func GetVirtualType() string
GetVirtualType returns kvm or xen based on underlying virtualization type, otherwise unknown. TODO: retrieve cpu infos only at initialization time.
func OriginPlatformName ¶
OriginPlatformName gets the original platform name returned by OS
func PlatformName ¶
PlatformName gets the OS specific platform name.
func PlatformType ¶
func PlatformVersion ¶
PlatformVersion gets the OS specific platform version.
Types ¶
This section is empty.