Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrDispatcherClosed = fmt.Errorf("dispatcher already closed")
ErrDispatcherClosed is returned if the dispatcher is closed
Functions ¶
func IsTwoWayTLS ¶
IsTwoWayTLS check two-way tls connection
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
A Client connects to a broker and handles the transmission of packets
type ClientInfo ¶
type ClientInfo struct { Address string `yaml:"address" json:"address"` Username string `yaml:"username" json:"username"` Password string `yaml:"password" json:"password"` utils.Certificate `yaml:",inline" json:",inline"` ClientID string `yaml:"clientid" json:"clientid"` CleanSession bool `yaml:"cleansession" json:"cleansession"` Timeout time.Duration `yaml:"timeout" json:"timeout" default:"30s"` Interval time.Duration `yaml:"interval" json:"interval" default:"1m"` KeepAlive time.Duration `yaml:"keepalive" json:"keepalive" default:"1m"` BufferSize int `yaml:"buffersize" json:"buffersize" default:"10"` ValidateSubs bool `yaml:"validatesubs" json:"validatesubs"` Subscriptions []TopicInfo `yaml:"subscriptions" json:"subscriptions" default:"[]"` }
ClientInfo mqtt client config
type Dialer ¶
The Dialer handles connecting to a server and creating a connection.
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher dispatcher of mqtt client
func NewDispatcher ¶
func NewDispatcher(cc ClientInfo, log logger.Logger) *Dispatcher
NewDispatcher creates a new dispatcher
func (*Dispatcher) Publish ¶
func (d *Dispatcher) Publish(pid uint16, qos uint32, topic string, payload []byte, retain bool, duplicate bool) error
Publish sends a publish packet
type Future ¶
type Future struct {
// contains filtered or unexported fields
}
A Future is a low-level future type that can be extended to transport custom information.
type Handler ¶
type Handler interface { ProcessPublish(*packet.Publish) error ProcessPuback(*packet.Puback) error ProcessError(error) }
Handler MQTT message handler interface
type HandlerWrapper ¶
type HandlerWrapper struct {
// contains filtered or unexported fields
}
HandlerWrapper MQTT message handler wrapper
func NewHandlerWrapper ¶
func NewHandlerWrapper(onPublish ProcessPublish, onPuback ProcessPuback, onError ProcessError) *HandlerWrapper
NewHandlerWrapper creates a new handler wrapper
func (*HandlerWrapper) ProcessError ¶
func (h *HandlerWrapper) ProcessError(err error)
ProcessError handles error
func (*HandlerWrapper) ProcessPuback ¶
func (h *HandlerWrapper) ProcessPuback(pkt *packet.Puback) error
ProcessPuback handles puback packet
func (*HandlerWrapper) ProcessPublish ¶
func (h *HandlerWrapper) ProcessPublish(pkt *packet.Publish) error
ProcessPublish handles publish packet
type Launcher ¶
The Launcher helps with launching a server and accepting connections.
func NewLauncher ¶
func NewLauncher(c utils.Certificate) (*Launcher, error)
NewLauncher returns a new Launcher.
type ProcessPuback ¶
ProcessPuback handles puback packet
type ProcessPublish ¶
ProcessPublish handles publish packet