tele_config

package
v0.210704.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2021 License: CC0-1.0 Imports: 6 Imported by: 0

Documentation

Overview

Separate package is workaround to import cycles.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ExecOnState string `hcl:"exec_on_state"`

	LogDebug     bool `hcl:"log_debug"`
	MqttLogDebug bool `hcl:"mqtt_log_debug"`

	MqttBroker string `hcl:"mqtt_broker"`
	TLS        TLS    `hcl:"tls"`

	Connect *Connect `hcl:"connect"`

	Listens []Listen `hcl:"listen"`

	RoleMembersAdmin   []string `hcl:"role_admin"`
	RoleMembersControl []string `hcl:"role_control"`
	RoleMembersMonitor []string `hcl:"role_monitor"`
	SecretsPath        string   `hcl:"secrets"`

	Mode Mode `hcl:"-"`
}

func (*Config) Disable

func (c *Config) Disable()

func (*Config) EnableClient

func (c *Config) EnableClient(role Role) error

Prepare Config in client mode. Use endpoint Connect if available or first Listen allowing the role.

func (*Config) EnableServer

func (c *Config) EnableServer() error

func (*Config) SetMode

func (c *Config) SetMode(m string)

type Connect

type Connect struct {
	ClientID          string `hcl:"clientid"`
	URL               string `hcl:"url"`
	TLS               TLS    `hcl:"tls"`
	KeepaliveSec      int    `hcl:"keepalive_sec"`
	PingTimeoutSec    int    `hcl:"ping_timeout_sec"`
	NetworkTimeoutSec int    `hcl:"network_timeout_sec"`
}

type Listen

type Listen struct {
	URL               string   `hcl:"url,key"`
	TLS               TLS      `hcl:"tls"`
	KeepaliveSec      int      `hcl:"keepalive_sec"`
	NetworkTimeoutSec int      `hcl:"network_timeout_sec"`
	AllowRoles        []string `hcl:"allow_roles"`
}

type Mode

type Mode string
const (
	ModeDisabled Mode = ""
	ModeClient   Mode = "client"
	ModeServer   Mode = "server"
	ModeTax      Mode = "tax"
	ModeCommand  Mode = "command"
	ModeSponge   Mode = "sponge"
)

type Role

type Role string
const (
	RoleInvalid Role = ""
	RoleAll     Role = "_all"
	RoleAdmin   Role = "admin"
	RoleControl Role = "control"
	RoleMonitor Role = "monitor"
	RoleVender  Role = "vender"
)

type TLS

type TLS struct {
	CaFile   string `hcl:"ca_file"`
	PSK      string `hcl:"psk"` // secret
	CertFile string `hcl:"cert_file"`
	KeyFile  string `hcl:"key_file"`
}

func (*TLS) TLSConfig

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

Jump to

Keyboard shortcuts

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