config

package
v0.0.0-...-926ca78 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToYAML

func ToYAML(w io.Writer, cfg *Config) error

ToYAML encodes the given configuration to the writer as YAML

Types

type Config

type Config struct {
	Targets []TargetConfig `yaml:"targets"`

	Ping struct {
		Interval duration `yaml:"interval"`
		Timeout  duration `yaml:"timeout"`
		History  int      `yaml:"history-size"`
		Size     uint16   `yaml:"payload-size"`
	} `yaml:"ping"`

	DNS struct {
		Refresh    duration `yaml:"refresh"`
		Nameserver string   `yaml:"nameserver"`
	} `yaml:"dns"`

	Options struct {
		DisableIPv6 bool `yaml:"disableIPv6"` // prohibits DNS resolved IPv6 addresses
		DisableIPv4 bool `yaml:"disableIPv4"` // prohibits DNS resolved IPv4 addresses
	} `yaml:"options"`
}

Config represents configuration for the exporter.

func FromYAML

func FromYAML(r io.Reader) (*Config, error)

FromYAML reads YAML from reader and unmarshals it to Config.

func (*Config) TargetConfigByAddr

func (cfg *Config) TargetConfigByAddr(addr string) TargetConfig

type TargetConfig

type TargetConfig struct {
	Addr   string
	Labels map[string]string
}

func (TargetConfig) MarshalYAML

func (d TargetConfig) MarshalYAML() (interface{}, error)

func (*TargetConfig) UnmarshalYAML

func (d *TargetConfig) UnmarshalYAML(unmashal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler interface.

Jump to

Keyboard shortcuts

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