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 GetPublish(data []byte) (topic string, payload []byte)
- func PublishToDev(topic string, payload []byte) []byte
- func RefreshToken(tokenString string, secretKey string) (string, error)
- type Core
- type DevConn
- type DevPublish
- type Direction
- type InnerPublish
- type OssJwtToken
- type TopicInfo
Constants ¶
View Source
const ( Sub = "Sub" //订阅 Pub = "Pub" //发布 )
View Source
const ( TopicHeadThing = "$thing" TopicHeadOta = "$ota" TopicHeadConfig = "$config" TopicHeadLog = "$log" TopicHeadShadow = "$shadow" TopicHeadGateway = "$gateway" )
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 { Timestamp int64 `json:"timestamp"` ProductID string `json:"productID"` DeviceName string `json:"deviceName"` Topic string `json:"topic"` Payload []byte `json:"payload"` }
DevPublish ddsvr 发布设备发布信息的结构体
type InnerPublish ¶
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.