From 30954e08fe3ddaf9587da18f9b54de39daa91c9f Mon Sep 17 00:00:00 2001 From: ctlove0523 <478309639@qq.com> Date: Tue, 1 Mar 2022 00:00:47 +0800 Subject: [PATCH] =?UTF-8?q?#14=20=E6=94=AF=E6=8C=81=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E5=AF=86=E7=A0=81=E7=AD=BE=E5=90=8D=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- base_device.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/base_device.go b/base_device.go index 732fd08..312a9da 100644 --- a/base_device.go +++ b/base_device.go @@ -69,6 +69,7 @@ const ( type DeviceConfig struct { Id string Password string + VerifyTimestamp bool Servers string Qos byte BatchSubDeviceSize int @@ -130,6 +131,7 @@ func (lcc *LogCollectionConfig) getEndTime() string { type baseIotDevice struct { Id string // 设备Id,平台又称为deviceId Password string // 设备密码 + VerifyTimestamp bool AuthType uint8 // 鉴权类型,0:密码认证;1:x.509证书认证 ServerCaPath string // 平台CA证书 CertFilePath string // 设备证书路径 @@ -320,7 +322,11 @@ func assembleClientId(device *baseIotDevice) string { segments := make([]string, 4) segments[0] = device.Id segments[1] = "0" - segments[2] = "0" + if device.VerifyTimestamp { + segments[2] = "1" + } else { + segments[2] = "0" + } segments[3] = timeStamp() return strings.Join(segments, "_")