Documentation ¶
Index ¶
- Constants
- func CreateToken(secretKey string, claims OssJwtToken) (string, error)
- func GetJwtToken(secretKey string, iat, seconds int64, bucket string, dir string) (string, error)
- func PublishToDev(handle string, Type string, payload []byte, productID string, ...) []byte
- func RefreshToken(tokenString string, secretKey string) (string, error)
- type Core
- type DevConn
- type DevPublish
- type Direction
- type InnerPublish
- type OssJwtToken
- type Tag
- type TopicInfo
Constants ¶
View Source
const ( DeviceRegisterUnable = 1 DeviceAutoCreateEnable = 3 EncryptionTypeCert = 1 )
View Source
const ( Sub = "Sub" //订阅 Pub = "Pub" //发布 )
View Source
const ( TopicHeadThing = "$thing" Thing = "thing" TopicHeadOta = "$ota" Ota = "ota" TopicHeadConfig = "$config" Config = "config" TopicHeadLog = "$log" Log = "log" TopicHeadShadow = "$shadow" Shadow = "shadow" TopicHeadGateway = "$gateway" Gateway = "gateway" TopicHeadExt = "$ext" Ext = "ext" )
Variables ¶
This section is empty.
Functions ¶
func CreateToken ¶
func CreateToken(secretKey string, claims OssJwtToken) (string, error)
CreateToken 创建一个token
func GetJwtToken ¶
Types ¶
type DevConn ¶
type DevConn struct { UserName string `json:"username"` Timestamp int64 `json:"timestamp"` //毫秒时间戳 Address string `json:"addr"` ClientID string `json:"clientID"` Reason string `json:"reason"` Action string `json:"action"` //登录 onLogin 登出 onLogout }
DevConn ddsvr 发布设备 连接和断连 的结构体
type DevPublish ¶
type DevPublish struct { Topic string `json:"topic"` //只用于日志记录 Timestamp int64 `json:"timestamp"` ProductID string `json:"productID"` DeviceName string `json:"deviceName"` Handle string `json:"handle"` //对应 mqtt topic的第一个 thing ota config 等等 Type string `json:"type"` //操作类型 从topic中提取 物模型下就是 property属性 event事件 action行为 Payload []byte `json:"payload"` }
DevPublish ddsvr 发布设备 发布信息 的结构体
type InnerPublish ¶
type InnerPublish struct { Handle string `json:"handle"` //对应 mqtt topic的第一个 thing ota config 等等 Type string `json:"type"` // 操作类型 从topic中提取 物模型下就是 property属性 event事件 action行为 Payload []byte `json:"payload"` ProductID string `json:"productID"` DeviceName string `json:"deviceName"` }
InnerPublish 用于其他服务 发送给ddsvr 转发给设备的
type OssJwtToken ¶
OssJwtToken Custom claims structure
func ParseToken ¶
func ParseToken(tokenString string, secretKey string) (*OssJwtToken, error)
解析 token
Click to show internal directories.
Click to hide internal directories.