Documentation
¶
Index ¶
- Constants
- type Broker
- type Certificate
- type Client
- type ClientInfo
- type HTTPJsonData
- type HTTPSession
- type HTTPSessions
- type Limiter
- type MQTTProxy
- func (mp *MQTTProxy) Category() supervisor.ObjectCategory
- func (mp *MQTTProxy) Close()
- func (mp *MQTTProxy) DefaultSpec() interface{}
- func (mp *MQTTProxy) Inherit(superSpec *supervisor.Spec, previousGeneration supervisor.Object)
- func (mp *MQTTProxy) Init(superSpec *supervisor.Spec)
- func (mp *MQTTProxy) Kind() string
- func (mp *MQTTProxy) Status() *supervisor.Status
- type Message
- type PacketType
- type RateLimit
- type Rule
- type Session
- type SessionInfo
- type SessionManager
- type SessionStore
- type Spec
- type TopicManager
- type When
Constants ¶
const ( // Connected is MQTT client status of Connected Connected = 1 // Disconnected is MQTT client status of Disconnected Disconnected = 2 // QoS0 for "At most once" QoS0 byte = 0 // QoS1 for "At least once QoS1 byte = 1 // QoS2 for "Exactly once" QoS2 byte = 2 )
const ( // Category is the category of MQTTProxy. Category = supervisor.CategoryBusinessController // Kind is the kind of MQTTProxy. Kind = "MQTTProxy" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Certificate ¶
type Certificate struct { Name string `yaml:"name" jsonschema:"required"` Cert string `yaml:"cert" jsonschema:"required"` Key string `yaml:"key" jsonschema:"required"` }
Certificate describes TLS certifications.
type Client ¶
Client represents a MQTT client connection in Broker
func (*Client) Delete ¶ added in v1.4.1
func (c *Client) Delete(key interface{})
Delete delete key-value pair in Client kv map
type ClientInfo ¶
type ClientInfo struct {
// contains filtered or unexported fields
}
ClientInfo is basic information for client
type HTTPJsonData ¶
type HTTPJsonData struct { Topic string `json:"topic"` QoS int `json:"qos"` Payload string `json:"payload"` Base64 bool `json:"base64"` Distributed bool `json:"distributed"` }
HTTPJsonData is json data received from http endpoint used to send back to clients
type HTTPSession ¶ added in v1.4.1
HTTPSession is json data used for session related operations, like get all sessions and delete some sessions
type HTTPSessions ¶ added in v1.4.1
type HTTPSessions struct {
Sessions []*HTTPSession `json:"sessions"`
}
HTTPSessions is json data used for session related operations, like get all sessions and delete some sessions
type Limiter ¶ added in v1.4.1
type Limiter struct {
// contains filtered or unexported fields
}
Limiter is a rate limiter for MQTTProxy
type MQTTProxy ¶
type MQTTProxy struct {
// contains filtered or unexported fields
}
MQTTProxy implements MQTT proxy in EG
func (*MQTTProxy) Category ¶
func (mp *MQTTProxy) Category() supervisor.ObjectCategory
Category returns the category of MQTTProxy.
func (*MQTTProxy) DefaultSpec ¶
func (mp *MQTTProxy) DefaultSpec() interface{}
DefaultSpec returns the default spec of MQTTProxy.
func (*MQTTProxy) Inherit ¶
func (mp *MQTTProxy) Inherit(superSpec *supervisor.Spec, previousGeneration supervisor.Object)
Inherit inherits previous generation of WebSocketServer.
func (*MQTTProxy) Init ¶
func (mp *MQTTProxy) Init(superSpec *supervisor.Spec)
Init initializes Function.
func (*MQTTProxy) Status ¶
func (mp *MQTTProxy) Status() *supervisor.Status
Status returns the Status of MQTTProxy.
type Message ¶
type Message struct { Topic string `yaml:"topic"` B64Payload string `yaml:"b64Payload"` QoS int `yaml:"qos"` }
Message is the message send from broker to client
type PacketType ¶ added in v1.5.0
type PacketType string
PacketType is mqtt packet type
const ( // Connect is connect type of MQTT packet Connect PacketType = "Connect" // Disconnect is disconnect type of MQTT packet Disconnect PacketType = "Disconnect" // Publish is publish type of MQTT packet Publish PacketType = "Publish" // Subscribe is subscribe type of MQTT packet Subscribe PacketType = "Subscribe" // Unsubscribe is unsubscribe type of MQTT packet Unsubscribe PacketType = "Unsubscribe" )
type RateLimit ¶ added in v1.4.1
type RateLimit struct { RequestRate int `yaml:"requestRate" jsonschema:"omitempty"` BytesRate int `yaml:"bytesRate" jsonschema:"omitempty"` TimePeriod int `yaml:"timePeriod" jsonschema:"omitempty"` }
RateLimit describes rate limit for connection or publish. requestRate: max allowed request in time period timePeriod: max allowed bytes in time period timePeriod: time of seconds to count requestRate and bytesRate, default 1 second
type Rule ¶ added in v1.5.0
type Rule struct { When *When `yaml:"when" jsonschema:"omitempty"` Pipeline string `yaml:"pipeline" jsonschema:"omitempty"` }
Rule used to route MQTT packets to different pipelines
type Session ¶
Session includes the information about the connect between client and broker, such as topic subscribe, not-send messages, etc.
type SessionInfo ¶
type SessionInfo struct { // map subscribe topic to qos EGName string `yaml:"egName"` Name string `yaml:"name"` Topics map[string]int `yaml:"topics"` ClientID string `yaml:"clientID"` CleanFlag bool `yaml:"cleanFlag"` }
SessionInfo is info about session that will be put into etcd for persistency
type SessionManager ¶
type SessionManager struct {
// contains filtered or unexported fields
}
SessionManager manage the status of session for clients
type SessionStore ¶
type SessionStore struct {
// contains filtered or unexported fields
}
SessionStore for session store, key is session clientID, value is session yaml marshal value
type Spec ¶
type Spec struct { EGName string `yaml:"-"` Name string `yaml:"-"` Port uint16 `yaml:"port" jsonschema:"required"` UseTLS bool `yaml:"useTLS" jsonschema:"omitempty"` Certificate []Certificate `yaml:"certificate" jsonschema:"omitempty"` TopicCacheSize int `yaml:"topicCacheSize" jsonschema:"omitempty"` MaxAllowedConnection int `yaml:"maxAllowedConnection" jsonschema:"omitempty"` ConnectionLimit *RateLimit `yaml:"connectionLimit" jsonschema:"omitempty"` ClientPublishLimit *RateLimit `yaml:"clientPublishLimit" jsonschema:"omitempty"` Rules []*Rule `yaml:"rules" jsonschema:"omitempty"` }
Spec describes the MQTTProxy.
type TopicManager ¶
TopicManager to manage topic subscribe and unsubscribe in MQTT
type When ¶ added in v1.5.0
type When struct {
PacketType PacketType `yaml:"packetType" jsonschema:"omitempty"`
}
When is used to check if MQTT packet match this pipeline