osutil

package
v0.0.0-...-cc86db0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OSWin     = "windows"
	OSLinux   = "linux"
	OSFreebsd = "freebsd"
)
View Source
const (
	ARCH_64      = "amd64"
	ARCH_32      = "386"
	ARCH_ARM     = "arm64"
	ARCH_UNKNOWN = "unknown"
)
View Source
const PlatformAliyun = "aliyun"

PlatformAliyun uses Ohai identifier for aliyun platform

View Source
const PlatformAlpine = "alpine"

PlatformAlpine uses Ohai identifier for alpine platform

View Source
const PlatformArch = "arch"

PlatformArch uses Ohai identifier for arch platform

View Source
const PlatformCentos = "centos"

PlatformCentos uses Ohai identifier for centos platform

View Source
const PlatformDarwin = "mac_os_x"

PlatformDarwin uses Ohai identifier for darwin platform

View Source
const PlatformDebian = "debian"

PlatformDebian uses Ohai identifier for debian platform

View Source
const PlatformFamilyAlpine = "alpine"

PlatformFamilyAlpine uses Ohai identifier for alpine platform family

View Source
const PlatformFamilyArch = "arch"

PlatformFamilyArch uses Ohai identifier for arch linux platform family

View Source
const PlatformFamilyDarwin = "mac_os_x"

PlatformFamilyDarwin uses Ohai identifier for darwin platform family

View Source
const PlatformFamilyDebian = "debian"

PlatformFamilyDebian uses Ohai identifier for debian platform family

View Source
const PlatformFamilyFedora = "fedora"

PlatformFamilyFedora uses Ohai identifier for fedora platform family

View Source
const PlatformFamilyGentoo = "gentoo"

PlatformFamilyGentoo uses Ohai identifier for gentoo linux platform family

View Source
const PlatformFamilyRhel = "rhel"

PlatformFamilyRhel uses Ohai identifier for rhel platform family

View Source
const PlatformFamilySuse = "suse"

PlatformFamilySuse uses Ohai identifier for opensuse platform family

View Source
const PlatformFamilyWindows = "windows"

PlatformFamilyWindows uses Ohai identifier for windows platform family

View Source
const PlatformFedora = "fedora"

PlatformFedora uses Ohai identifier for fedora platform

View Source
const PlatformGentoo = "gentoo"

PlatformGentoo uses Ohai identifier for gentoo platform

View Source
const PlatformOpensuse = "opensuse"

PlatformOpensuse uses Ohai identifier for opensuse platform version < 42

View Source
const PlatformOpensuseLeap = "opensuseleap"

PlatformOpensuseLeap uses Ohai identifier for aliyun platform version >= 42

View Source
const PlatformOracleLinux = "oracle"

PlatformOracleLinux uses Ohai identifier for oracle linux platform

View Source
const PlatformRaspbian = "raspbian"

PlatformRaspbian uses Ohai identifier for raspbian platform

View Source
const PlatformRedhat = "redhat"

PlatformRedhat uses Ohai identifier for redhat platform

View Source
const PlatformSuse = "suse"

PlatformSuse uses Ohai identifier for suse platform

View Source
const PlatformUbuntu = "ubuntu"

PlatformUbuntu uses Ohai identifier for ubuntu platform

View Source
const PlatformWindows = "windows"

PlatformWindows uses Ohai identifier for windows platform

Variables

This section is empty.

Functions

func DeleteFile

func DeleteFile(name string) (err error)

func Exists

func Exists(path string) bool

func ExternalIP

func ExternalIP() (net.IP, error)

func GetCpuCores

func GetCpuCores() (cores int, err error)

func GetHostname

func GetHostname() string

func GetKernelVersion

func GetKernelVersion() string

func GetOsArch

func GetOsArch() string

func GetOsType

func GetOsType() string

GetOsType returns simple os identifier

func GetUnameMachine

func GetUnameMachine() (string, error)

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 IsSystemShutdown

func IsSystemShutdown(ctx context.Context) (bool, error)

func OriginPlatformName

func OriginPlatformName() (name string, err error)

OriginPlatformName gets the original platform name returned by OS

func PlatformName

func PlatformName() (name string, err error)

PlatformName gets the OS specific platform name.

func PlatformType

func PlatformType() (value string, err error)

func PlatformVersion

func PlatformVersion() (version string, err error)

PlatformVersion gets the OS specific platform version.

func ReadFile

func ReadFile(filename string) (content string, err error)

func WriteFile

func WriteFile(filename string, content string) (err error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL