zhangzengfei
2024-05-16 e5be7a7ed63d4b4e4267057d84b77c4bd3c16781
config/config.go
@@ -13,21 +13,24 @@
   Mode     string `mapstructure:"mode"`
   Host     string `mapstructure:"host"`
   Port     string `mapstructure:"port"`
   Realm    string `mapstructure:"realm"`
   Username string `mapstructure:"username"`
   Password string `mapstructure:"password"`
   Role     string `mapstructure:"role"` // agent 设备端, proxy 1400中转 不处理deivce, server 全功能
}
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"`     // 通道号, 同id
   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"`     // 通道号, 同id
   HeartbeatInterval  int    `mapstructure:"heartbeat-interval"` // 心跳周期
   HeartbeatFailCount int    `mapstructure:"heartbeat-count"`    // 心跳超时次数
   Enable             bool   `mapstructure:"enable"`
}
type logConfig struct {
@@ -97,5 +100,13 @@
      ForwardConf.RetryInterval = 5
   }
   if ClientConf.HeartbeatInterval == 0 {
      ClientConf.HeartbeatInterval = 30
   }
   if ClientConf.Proto == "" {
      ClientConf.Proto = "http"
   }
   logger.SetLogLevel(LogConf.Level)
}