#14 支持设置密码签名类型

This commit is contained in:
ctlove0523 2022-03-01 00:00:47 +08:00
parent 8e4302495e
commit 30954e08fe
1 changed files with 7 additions and 1 deletions

View File

@ -69,6 +69,7 @@ const (
type DeviceConfig struct { type DeviceConfig struct {
Id string Id string
Password string Password string
VerifyTimestamp bool
Servers string Servers string
Qos byte Qos byte
BatchSubDeviceSize int BatchSubDeviceSize int
@ -130,6 +131,7 @@ func (lcc *LogCollectionConfig) getEndTime() string {
type baseIotDevice struct { type baseIotDevice struct {
Id string // 设备Id平台又称为deviceId Id string // 设备Id平台又称为deviceId
Password string // 设备密码 Password string // 设备密码
VerifyTimestamp bool
AuthType uint8 // 鉴权类型0密码认证1x.509证书认证 AuthType uint8 // 鉴权类型0密码认证1x.509证书认证
ServerCaPath string // 平台CA证书 ServerCaPath string // 平台CA证书
CertFilePath string // 设备证书路径 CertFilePath string // 设备证书路径
@ -320,7 +322,11 @@ func assembleClientId(device *baseIotDevice) string {
segments := make([]string, 4) segments := make([]string, 4)
segments[0] = device.Id segments[0] = device.Id
segments[1] = "0" segments[1] = "0"
segments[2] = "0" if device.VerifyTimestamp {
segments[2] = "1"
} else {
segments[2] = "0"
}
segments[3] = timeStamp() segments[3] = timeStamp()
return strings.Join(segments, "_") return strings.Join(segments, "_")