cloud

package
v0.0.0-...-c161377 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MqttBrokerURL   = "tls://mqtt.googleapis.com:443"
	CACertsURL      = "https://pki.goog/roots.pem"
	ProtocolVersion = 4 // corresponds to MQTT 3.1.1
	ReconnectDelay  = 20 * time.Second
	TokenDuration   = 24 * time.Hour // maximum 24 h
)

Variables

This section is empty.

Functions

func CreateJWT

func CreateJWT(projectID, privateKey, algorithm string, iat, exp time.Time) (string, error)

CreateJWT creates a Cloud IoT Core JWT for the given project id.

func GetCACertPool

func GetCACertPool() *x509.CertPool

GetCACertPool gets the latest Google CA certs from 'https://pki.goog/roots.pem'

Types

type Config

type Config struct {
	ProjectID  string `yaml:"projectID"`
	Region     string `yaml:"region"`
	RegistryID string `yaml:"registryID"`
	DeviceID   string `yaml:"deviceID"`
	PrivateKey string `yaml:"privateKey"`
	Algorithm  string `yaml:"algorithm"`
	StorePath  string `yaml:"storePath"`
}

Config stores the data for connecting to the MQTT broker.

type Device

type Device interface {
	Name() string
	Location() string
	DeviceID() string
	Kind() string
	Stop() error
}

Device is a communication channel to a local network endpoint.

Jump to

Keyboard shortcuts

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