sysprofiler

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

README

sysprofiler

Go module to get information about system hardware and software on MacOS.

Tested on MacOS Catalina

Documentation

Index

Constants

View Source
const (
	//HardwareDT hardware data type
	HardwareDT = "SPHardwareDataType"
	//AudioDT audio data type
	AudioDT = "SPAudioDataType"
	//MemoryDT memory data type
	MemoryDT = "SPMemoryDataType"
	//DisplaysDT displays data type
	DisplaysDT = "SPDisplaysDataType"
)
View Source
const (
	//OSDT Operating system overview data type
	OSDT = "SPSoftwareDataType"
	//ApplicationsDT Installed apps
	ApplicationsDT = "SPApplicationsDataType"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplicationsStruct

type ApplicationsStruct struct {
	Name         string    `mapstructure:"_name"`
	ArchKind     string    `mapstructure:"arch_kind"`
	LastModified time.Time `mapstructure:"lastModified"`
	ObtainedFrom string    `mapstructure:"obtained_from"`
	Path         string    `mapstructure:"path"`
	Version      string    `mapstructure:"version"`
	SignedBy     []string  `mapstructure:"signed_by"`
}

ApplicationsStruct infor about installed Apps

func Applications

func Applications() ([]ApplicationsStruct, error)

Applications get installed apps on the system

type AudioStruct

type AudioStruct struct {
	Items []struct {
		Name         string `mapstructure:"_name"`
		OutputDevice int    `mapstructure:"coreaudio_device_output"`
	} `mapstructure:"_items"`
}

AudioStruct data about system audio devices

func Audio

func Audio() ([]AudioStruct, error)

Audio get information about system audio devices

type DisplaysStruct

type DisplaysStruct struct {
	Model    string           `mapstructure:"sppci_model"`
	Vendor   string           `mapstructure:"spdisplays_vendor"`
	VRAM     string           `mapstructure:"_spdisplays_vram"`
	Monitors []MonitorsStruct `mapstructure:"spdisplays_ndrvs"`
}

DisplaysStruct data about system displays

func Displays

func Displays() ([]DisplaysStruct, error)

Displays get information about system displays

type HardwareStruct

type HardwareStruct struct {
	BootRomVersion string `mapstructure:"boot_rom_version"`
	CPUType        string `mapstructure:"cpu_type"`
	CPUSpeed       string `mapstructure:"current_processor_speed"`
	CPUCores       string `mapstructure:"number_processors"`
	CPUNumber      string `mapstructure:"packages"`
	ChipType       string `mapstructure:"chip_type"`
	L2CacheCore    string `mapstructure:"l2_cache_core"`
	L3Cache        string `mapstructure:"l3_cache"`
	MachineModel   string `mapstructure:"machine_model"`
	MachineName    string `mapstructure:"machine_name"`
	PhysicalMemory string `mapstructure:"physical_memory"`
	PlatformUUID   string `mapstructure:"platform_UUID"`
	Serial         string `mapstructure:"serial_number"`
}

HardwareStruct hardware overview

func Hardware

func Hardware() ([]HardwareStruct, error)

Hardware get hardware overview data

type MainStruct

type MainStruct struct {
	Hardware     []HardwareStruct     `json:"SPHardwareDataType"`
	Displays     []DisplaysStruct     `json:"SPDisplaysDataType"`
	Audio        []AudioStruct        `json:"SPAudioDataType"`
	Memory       []MemoryStruct       `json:"SPMemoryDataType"`
	OS           []OSStruct           `json:"SPSoftwareDataType"`
	Applications []ApplicationsStruct `json:"SPApplicationsDataType"`
}

MainStruct data about the whole system

func Exec

func Exec(dataType ...string) (MainStruct, error)

Exec get information about MacOs system using system_profiler command

type MemoryStruct

type MemoryStruct struct {
	Items []struct {
		Name         string `mapstructure:"_name"`
		Manufacturer string `mapstructure:"dimm_manufacturer"`
		PartNumber   string `mapstructure:"dimm_part_number"`
		SerialNumber string `mapstructure:"dimm_serial_number"`
		Size         string `mapstructure:"dimm_size"`
		Speed        string `mapstructure:"dimm_speed"`
		Status       string `mapstructure:"dimm_status"`
		Type         string `mapstructure:"dimm_type"`
	} `mapstructure:"_items"`
}

MemoryStruct data about system memory

func Memory

func Memory() ([]MemoryStruct, error)

Memory get information about system memory

type MonitorsStruct

type MonitorsStruct struct {
	Name         string `mapstructure:"_name"`
	Resolution   string `mapstructure:"spdisplays_resolution"`
	SerialNumber string `mapstructure:"spdisplays_display-serial-number"`
}

MonitorsStruct data about system monitors

type OSStruct

type OSStruct struct {
	BootMode        string `mapstructure:"boot_mode"`
	BootVolume      string `mapstructure:"boot_volume"`
	KernelVersion   string `mapstructure:"kernel_version"`
	HostName        string `mapstructure:"local_host_name"`
	Version         string `mapstructure:"os_version"`
	SecureVM        string `mapstructure:"secure_vm"`
	SystemIntegrity string `mapstructure:"system_integrity"`
	Uptime          string `mapstructure:"uptime"`
	Username        string `mapstructure:"user_name"`
}

OSStruct Operating system overview data

func OS

func OS() ([]OSStruct, error)

OS get operating system overview data

type RawStruct added in v0.3.0

type RawStruct struct {
	DataType string        `plist:"_dataType"`
	Items    []interface{} `plist:"_items"`
}

RawStruct data about the whole system

type UpdateStruct

type UpdateStruct struct {
	Title       string `json:"title"`
	Version     string `json:"version"`
	Size        string `json:"size"`
	Recommended bool   `json:"recommended"`
	Action      string `json:"action"`
}

UpdateStruct Software Update list

func Updates

func Updates() ([]UpdateStruct, error)

Updates get software updates available

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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