specs

package
v0.0.0-...-777877a Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const TypeMemoryDevice int = 17

Variables

This section is empty.

Functions

This section is empty.

Types

type BIOS

type BIOS struct {
	Vendor  string `json:"vendor"`
	Version string `json:"version"`
	Date    string `json:"date"`
}

func FetchBIOS

func FetchBIOS() (BIOS, error)

type CPU

type CPU struct {
	Name                  string   `json:"name"`
	Architecture          string   `json:"architecture"`
	CoreCount             uint64   `json:"core_count"`
	CPUCount              uint64   `json:"cpu_count"`
	MaxFrequencyMegaHertz uint64   `json:"max_frequency_megahertz"`
	Mitigations           []string `json:"mitigations"`
}

func FetchCPU

func FetchCPU() (CPU, error)

type DIMM

type DIMM struct {
	SizeGigabytes uint64 `json:"size_gigabytes"`
	Speed         uint64 `json:"speed_mt_s"`
	Manufacturer  string `json:"manufacturer"`
	SerialNumber  string `json:"serial_number"`
	Type          string `json:"type"`
	PartNumber    string `json:"part_number"`
	FormFactor    string `json:"form_factor"`
	Locator       string `json:"locator"`
	BankLocator   string `json:"bank_locator"`
}

func FetchDIMMs

func FetchDIMMs() ([]DIMM, error)

func NewDIMM

func NewDIMM(dmiDIMM dmidecode.Record) (DIMM, error)

type Disk

type Disk struct {
	Name          string      `json:"name"`
	SizeMegabytes uint64      `json:"size_megabytes"`
	Partitions    []Partition `json:"partitions"`
}

func FetchDisks

func FetchDisks() ([]Disk, error)

func NewDisk

func NewDisk(disk *block.Disk) Disk

type Driver

type Driver struct {
	Name            string `json:"name"`
	Version         string `json:"version"`
	FirmwareVersion string `json:"firmware_version"`
}

func NewDriver

func NewDriver(interfaceName string, ethHandle *ethtool.Ethtool) Driver

type Kernel

type Kernel struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

func FetchKernel

func FetchKernel() (Kernel, error)

type Memory

type Memory struct {
	TotalSize   uint64       `json:"memory"`
	TotalSwap   uint64       `json:"swap"`
	SwapDevices []SwapDevice `json:"swap_devices"`
}

func FetchMemory

func FetchMemory() (Memory, error)

type Motherboard

type Motherboard struct {
	Vendor       string `json:"vendor"`
	Name         string `json:"name"`
	SerialNumber string `json:"serial_number"`
}

func FetchMotherboard

func FetchMotherboard() (Motherboard, error)

type Network

type Network struct {
	Interfaces []NetworkInterface `json:"interfaces"`
	Hostname   string             `json:"hostname"`
}

func FetchNetwork

func FetchNetwork() (Network, error)

type NetworkInterface

type NetworkInterface struct {
	MACAddress    string   `json:"mac_address"`
	Driver        Driver   `json:"driver"`
	IPv4Addresses []string `json:"ipv4_addresses"`
	IPv6Addresses []string `json:"ipv6_addresses"`
}

func FetchNetworkInterface

func FetchNetworkInterface(netIface net.Interface, ethHandle *ethtool.Ethtool) (NetworkInterface, error)

func FetchNetworkInterfaces

func FetchNetworkInterfaces() ([]NetworkInterface, error)

type OEM

type OEM struct {
	Manufacturer string `json:"manufacturer"`
	ProductName  string `json:"product_name"`
	SerialNumber string `json:"serial_number"`
}

func FetchOEM

func FetchOEM() (OEM, error)

type PCSpecs

type PCSpecs struct {
	Motherboard    Motherboard    `json:"motherboard"`
	CPU            CPU            `json:"cpu"`
	Disks          []Disk         `json:"disks"`
	Network        Network        `json:"network"`
	BIOS           BIOS           `json:"bios"`
	Memory         Memory         `json:"memory"`
	DIMMs          []DIMM         `json:"dimms"`
	BootTime       time.Time      `json:"boot_time"`
	Kernel         Kernel         `json:"kernel"`
	Release        Release        `json:"release"`
	OEM            OEM            `json:"oem"`
	Virtualization Virtualization `json:"virtualization"`
}

func Fetch

func Fetch() (PCSpecs, error)

Fetch retrieves all specs from the current system. This function may return errors, however the returned PCSpecs struct will still contain all specs that were successfully retrieved.

type Partition

type Partition struct {
	Filesystem        string `json:"filesystem"`
	CapacityMegabytes uint64 `json:"capacity_megabytes"`
	Source            string `json:"source"`
	Target            string `json:"target"`
}

func NewPartition

func NewPartition(partition *block.Partition) Partition

func NewPartitions

func NewPartitions(disk *block.Disk) []Partition

type Release

type Release struct {
	Name     string `json:"name"`
	Version  string `json:"version"`
	Codename string `json:"codename"`
}

func FetchRelease

func FetchRelease() (Release, error)

type SwapDevice

type SwapDevice struct {
	Name string `json:"name"`
	Size uint64 `json:"size"`
}

func FetchSwapDevices

func FetchSwapDevices() ([]SwapDevice, error)

func NewSwapDevice

func NewSwapDevice(swapDevice *mem.SwapDevice) SwapDevice

NewSwapDevice converts a gopsutil SwapDevice into a SwapDevice

type Virtualization

type Virtualization struct {
	// Type of virtualization (if any), e.g. physical/kvm/lxc
	Type string `json:"type"`
}

func FetchVirtualization

func FetchVirtualization() (Virtualization, error)

Jump to

Keyboard shortcuts

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