fix: 网络检测增强 + Tracker changeset 清理

网络检测 (monitor.go):
- TCP 拨测 (8.8.8.8:53 / 1.1.1.1:53 / 208.67.222.222:53)
- 延迟阈值检测 (>5s 标记降级)
- DNS 多目标检测 (google/baidu/cloudflare)
- NetworkCheckResult 新增 TCPReachable + LatencyDegraded

Tracker:
- 新增 WithKeepChangesets / WithMaxChangesetAge 选项
- Init 时自动清理过期 changeset (默认保留100份/30天)
- 先按年龄裁剪,再按数量裁剪
This commit is contained in:
root
2026-07-03 21:31:00 +08:00
parent 068af0569c
commit 77e12f7329
4 changed files with 158 additions and 33 deletions

View File

@ -46,10 +46,12 @@ type Heartbeat struct {
}
type NetworkCheckResult struct {
LLMAPIReachable bool `json:"llm_api_reachable"`
DNSResolving bool `json:"dns_resolving"`
LLMAPIReachable bool `json:"llm_api_reachable"`
DNSResolving bool `json:"dns_resolving"`
TCPReachable bool `json:"tcp_reachable"`
Latency time.Duration `json:"latency_ms"`
Error string `json:"error,omitempty"`
LatencyDegraded bool `json:"latency_degraded"`
Error string `json:"error,omitempty"`
}
type SnapshotPolicy struct {