config

package
Version: v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2021 License: GPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PresetConfig = Config{
		InternalConfig: PresetInternalConfig,
	}
	PresetInternalConfig = InternalConfig{
		LogFile:     "/var/log/gop4d.log",
		Development: false,
	}
)

Preset params.

Functions

func StoreFile

func StoreFile(fileName string, c *Config) error

Types

type Config

type Config struct {
	sync.Mutex
	InternalConfig InternalConfig `yaml:"internal,omitempty"`
	Setting        SettingConfig  `yaml:"settings,omitempty"`
	Original       string
	Configpath     string
}

Config is the top-level configuration

func BuildPresetConfig

func BuildPresetConfig() *Config

func Load

func Load(s string) (*Config, error)

Load parses the YAML input s into a Config.

func LoadFile

func LoadFile(filename string) (*Config, error)

LoadFile parses the given YAML file into a Config.

func (*Config) Validate

func (c *Config) Validate() error

type FunctionsConfig

type FunctionsConfig struct {
	Action      string `yaml:"action,omitempty"`
	TriggerAddr string `yaml:"triggerAddr,omitempty"`
	SAddr       string `yaml:"actionSrcAddr,omitempty"`
	DAddr       string `yaml:"actionDstAddr,omitempty"`
	Nexthop     string `yaml:"nexthop,omitempty"`
	Flaver      string `yaml:"flaver,omitempty"`
	V4AddrSPos  string `yaml:"v4AddrSPos,omitempty"`
	V4AddrDPos  string `yaml:"v4AddrDPos,omitempty"`
}

func (*FunctionsConfig) Validate

func (c *FunctionsConfig) Validate() error

type InternalConfig

type InternalConfig struct {
	LogFile     string   `yaml:"logfile,omitempty"`
	Development bool     `yaml:"development,omitempty"`
	Devices     []string `yaml:"devices,omitempty"`
}

func (*InternalConfig) Validate

func (c *InternalConfig) Validate() error

type SettingConfig

type SettingConfig struct {
	Functions []FunctionsConfig `yaml:"functions,omitempty"`
	Transitv4 []Transitv4Config `yaml:"transitv4,omitempty"`
	Transitv6 []Transitv6Config `yaml:"transitv6,omitempty"`
}

func (*SettingConfig) Validate

func (c *SettingConfig) Validate() error

type Transitv4Config

type Transitv4Config struct {
	Action      string   `yaml:"action,omitempty"`
	TriggerAddr string   `yaml:"triggerAddr,omitempty"`
	SAddr       string   `yaml:"actionSrcAddr,omitempty"`
	DAddr       string   `yaml:"actionDstAddr,omitempty"`
	Segments    []string `yaml:"segments,omitempty"`
}

func (*Transitv4Config) Validate

func (c *Transitv4Config) Validate() error

type Transitv6Config

type Transitv6Config struct {
	Action      string   `yaml:"action,omitempty"`
	TriggerAddr string   `yaml:"triggerAddr,omitempty"`
	SAddr       string   `yaml:"actionSrcAddr,omitempty"`
	DAddr       string   `yaml:"actionDstAddr,omitempty"`
	Segments    []string `yaml:"segments,omitempty"`
}

func (*Transitv6Config) Validate

func (c *Transitv6Config) Validate() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL