config

package
v0.0.0-...-16a83fc Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_LOG_LEVEL       = "info"
	DEFAULT_SERVER_PORT     = 8080
	DEFAULT_CLIENT_INTERVAL = time.Duration(5 * time.Minute)

	MODE_SERVER = "server"
	MODE_CLIENT = "client"
	MODE_RELAY  = "relay"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientConfig

type ClientConfig struct {
	Token    string        `yaml:"token"`
	Proxy    bool          `yaml:"proxy,omitempty"`
	Domains  []string      `yaml:"domains"`
	Interval time.Duration `yaml:"interval,omitempty"`
	Endpoint string        `yaml:"endpoint,omitempty"`
}

Yaml configuration for dyndns client

type Config

type Config struct {
	LogLevel string       `yaml:"logLevel,omitempty"`
	Server   ServerConfig `yaml:"server,omitempty"`
	Client   ClientConfig `yaml:"client,omitempty"`
}

func DefaultConfig

func DefaultConfig() Config

Returns a Config with default values set

func LoadConfig

func LoadConfig(path string, mode string, env bool) (Config, error)

Loads config from file, returns error if config is invalid Arguments:

path: Path to config file
mode: Mode used, determines how the config will be validated and which values will be processed
env: Determines if enviroment variables in the file will be expanded before decoding

type ErrIncompleteSSLConfig

type ErrIncompleteSSLConfig struct{}

func (ErrIncompleteSSLConfig) Error

func (e ErrIncompleteSSLConfig) Error() string

type ErrInvalidInterval

type ErrInvalidInterval struct {
	Interval time.Duration
}

func (*ErrInvalidInterval) Error

func (e *ErrInvalidInterval) Error() string

type ErrUnknownLogLevel

type ErrUnknownLogLevel struct {
	Level string
}

func (*ErrUnknownLogLevel) Error

func (e *ErrUnknownLogLevel) Error() string

type SSLConfig

type SSLConfig struct {
	Enabled bool   `yaml:"enabled,omitempty"`
	Cert    string `yaml:"cert,omitempty"`
	Key     string `yaml:"key,omitempty"`
}

type ServerConfig

type ServerConfig struct {
	Port    int       `yaml:"port"`
	Domains []string  `yaml:"domains,omitempty"`
	SSL     SSLConfig `yaml:"ssl,omitempty"`
}

Yaml configuration for dyndns server

Jump to

Keyboard shortcuts

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