重构 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(串行扫描无需并发数)
This commit is contained in:
张威33321
2026-08-12 17:11:59 +08:00
parent 700ba91883
commit 906bb54aaa
15 changed files with 708 additions and 871 deletions

View File

@@ -27,9 +27,8 @@ type Config struct {
// ScanConfig 网段扫描
type ScanConfig struct {
CIDR string `yaml:"cidr"`
Timeout time.Duration `yaml:"timeout"`
Concurrency int `yaml:"concurrency"`
CIDR string `yaml:"cidr"`
Timeout time.Duration `yaml:"timeout"`
}
// SSHConfig SSH 认证
@@ -59,7 +58,6 @@ type PrintConfig struct {
Backend string `yaml:"backend"` // system / escpos / usb / file
Device string `yaml:"device"` // 目标:打印机名 / host:port / 设备路径 / 文件路径
Width int `yaml:"width"` // 行宽80mm=42
Charset string `yaml:"charset"` // 字符集(默认 utf-8
}
// WorkflowConfig 工作流
@@ -75,9 +73,8 @@ type WorkflowConfig struct {
func Default() *Config {
return &Config{
Scan: ScanConfig{
CIDR: "192.168.1.0/24",
Timeout: 3 * time.Second,
Concurrency: 50,
CIDR: "192.168.1.0/24",
Timeout: 3 * time.Second,
},
SSH: SSHConfig{
User: "root",