config

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Listen      string    `yaml:"listen"`
	ProbePath   string    `yaml:"probe_path"`
	MetricsPath string    `yaml:"metrics_path"`
	Timeout     float64   `yaml:"timeout"`
	Devices     []*Device `yaml:"devices"`
	Global      Global    `yaml:"global"`
	// contains filtered or unexported fields
}

func DefaultConfig

func DefaultConfig() Config

func (*Config) GetDevice added in v0.4.0

func (c *Config) GetDevice(name string) (*Device, bool)

func (*Config) UnmarshalYAML

func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error

type Device

type Device struct {
	Name     string   `yaml:"name"`
	Address  string   `yaml:"address"`
	Username *string  `yaml:"username"`
	Password *string  `yaml:"password"`
	Options  *Options `yaml:"options"`
}

type Global

type Global struct {
	Username string  `yaml:"username"`
	Password string  `yaml:"password"`
	Options  Options `yaml:"options"`
}

type Options

type Options struct {
	ExportOLT      bool `yaml:"export_olt"`
	ExportONUs     bool `yaml:"export_onus"`
	ExportMACTable bool `yaml:"export_mac_table"`
}

func DefaultOptions

func DefaultOptions() Options

func (*Options) UnmarshalYAML

func (o *Options) UnmarshalYAML(unmarshal func(interface{}) error) error

type SafeConfig

type SafeConfig struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func New

func New(configFile string) SafeConfig

func (*SafeConfig) Get

func (sc *SafeConfig) Get() *Config

func (*SafeConfig) LoadConfig

func (sc *SafeConfig) LoadConfig() (err error)

Jump to

Keyboard shortcuts

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