package models // CPUInfo 结构体用于存储 CPU 信息 type CPUInfo struct { ModelName string `json:"model_name"` Cores int `json:"cores"` Architecture string `json:"architecture"` } // MemoryInfo holds the memory information. type MemoryInfo struct { Total uint64 `json:"total"` Free uint64 `json:"free"` Available uint64 `json:"available"` } // DiskInfo holds the disk information similar to df -Th output. type DiskInfo struct { Device string `json:"device"` // 逻辑分区设备名称 Filesystem string `json:"filesystem"` // 逻辑分区 Type string `json:"type"` // 文件系统类型 Size uint64 `json:"size"` // 总大小 Used uint64 `json:"used"` // 已用空间 Available uint64 `json:"available"` // 可用空间 UsePercent string `json:"use_percent"` // 使用百分比 MountPoint string `json:"mountpoint"` // 挂载点 PhysicalDevice string `json:"physical_device"` // 物理设备名称 PhysicalSize uint64 `json:"physical_size"` // 物理盘大小 } // NetworkInterfaceInfo 结构体用于存储网卡信息 type NetworkInterfaceInfo struct { Name string `json:"name"` MACAddress string `json:"mac_address"` IPAddresses []string `json:"ip_addresses"` } // MotherboardInfo holds the motherboard information. type MotherboardInfo struct { Manufacturer string `json:"manufacturer"` Product string `json:"product"` Version string `json:"version"` Serial string `json:"serial"` } // HostInfo 主机信息模型 type HostInfo struct { CPUInfo CPUInfo `json:"cpu_info"` DiskInfo []DiskInfo `json:"disk_info"` MemoryInfo MemoryInfo `json:"memory_info"` NetInfo []NetworkInterfaceInfo `json:"net_info"` MotherboardInfo MotherboardInfo `json:"motherboard_info"` } //// HostInfo 主机信息模型 //type HostInfo struct { // UUID string `json:"uuid"` // 主机UUID // CPU string `json:"cpu"` // CPU信息 // Motherboard string `json:"motherboard"` // 主板信息 // MAC string `json:"mac"` // MAC地址 // Disk string `json:"disk"` // 硬盘信息 //} // HeartbeatRequest 心跳请求 type HeartbeatRequest struct { HostInfo HostInfo `json:"host_info"` // 主机信息 Timestamp int64 `json:"timestamp"` // 时间戳 TOTPCode string `json:"totp_code"` // TOTP验证码 AppName string `json:"app_name"` // 应用名称 } // HeartbeatResponse 心跳响应 type HeartbeatResponse struct { Authorized bool `json:"authorized"` // 是否已授权 TOTPCode string `json:"totp_code"` // TOTP验证码 Timestamp int64 `json:"timestamp"` // 时间戳 SecondTOTPSecret string `json:"second_totp_secret"` // 第二级的totp密钥 }