Documentation ¶
Overview ¶
Package auth defines the authentication interface for MQTT.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Info ¶
type Info struct { Interface RemoteAddr string Transport string ServerName string ClientID string Username string Password []byte Metadata interface{} }
Info for an MQTT user
type Interface ¶
type Interface interface { // Connect, extend context or return error code Connect(ctx context.Context, info *Info) (context.Context, error) // Subscribe allows the auth plugin to replace wildcards or to lower the QoS of a subscription. // For example, a client requesting a subscription to "#" may be rewritten to "foo" if they are only allowed to subscribe to that topic. Subscribe(info *Info, requestedTopic string, requestedQoS byte) (acceptedTopic string, acceptedQoS byte, err error) // Can the session read from the (application-layer) topic CanRead(info *Info, topic ...string) bool // Can the session write to the (application-layer) topic CanWrite(info *Info, topic ...string) bool }
Interface for MQTT authentication
func InterfaceFromContext ¶
InterfaceFromContext returns the auth interface from the context
Click to show internal directories.
Click to hide internal directories.