mqttmsgserver

package
v0.0.0-...-147f0cf Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MqttServerConfig

type MqttServerConfig struct {
	// Host is the server address, default is outbound IP address
	Host string `yaml:"host,omitempty"`
	// Port is the server TLS port, default is 8883
	Port int `yaml:"port,omitempty"`
	// WSPort is the server Websocket port, default is 8884
	WSPort int `yaml:"wsPort,omitempty"`

	LogLevel string `yaml:"logLevel,omitempty"` // default: warn
	LogFile  string `yaml:"logFile,omitempty"`  // default: no logfile

	DataDir string `yaml:"dataDir,omitempty"` // default is server default

	// Disable running the embedded messaging server. Default False
	NoAutoStart bool `yaml:"noAutoStart,omitempty"`

	// the in-proc UDS name to use. Default is "@/MqttInMemUDSProd" (see MqttHubTransport)
	InMemUDSName string `yaml:"inMemUDSName,omitempty"`

	// The certs and keys are set directly
	CaCert    *x509.Certificate `yaml:"-"` // preset, load, or error
	CaKey     *ecdsa.PrivateKey `yaml:"-"` // preset, load, or error
	ServerKey *ecdsa.PrivateKey `yaml:"-"` // generated, loaded  (used as signing key)
	ServerTLS *tls.Certificate  `yaml:"-"` // generated

}

MqttServerConfig holds the mqtt broker configuration

func (*MqttServerConfig) Setup

func (cfg *MqttServerConfig) Setup(keysDir, storesDir string, writeChanges bool) (err error)

Setup the mqtt server config. This applies sensible defaults to Config.

Any existing values that are previously set remain unchanged. Missing values are created. Certs and keys are loaded if not provided.

Set 'writeChanges' to persist generated server cert, operator and account keys

keysDir is the default key location
storesDir is the data storage root (default $HOME/stores)
writeChanges writes generated account key to the keysDir

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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