auth

package
v2.7.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2019 License: MIT Imports: 9 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 NewGCPCloudIoTCoreAuthentication

func NewGCPCloudIoTCoreAuthentication(config GCPCloudIoTCoreConfig) (Authentication, error)

NewGCPCloudIoTCoreAuthentication create a GCPCloudIoTCoreAuthentication.

func NewGenericAuthentication

func NewGenericAuthentication(config GenericConfig) (Authentication, error)

NewGenericAuthentication creates a GenericAuthentication.

type GCPCloudIoTCoreAuthentication

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

GCPCloudIoTCoreAuthentication implements the Google Cloud IoT Core authentication.

func (*GCPCloudIoTCoreAuthentication) Init

Init applies the initial configuration.

func (*GCPCloudIoTCoreAuthentication) ReconnectAfter

func (a *GCPCloudIoTCoreAuthentication) 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 (*GCPCloudIoTCoreAuthentication) Update

Update updates the authentication options.

type GCPCloudIoTCoreConfig

type GCPCloudIoTCoreConfig struct {
	Server        string
	DeviceID      string        `mapstructure:"device_id"`
	ProjectID     string        `mapstructure:"project_id"`
	CloudRegion   string        `mapstructure:"cloud_region"`
	RegistryID    string        `mapstructure:"registry_id"`
	JWTExpiration time.Duration `mapstructure:"jwt_expiration"`
	JWTKeyFile    string        `mapstructure:"jwt_key_file"`
}

GCPCloudIoTCoreConfig devices the Cloud IoT Core configuration.

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