platform

package
v0.0.0-...-3f8e3b8 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package platform regroups collecting information about the platform

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Info

type Info struct {
	// GoVersion is the golang version.
	GoVersion utils.Value[string] `json:"goV"`
	// GoOS is equal to "runtime.GOOS"
	GoOS utils.Value[string] `json:"GOOS"`
	// GoArch is equal to "runtime.GOARCH"
	GoArch utils.Value[string] `json:"GOOARCH"`

	// KernelName is the kernel name (ex:  "windows", "Linux", ...)
	KernelName utils.Value[string] `json:"kernel_name"`
	// KernelRelease the kernel release (ex: "10.0.20348", "4.15.0-1080-gcp", ...)
	KernelRelease utils.Value[string] `json:"kernel_release"`
	// Hostname is the hostname for the host
	Hostname utils.Value[string] `json:"hostname"`
	// Machine the architecture for the host (is: x86_64 vs arm).
	Machine utils.Value[string] `json:"machine"`
	// OS is the os name description (ex: "GNU/Linux", "Windows Server 2022 Datacenter", ...)
	OS utils.Value[string] `json:"os"`

	// Family is the OS family (Windows only)
	Family utils.Value[string] `json:"family"`

	// KernelVersion the kernel version, Unix only
	KernelVersion utils.Value[string] `json:"kernel_version"`
	// Processor is the processor type, Unix only (ex "x86_64", "arm", ...)
	Processor utils.Value[string] `json:"processor"`
	// HardwarePlatform is the hardware name, Linux only (ex "x86_64")
	HardwarePlatform utils.Value[string] `json:"hardware_platform"`
}

Info holds metadata about the host

func CollectInfo

func CollectInfo() *Info

CollectInfo returns an Info struct with every field initialized either to a value or an error. The method will try to collect as many fields as possible.

func (*Info) AsJSON

func (info *Info) AsJSON() (interface{}, []string, error)

AsJSON returns an interface which can be marshalled to a JSON and contains the value of non-errored fields.

Jump to

Keyboard shortcuts

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