config

package
v2.4.3 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultConfig is the default configuration that is used when no
	// configuration file is provided
	DefaultConfig = &Config{
		DefaultModule: "tcp",
		Modules: map[string]Module{
			"tcp": Module{
				Prober: "tcp",
			},
			"http": Module{
				Prober: "https",
			},
			"https": Module{
				Prober: "https",
			},
			"file": Module{
				Prober: "file",
			},
			"kubernetes": Module{
				Prober: "kubernetes",
			},
			"kubeconfig": Module{
				Prober: "kubeconfig",
			},
		},
	}
)

Functions

func NewTLSConfig

func NewTLSConfig(cfg *TLSConfig) (*tls.Config, error)

NewTLSConfig creates a new tls.Config from the given TLSConfig, plus our local extensions

Types

type Config

type Config struct {
	DefaultModule string            `yaml:"default_module"`
	Modules       map[string]Module `yaml:"modules"`
}

Config configures the exporter

func LoadConfig

func LoadConfig(confFile string) (*Config, error)

LoadConfig loads configuration from a file

type HTTPSProbe

type HTTPSProbe struct {
	ProxyURL URL `yaml:"proxy_url,omitempty"`
}

HTTPSProbe configures a https probe

type KubernetesProbe

type KubernetesProbe struct {
	Kubeconfig string `yaml:"kubeconfig,omitempty"`
}

KubernetesProbe configures a kubernetes probe

type Module

type Module struct {
	Prober     string          `yaml:"prober,omitempty"`
	Target     string          `yaml:"target,omitempty"`
	Timeout    time.Duration   `yaml:"timeout,omitempty"`
	TLSConfig  TLSConfig       `yaml:"tls_config,omitempty"`
	HTTPS      HTTPSProbe      `yaml:"https,omitempty"`
	TCP        TCPProbe        `yaml:"tcp,omitempty"`
	Kubernetes KubernetesProbe `yaml:"kubernetes,omitempty"`
}

Module configures a prober

type TCPProbe

type TCPProbe struct {
	StartTLS string `yaml:"starttls,omitempty"`
}

TCPProbe configures a tcp probe

type TLSConfig

type TLSConfig struct {
	CAFile             string `yaml:"ca_file,omitempty"`
	CertFile           string `yaml:"cert_file,omitempty"`
	KeyFile            string `yaml:"key_file,omitempty"`
	ServerName         string `yaml:"server_name,omitempty"`
	InsecureSkipVerify bool   `yaml:"insecure_skip_verify"`
	// Renegotiation controls what types of TLS renegotiation are supported.
	// Supported values: never (default), once, freely.
	Renegotiation renegotiation `yaml:"renegotiation,omitempty"`
}

TLSConfig is a superset of config.TLSConfig that supports TLS renegotiation

type URL

type URL struct {
	*url.URL
}

URL is a custom URL type that allows validation at configuration load time

func (*URL) UnmarshalYAML

func (u *URL) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface for URLs.

Jump to

Keyboard shortcuts

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