auth

package
v2.5.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authentication

type Authentication interface {
	// Init applies the initial configuration.
	Init(*mqtt.ClientOptions) error

	// Update updates the authentication options.
	Update(*mqtt.ClientOptions) error

	// ReconnectAfter returns a time.Duration after which the MQTT client must re-connect.
	// Note: return 0 to disable the periodical re-connect feature.
	ReconnectAfter() time.Duration
}

Authentication defines the authentication interface.

func NewGenericAuthentication

func NewGenericAuthentication(config GenericConfig) (Authentication, error)

NewGenericAuthentication creates a GenericAuthentication.

type GenericAuthentication

type GenericAuthentication struct {
	// contains filtered or unexported fields
}

GenericAuthentication implements a generic MQTT authentication.

func (*GenericAuthentication) Init

Init applies the initial configuration.

func (*GenericAuthentication) ReconnectAfter

func (a *GenericAuthentication) ReconnectAfter() time.Duration

ReconnectAfter returns a time.Duration after which the MQTT client must re-connect. Note: return 0 to disable the periodical re-connect feature.

func (*GenericAuthentication) Update

func (a *GenericAuthentication) Update(opts *mqtt.ClientOptions) error

Update updates the authentication options.

type GenericConfig

type GenericConfig struct {
	Server               string
	Username             string
	Password             string
	CACert               string        `mapstructure:"ca_cert"`
	TLSCert              string        `mapstructure:"tls_cert"`
	TLSKey               string        `mapstructure:"tls_key"`
	QOS                  uint8         `mapstructure:"qos"`
	CleanSession         bool          `mapstructure:"clean_session"`
	ClientID             string        `mapstructure:"client_id"`
	MaxReconnectInterval time.Duration `mapstructure:"max_reconnect_interval"`
}

GenericConfig defines the generic configuration.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL