Fix: 替换SQLite为JSON文件存储,无需CGO支持

- 移除go-sqlite3依赖,改用纯Go的JSON文件存储
- 解决Windows上CGO_ENABLED=0导致SQLite无法使用的问题
- 添加线程安全的读写锁保护
- 支持数据持久化,重启后数据不丢失
- 简化存储逻辑,提高可靠性
이 커밋은 다음에 포함됨:
Your Name
2026-04-26 00:46:37 +08:00
부모 e5e624d72e
커밋 8b7dbf2886
5개의 변경된 파일92개의 추가작업 그리고 174개의 파일을 삭제
+11 -1
파일 보기
@@ -31,7 +31,17 @@ func (p *H3CParser) Parse(device *models.Device, outputs []string) error {
}
p.parseVersion(device, outputs[0])
device.Interfaces = p.parseInterfaces(outputs[1], outputs[2])
// 检查命令输出是否为空
if outputs[1] == "" {
fmt.Printf("Warning: 'display interface' output is empty for device %s\n", device.IP)
} else {
device.Interfaces = p.parseInterfaces(outputs[1], outputs[2])
if len(device.Interfaces) == 0 {
fmt.Printf("Warning: parsed 0 interfaces for device %s (output length: %d)\n",
device.IP, len(outputs[1]))
}
}
// 解析ARP表用于MAC到IP映射(允许失败)
arpTable := make(map[string]string)