Files
membank/auto-check/pkg/discovery/discover.go

19 lines
418 B
Go
Raw Permalink 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 (
"auto-check/pkg/model"
)
// Devices 设备表IP → 设备),每轮 Discover() 后更新,包级公开
var Devices = make(map[string]model.Device)
// Discover 扫描并更新包级 Devices map
func (s *Scanner) Discover() {
scanned := s.Scan()
devices := make(map[string]model.Device, len(scanned))
for _, dev := range scanned {
devices[dev.IP] = dev
}
Devices = devices
}