v0.0.4 Latest Latest

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

Go to latest
Published: Apr 22, 2018 License: Apache-2.0 Imports: 12 Imported by: 0




This section is empty.


View Source
var PluginsDir string

PluginsDir absolute path to service plugins directory

View Source
var WorkDir string

WorkDir absolute path to service working directory


func ConfigureLog added in v0.0.4

func ConfigureLog() error

func GetHumanLogger added in v0.0.4

func GetHumanLogger() *zap.SugaredLogger

GetHumanLogger return production logger

func GetLogger

func GetLogger() *zap.SugaredLogger

GetLogger return production logger

func LoadPlugins added in v0.0.4

func LoadPlugins(path string, list []string) map[string]PluginState

LoadPlugins load plugins from path


type AuthConfig added in v0.0.4

type AuthConfig struct {
	Anonymous bool     `yaml:"anonymous,omitempty" default:"false"`
	Order     []string `yaml:"order"`

type Config added in v0.0.4

type Config struct {
	System    SystemConfig    `yaml:"system,omitempty"`
	Plugins   PluginsConfig   `yaml:"plugins,omitempty"`
	Mqtt      MqttConfig      `yaml:"mqtt,omitempty"`
	Listeners ListenersConfig `yaml:"listeners,omitempty"`
	Security  SecurityConfig  `yaml:"security,omitempty"`
	Auth      AuthConfig      `yaml:"auth,omitempty"`

Config system-wide config

func DefaultConfig added in v0.0.4

func DefaultConfig() *Config

DefaultConfig Load minimum working configuration to allow server start without user provided one

func ReadConfig added in v0.0.4

func ReadConfig() *Config

ReadConfig read service configuration

type ConsoleLogConfig added in v0.0.4

type ConsoleLogConfig struct {
	Level string `yaml:"level,omitempty"`

ConsoleLogConfig entry in system.log.console

type FileLogConfig added in v0.0.4

type FileLogConfig struct {
	File       string `yaml:"file,omitempty"`
	Level      string `yaml:"level,omitempty"`
	MaxSize    int    `yaml:"maxSize,omitempty"`
	MaxBackups int    `yaml:"maxBackups,omitempty"`
	MaxAge     int    `yaml:"maxAge,omitempty"`

FileLogConfig entry in system.log.file

type ListenersConfig added in v0.0.4

type ListenersConfig struct {
	DefaultAddr string                           `yaml:"defaultAddr,omitempty"`
	MQTT        map[string]map[string]PortConfig `yaml:"mqtt,omitempty"`


type LogConfig added in v0.0.4

type LogConfig struct {
	Timestamp bool             `yaml:"timestamp,omitempty"`
	Console   ConsoleLogConfig `yaml:"console,omitempty"`
	SysLog    *SysLogConfig    `yaml:"syslog,omitempty"`
	File      *FileLogConfig   `yaml:"file,omitempty"`

LogConfig entry in system.log

type MqttConfig added in v0.0.4

type MqttConfig struct {
	Version []string `yaml:"version,omitempty"`
	Systree struct {
		Enabled        bool `yaml:"enabled,omitempty"`
		UpdateInterval int  `yaml:"updateInterval,omitempty"`
	} `yaml:"systree,omitempty"`
	KeepAlive struct {
		Period int  `yaml:"period,omitempty"`
		Force  bool `yaml:"force,omitempty"`
	} `yaml:"keepAlive,omitempty"`
	Options struct {
		ConnectTimeout  int            `yaml:"connectTimeout,omitempty"`
		SessionDups     bool           `yaml:"sessionDups,omitempty"`
		RetainAvailable bool           `yaml:"retainAvailable,omitempty"`
		SubsOverlap     bool           `yaml:"subsOverlap,omitempty"`
		SubsID          bool           `yaml:"subsId,omitempty"`
		SubsShared      bool           `yaml:"subsShared,omitempty"`
		SubsWildcard    bool           `yaml:"subsWildcard,omitempty"`
		ReceiveMax      int            `yaml:"receiveMax,omitempty"`
		MaxPacketSize   uint32         `yaml:"maxPacketSize,omitempty"`
		MaxTopicAlias   uint16         `yaml:"maxTopicAlias,omitempty"`
		MaxQoS          packet.QosType `yaml:"maxQoS,omitempty"`
		OfflineQoS0     bool           `yaml:"offlineQoS0,omitempty"`

MqttConfig server config

type Options

type Options struct {
	// LogWithTs either display timestamp messages on log or not
	LogWithTs bool

Options global MQTT config

type PluginState added in v0.0.4

type PluginState struct {
	Plugin vlplugin.Plugin
	Errors []error

PluginState status

type PluginsConfig added in v0.0.4

type PluginsConfig struct {
	Enabled []string               `yaml:"enabled,omitempty"`
	Config  map[string]interface{} `yaml:"config,omitempty"`

PluginsConfig entry in system.plugins

type PortConfig added in v0.0.4

type PortConfig struct {
	Host string     `yaml:"host,omitempty"`
	Auth AuthConfig `yaml:"auth"`
	TLS  TLSConfig  `yaml:"tls,omitempty"`
	Path string     `yaml:"path,omitempty"`

PortConfig configuration of tcp/ssl/ws(s) listeners

type ProfilerConfig added in v0.0.4

type ProfilerConfig struct {
	Port string `yaml:"port,omitempty" json:"port,omitempty"`

ProfilerConfig configure pprof

type SecurityConfig added in v0.0.4

type SecurityConfig struct {
	TLS TLSConfig `yaml:"tls,omitempty"`

SecurityConfig system security config

type SysLogConfig added in v0.0.4

type SysLogConfig struct {
	Level string `yaml:"level,omitempty"`

SysLogConfig entry in system.log.syslog

type SystemConfig added in v0.0.4

type SystemConfig struct {
	Log      LogConfig      `yaml:"log,omitempty"`
	Profiler ProfilerConfig `json:"profiler" yaml:"profiler"`

SystemConfig entry in system

type TLSConfig added in v0.0.4

type TLSConfig struct {
	Cert string `yaml:"cert,omitempty"`
	Key  string `yaml:"key,omitempty"`

TLSConfig used by SecurityConfig or ssl/ws listeners

func (*TLSConfig) LoadConfig added in v0.0.4

func (t *TLSConfig) LoadConfig() (*tls.Config, error)

func (*TLSConfig) Validate added in v0.0.4

func (t *TLSConfig) Validate() (tls.Certificate, error)

Jump to

Keyboard shortcuts

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