Feat: 支持通过MAC地址进行邻居匹配和拓扑连线

- Neighbor模型添加RemoteMAC字段
- Device模型添加MACAddresses字段
- H3C解析器保存邻居MAC地址和设备所有接口MAC
- 拓扑构建支持三层匹配: IP -> 设备名 -> MAC地址
- 即使ARP表获取失败也能通过MAC地址自动连线
This commit is contained in:
Your Name
2026-04-26 01:08:14 +08:00
parent 872ebc0376
commit 6771858c40
3 changed files with 44 additions and 11 deletions
+3
View File
@@ -24,6 +24,7 @@ type Device struct {
Uptime string `json:"uptime"`
Interfaces []Interface `json:"interfaces"`
Neighbors []Neighbor `json:"neighbors"`
MACAddresses []string `json:"mac_addresses,omitempty"` // 设备的所有MAC地址(用于邻居匹配)
LastScanned time.Time `json:"last_scanned"`
ScanStatus string `json:"scan_status"` // success, failed, pending
ErrorMessage string `json:"error_message,omitempty"`
@@ -46,11 +47,13 @@ type Interface struct {
OutPackets int64 `json:"out_packets"`
}
// Neighbor 邻居设备信息
// Neighbor 邻居设备信息
type Neighbor struct {
LocalInterface string `json:"local_interface"`
RemoteDevice string `json:"remote_device"`
RemoteIP string `json:"remote_ip"`
RemoteMAC string `json:"remote_mac,omitempty"` // 新增:邻居MAC地址
RemoteInterface string `json:"remote_interface"`
Protocol string `json:"protocol"` // CDP, LLDP, ARP
}