sysinfo

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package sysinfo provides system information collection services. It gathers comprehensive system details including OS, CPU, memory, and hardware information using the zcalusic/sysinfo library with platform-specific fallbacks for enhanced compatibility.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service interface {
	GetSystemInfo(ctx context.Context) (*SystemInfo, error)
	SetSyncoorVersion(version string)
}

func NewService

func NewService(log logrus.FieldLogger) Service

type SystemInfo

type SystemInfo struct {
	// Basic system information
	Hostname       string `json:"hostname"`
	GoVersion      string `json:"go_version"`
	SyncoorVersion string `json:"syncoor_version,omitempty"`

	// Enhanced system information from zcalusic/sysinfo
	OSName         string `json:"os_name,omitempty"`
	OSVendor       string `json:"os_vendor,omitempty"`
	OSVersion      string `json:"os_version,omitempty"`
	OSRelease      string `json:"os_release,omitempty"`
	OSArchitecture string `json:"os_architecture,omitempty"`
	KernelVersion  string `json:"kernel_version,omitempty"`
	KernelRelease  string `json:"kernel_release,omitempty"`

	// CPU information
	CPUVendor  string `json:"cpu_vendor,omitempty"`
	CPUModel   string `json:"cpu_model,omitempty"`
	CPUSpeed   uint   `json:"cpu_speed,omitempty"`   // MHz
	CPUCache   uint   `json:"cpu_cache,omitempty"`   // KB
	CPUCores   uint   `json:"cpu_cores,omitempty"`   // Physical cores
	CPUThreads uint   `json:"cpu_threads,omitempty"` // Logical cores

	// Memory information
	TotalMemory uint64 `json:"total_memory"` // Bytes for compatibility
	MemoryType  string `json:"memory_type,omitempty"`
	MemorySpeed uint   `json:"memory_speed,omitempty"` // MT/s

	// Hardware information
	Hypervisor    string `json:"hypervisor,omitempty"`
	Timezone      string `json:"timezone,omitempty"`
	ProductName   string `json:"product_name,omitempty"`
	ProductVendor string `json:"product_vendor,omitempty"`
	BoardName     string `json:"board_name,omitempty"`
	BoardVendor   string `json:"board_vendor,omitempty"`

	// Legacy fields for backward compatibility
	PlatformFamily  string `json:"platform_family,omitempty"`
	PlatformVersion string `json:"platform_version,omitempty"`
}

Jump to

Keyboard shortcuts

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