Files
zogo/hardware/types.go
T
4566704 138c929bd4 feat(hardware): 自 go-hua 迁入硬件信息采集与变更检测
- WMI 采集主板/BIOS/显卡/内存/CPU/硬盘等 11 类设备 + 变更比对
- 新增依赖 gopsutil/yusufpapurcu/wmi, 附测试、例程与 README
2026-09-20 12:29:36 +08:00

95 lines
3.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Package hardware 提供硬件信息采集(WMI)与硬件变更检测(Windows)。
package hardware
// BaseBoard 主板信息(WMI Win32_BaseBoard)
type BaseBoard struct {
Manufacturer string `json:"manufacturer"` //制造商
Product string `json:"product"` //产品
}
// Bios BIOS 信息(WMI Win32_BIOS)
type Bios struct {
SMBIOSBIOSVersion string `json:"SMBIOSBIOSVersion"`
Name string `json:"name"`
}
// VideoController 显卡信息(WMI Win32_VideoController)
type VideoController struct {
Name string `json:"name"`
AdapterRAM uint32 `json:"adapterRAM"`
PNPDeviceID string `json:"PNPDeviceID"`
CurrentHorizontalResolution uint32 `json:"currentHorizontalResolution"`
CurrentVerticalResolution uint32 `json:"currentVerticalResolution"`
CurrentRefreshRate uint32 `json:"currentRefreshRate"`
}
// PhysicalMemory 内存条信息(WMI Win32_PhysicalMemory)
type PhysicalMemory struct {
Manufacturer string `json:"manufacturer"` //制造商
Capacity uint64 `json:"capacity"` //容量
Speed uint32 `json:"speed"` //速率
SerialNumber string `json:"serialNumber"` //序列号
}
// Processor CPU 信息(WMI Win32_Processor)
type Processor struct {
Name string `json:"name"`
NumberOfCores uint32 `json:"numberOfCores"`
NumberOfLogicalProcessors uint32 `json:"numberOfLogicalProcessors"`
}
// DiskDrive 硬盘信息(WMI Win32_DiskDrive)
type DiskDrive struct {
Caption string `json:"caption"`
Size uint64 `json:"size"`
InterfaceType string `json:"interfaceType"`
}
// SoundDevice 声卡信息(WMI Win32_SoundDevice)
type SoundDevice struct {
Name string `json:"name"`
}
// NetworkAdapter 网卡信息(WMI Win32_NetworkAdapter)
type NetworkAdapter struct {
Name string `json:"name"`
Speed uint64 `json:"speed"`
MACAddress string `json:"MACAddress"`
}
// DesktopMonitor 显示器信息(WMI Win32_DesktopMonitor)
type DesktopMonitor struct {
Name string `json:"name"`
ScreenWidth uint32 `json:"screenWidth"`
ScreenHeight uint32 `json:"screenHeight"`
PNPDeviceID string `json:"PNPDeviceID"`
ConfigManagerErrorCode uint32 `json:"configManagerErrorCode"`
}
// PointingDevice 指点设备信息(WMI Win32_PointingDevice)
type PointingDevice struct {
Description string `json:"description"`
PNPDeviceID string `json:"PNPDeviceID"`
}
// Keyboard 键盘信息(WMI Win32_Keyboard)
type Keyboard struct {
Description string `json:"description"`
PNPDeviceID string `json:"PNPDeviceID"`
}
// Hardware 硬件信息汇总
type Hardware struct {
BaseBoard []BaseBoard `json:"baseBoard"`
Bios []Bios `json:"bios"`
Processor []Processor `json:"processor"`
PhysicalMemory []PhysicalMemory `json:"physicalMemory"`
VideoController []VideoController `json:"videoController"`
SoundDevice []SoundDevice `json:"soundDevice"`
NetworkAdapter []NetworkAdapter `json:"networkAdapter"`
DiskDrive []DiskDrive `json:"diskDrive"`
DesktopMonitor []DesktopMonitor `json:"desktopMonitor"`
Keyboard []Keyboard `json:"keyboard"`
PointingDevice []PointingDevice `json:"pointingDevice"`
}