You've already forked VptPassiveAdapter
feat(core): 添加断连检测和命令执行功能
- 新增 ConnError 类型用于区分连接级错误和应用层错误 - 在 sync_task 中将网络请求错误包装为 ConnError - 添加 DisconnectActionConfig 配置结构支持断连操作 - 在配置文件中增加 disconnectAction 配置项 - 实现 executeDisconnectCommand 函数支持跨平台命令执行 - 在主循环中添加断连检测逻辑和阈值判断 - 支持服务器连接恢复时重置断连状态 - 添加详细的日志记录用于断连状态追踪
This commit is contained in:
@@ -58,10 +58,17 @@ type ViidConfig struct {
|
||||
Port int `mapstructure:"port"`
|
||||
}
|
||||
|
||||
type MainConfig struct {
|
||||
Api ApiConfig `mapstructure:"api"`
|
||||
Record RecordConfig `mapstructure:"record"`
|
||||
Devices []DeviceMapping `mapstructure:"devices"`
|
||||
FileName FileNameConfig `mapstructure:"fileName"`
|
||||
Viid ViidConfig `mapstructure:"viid"`
|
||||
type DisconnectActionConfig struct {
|
||||
Enabled bool `mapstructure:"enabled"`
|
||||
ThresholdMinutes int `mapstructure:"thresholdMinutes"`
|
||||
Command string `mapstructure:"command"`
|
||||
}
|
||||
|
||||
type MainConfig struct {
|
||||
Api ApiConfig `mapstructure:"api"`
|
||||
Record RecordConfig `mapstructure:"record"`
|
||||
Devices []DeviceMapping `mapstructure:"devices"`
|
||||
FileName FileNameConfig `mapstructure:"fileName"`
|
||||
Viid ViidConfig `mapstructure:"viid"`
|
||||
DisconnectAction DisconnectActionConfig `mapstructure:"disconnectAction"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user