From 62beabfd1466fd3a6b6c0736acc8c5a3b3ec4b3b Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期日, 28 四月 2024 10:10:35 +0800
Subject: [PATCH] 完善1400转发流程

---
 config/config.go |   30 +++++++++++++++++++-----------
 1 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/config/config.go b/config/config.go
index 6802574..9eaad86 100644
--- a/config/config.go
+++ b/config/config.go
@@ -17,17 +17,17 @@
 }
 
 type client struct {
-	DeviceID          string `mapstructure:"device-id"`
-	Username          string `mapstructure:"username"`
-	Password          string `mapstructure:"password"`
-	ServerAddr        string `mapstructure:"server-addr"`
-	ServerPort        string `mapstructure:"server-port"`
-	Proto             string `mapstructure:"proto" `             // http, https
-	UploadType        string `mapstructure:"upload-type"`        // binary, url
-	ChannelNo         string `mapstructure:"channel-number"`     // 閫氶亾鍙�, 鍚宨d
-	HeartbeatInterval int    `mapstructure:"heartbeat-interval"` // 蹇冭烦鍛ㄦ湡
-	HeartbeatCount    int    `mapstructure:"heartbeat-count"`    // 蹇冭烦瓒呮椂娆℃暟
-	Enable            bool   `mapstructure:"enable"`
+	DeviceID           string `mapstructure:"device-id"`
+	Username           string `mapstructure:"username"`
+	Password           string `mapstructure:"password"`
+	ServerAddr         string `mapstructure:"server-addr"`
+	ServerPort         string `mapstructure:"server-port"`
+	Proto              string `mapstructure:"proto" `             // http, https
+	UploadType         string `mapstructure:"upload-type"`        // binary, url
+	ChannelNo          string `mapstructure:"channel-number"`     // 閫氶亾鍙�, 鍚宨d
+	HeartbeatInterval  int    `mapstructure:"heartbeat-interval"` // 蹇冭烦鍛ㄦ湡
+	HeartbeatFailCount int    `mapstructure:"heartbeat-count"`    // 蹇冭烦瓒呮椂娆℃暟
+	Enable             bool   `mapstructure:"enable"`
 }
 
 type logConfig struct {
@@ -97,5 +97,13 @@
 		ForwardConf.RetryInterval = 5
 	}
 
+	if ClientConf.HeartbeatInterval == 0 {
+		ClientConf.HeartbeatInterval = 30
+	}
+
+	if ClientConf.Proto == "" {
+		ClientConf.Proto = "http"
+	}
+
 	logger.SetLogLevel(LogConf.Level)
 }

--
Gitblit v1.8.0