Files
membank/auto-check/pkg/model/model.go

24 lines
614 B
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 model
import "fmt"
// ============================
// 公共类型 — 全包共用,唯一来源
// ============================
// Device 设备
// 发现阶段以 IP 标识(仅做 ping 可达性探测MAC 在 SSH 登录后回填,
// 空 = 尚未获取。键map key始终为 IP。
type Device struct {
IP string // 当前 IPDHCP 可能变化)
MAC string // 物理地址SSH 阶段回填,空 = 尚未获取
}
// Label 设备显示名(用于日志/报告)
func (d Device) Label() string {
if d.MAC != "" {
return fmt.Sprintf("%s (%s)", d.IP, d.MAC)
}
return d.IP
}