Files
membank/auto-check/pkg/discovery/discover.go
张威33321 906bb54aaa 重构 auto-check:状态数据下沉各包,workflow 精简为纯调度
- discovery: ping 探测存活 + ARP 解析 MAC,包级 Devices map,串行扫描
- stress: 脚本生成模式(BuildScript/ParseResults),ToolSet 工具检测,包级 Results map
- report: 包级 Printed map,SaveAndPrintDeviceReport 保存+打印
- sshclient: 包级 RunCommand
- workflow: 仅持有 config,Start() 固定循环,直接调用各包方法
- config: 移除 ScanConfig.Concurrency(串行扫描无需并发数)
2026-08-12 17:11:59 +08:00

24 lines
574 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 discovery
import (
"fmt"
"auto-check/pkg/model"
)
// Devices 设备表IP → 设备),每轮 Discover() 后更新,包级公开
var Devices = make(map[string]model.Device)
// Discover 扫描并更新包级 Devices map过滤无 MAC 设备,保留上次状态延续)
func (s *Scanner) Discover() {
scanned := s.Scan()
Devices = make(map[string]model.Device, len(scanned))
for _, dev := range scanned {
if dev.MAC == "" {
fmt.Printf(" [!] %s 无 MACARP 未解析),下轮重试\n", dev.IP)
continue
}
Devices[dev.IP] = dev
}
}