config

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: Apache-2.0 Imports: 7 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 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"`
}

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"`
	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"`
}

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 Position

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

type TLSPem

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

Jump to

Keyboard shortcuts

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