config

package
v0.41.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConsulKVEntriesPrefix   = "gsloc/entries/"
	ConsulPrefixTagRatio    = "gsloc_ratio="
	ConsulPrefixTagTag      = "gsloc_tag-"
	ConsulPrefixTagDc       = "gsloc_dc="
	ConsulPrefixTagDisabled = "gsloc_disabled"
	ConsulMetaEntryKey      = "gsloc_entry"
	ConsulMetaDcKey         = "gsloc_dc"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicAuth added in v0.8.0

type BasicAuth struct {
	Username string `yaml:"username"`
	Password string `yaml:"password"`
}

func (*BasicAuth) GetBasicAuth added in v0.8.0

func (c *BasicAuth) GetBasicAuth() string

func (*BasicAuth) UnmarshalYAML added in v0.8.0

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

type CIDR

type CIDR struct {
	IpNet *net.IPNet
}

func (*CIDR) UnmarshalYAML

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

type Config

type Config struct {
	DNSServer         *DNSServerConfig   `yaml:"dns_server"`
	HTTPServer        *HTTPServerConfig  `yaml:"http_server"`
	Log               *Log               `yaml:"log"`
	DcName            string             `yaml:"dc_name"`
	ConsulConfig      *ConsulConfig      `yaml:"consul_config"`
	HealthCheckConfig *HealthCheckConfig `yaml:"healthcheck_config"`
	GeoLoc            *GeoLoc            `yaml:"geo_loc"`
	MetricsConfig     *MetricsConfig     `yaml:"metrics"`
}

func LoadConfig

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

func (*Config) UnmarshalYAML

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

type ConsulConfig

type ConsulConfig struct {
	Addr          string    `yaml:"addr"`
	Scheme        string    `yaml:"scheme"`
	Token         string    `yaml:"token"`
	Username      string    `yaml:"username"`
	Password      string    `yaml:"password"`
	ScrapInterval *Duration `yaml:"scrap_interval"`
}

func (*ConsulConfig) UnmarshalYAML

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

type DNSServerConfig

type DNSServerConfig struct {
	Listen         string  `yaml:"listen"`
	TrustEdns      bool    `yaml:"trust_edns"`
	AllowedInspect []*CIDR `yaml:"allowed_inspect"`
}

func (*DNSServerConfig) UnmarshalYAML

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

type DcPosition

type DcPosition struct {
	DcName   string   `yaml:"dc_name"`
	Position Position `yaml:"position"`
	Cidrs    []*CIDR  `yaml:"cidrs"`
}

func (*DcPosition) UnmarshalYAML

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

type Duration

type Duration time.Duration

func (*Duration) UnmarshalYAML

func (d *Duration) UnmarshalYAML(unmarshal func(interface{}) error) error

type GeoDb

type GeoDb struct {
	Path   string         `yaml:"path"`
	Reader *geoip2.Reader `yaml:"-"`
}

func (*GeoDb) UnmarshalYAML

func (g *GeoDb) UnmarshalYAML(unmarshal func(interface{}) error) error

type GeoLoc

type GeoLoc struct {
	DcPositions []*DcPosition `yaml:"dc_positions"`
	GeoDb       *GeoDb        `yaml:"geo_db"`
}

func (*GeoLoc) UnmarshalYAML

func (g *GeoLoc) UnmarshalYAML(unmarshal func(interface{}) error) error

type HTTPServerConfig

type HTTPServerConfig struct {
	Listen          string `yaml:"listen"`
	ListenLocalPort uint   `yaml:"listen_local_port"`
	TLSPem          TLSPem `yaml:"tls_pem"`
}

func (*HTTPServerConfig) UnmarshalYAML

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

type HealthCheckConfig

type HealthCheckConfig struct {
	HealthcheckAddress string                     `yaml:"healthcheck_address"`
	HealthcheckAuth    *BasicAuth                 `yaml:"healthcheck_auth"`
	AllowOnlyLocalhost bool                       `yaml:"allow_only_localhost"`
	Plugins            []*PluginHealthCheckConfig `yaml:"plugins"`
}

func (*HealthCheckConfig) UnmarshalYAML

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

type Log

type Log struct {
	Level   string `yaml:"level"`
	NoColor bool   `yaml:"no_color"`
	InJson  bool   `yaml:"in_json"`
}

func (*Log) UnmarshalYAML

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

type MetricsConfig added in v0.9.0

type MetricsConfig struct {
	AllowedInspect     []*CIDR             `yaml:"allowed_inspect"`
	TrustXFF           bool                `yaml:"trust_xff"`
	ProxyMetricsConfig *ProxyMetricsConfig `yaml:"proxy"`
}

func (*MetricsConfig) UnmarshalYAML added in v0.10.0

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

type PluginHealthCheckConfig added in v0.23.0

type PluginHealthCheckConfig struct {
	Name        string   `yaml:"name"`
	Description string   `yaml:"description"`
	Path        string   `yaml:"path"`
	Args        []string `yaml:"args"`
}

func (*PluginHealthCheckConfig) UnmarshalYAML added in v0.23.0

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

type Position

type Position struct {
	Longitude float64 `yaml:"longitude"`
	Latitude  float64 `yaml:"latitude"`
}

type ProxyMetricsConfig added in v0.9.0

type ProxyMetricsConfig struct {
	Targets []*ProxyMetricsTarget `yaml:"targets"`
}

type ProxyMetricsTarget added in v0.9.0

type ProxyMetricsTarget struct {
	Name string    `yaml:"name"`
	URL  URLConfig `yaml:"url"`
}

func (*ProxyMetricsTarget) UnmarshalYAML added in v0.9.0

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

type TLSPem

type TLSPem struct {
	CertPath       string `yaml:"cert_path"`
	PrivateKeyPath string `yaml:"private_key_path"`
}

type URLConfig added in v0.9.0

type URLConfig struct {
	URL *url.URL
	Raw string
}

func (*URLConfig) UnmarshalYAML added in v0.9.0

func (uc *URLConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

Jump to

Keyboard shortcuts

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