重构 auto-check:拆分包架构,精简 workflow 为纯调度循环

各包职责:
- config: 分类 YAML 配置
- model: Device/IP/MAC 公共类型
- discovery: 扫描 + ARP MAC 解析 + Devices 变量
- sshclient: SSH 连接
- stress: stress-ng/stressapptest 压测 + Results 变量
- report: 80mm 热敏模板/sparkline/打印 + Printed 变量
- workflow: 永久循环调度 + Start/Stop

workflow 已精简为 100 行纯编排,所有业务逻辑下沉各包
This commit is contained in:
张威33321
2026-08-11 20:58:19 +08:00
parent 19f6050147
commit 700ba91883
17 changed files with 867 additions and 516 deletions

View File

@@ -0,0 +1,27 @@
{{ hr '═' }}
auto-check 检测报告
{{ hr '═' }}
生成时间: {{ timeFmt .StartTime }}
总耗时: {{ .Duration }}
{{ "" }}
── 配置 ──
网段: {{ .Config.CIDR }}
SSH: {{ .Config.User }}@:{{ .Config.Port }}
压测: {{ .Config.StressTypes }}
并发: {{ .Config.Concurrency }}
{{ "" }}
{{ range .Phases }}{{ hr '─' }}
{{ .Phase }} [{{ .Status }}]
{{ .Summary }}
{{ hr '─' }}
{{ if eq .Phase "设备发现" }}{{ range .Hosts }}{{ if .Alive }}✓{{ else }}✗{{ end }} {{ padRight .MAC 19 }} {{ padRight .IP 15 }}
{{ end }}{{ end }}{{ if eq .Phase "SSH 登录" }}{{ range .Hosts }}{{ if .SSHLogin }}✓{{ else }}✗{{ end }} {{ padRight .MAC 19 }} {{ padRight .IP 15 }} {{ .SSHErr }}
{{ end }}{{ end }}{{ if eq .Phase "压力测试" }}{{ range .Hosts }}{{ padRight .MAC 19 }} {{ padRight .IP 15 }}
{{ range .Stress }}{{ if eq .Status "pass" }}✓{{ else }}✗{{ end }} {{ padRight .Type 12 }} {{ .Status }} {{ .Duration }}
{{ if .Error }} ERR: {{ trunc .Error 34 }}{{ end }}{{ end }}{{ range $name, $data := .Curves }} [{{ $name }}] {{ curveSummary $data }}
{{ sparkline $data 38 }}
{{ end }}{{ end }}{{ end }}{{ end }}
{{ "" }}
{{ hr '═' }}
报告结束
{{ hr '═' }}