zhangzengfei
2024-04-29 5abbb114d703b40d2a42e9e3eecdadcb6d341dcf
config/config.go
@@ -14,20 +14,21 @@
   Host     string `mapstructure:"host"`
   Port     string `mapstructure:"port"`
   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 +98,13 @@
      ForwardConf.RetryInterval = 5
   }
   if ClientConf.HeartbeatInterval == 0 {
      ClientConf.HeartbeatInterval = 30
   }
   if ClientConf.Proto == "" {
      ClientConf.Proto = "http"
   }
   logger.SetLogLevel(LogConf.Level)
}