Documentation ¶
Index ¶
- Constants
- Variables
- func Decoder(target interface{}, allowUnused bool) (*mapstructure.Decoder, error)
- func DefaultConfigFile() []byte
- func LoadAndSanitizeConfig(configData []byte) (string, error)
- func MapStructureDecodeHookFunc() mapstructure.DecodeHookFuncType
- type BackendConfig
- type Config
- type GlobalConfig
- type HTTPHeaders
- type HostSpec
- type ListenerConfig
- type ListenerType
- type LoggingConfig
- type MapStructureDecoder
- type Proxy
- type ProxyURL
- type SiteConfig
- type Sum224
- type TLS
- type TLSCertificateMap
- func (t *TLSCertificateMap) AddCert(cert *x509.Certificate) error
- func (t *TLSCertificateMap) GetCerts() []*x509.Certificate
- func (t *TLSCertificateMap) HasCert(cert *x509.Certificate) bool
- func (t *TLSCertificateMap) HashCert(cert *x509.Certificate) Sum224
- func (t *TLSCertificateMap) MapStructureDecode(input interface{}) error
- type TLSCertificatePool
- type URL
Constants ¶
const ( TLSCertificatePoolMaxNonFileEntryReturn int = 50 TLSCACertsSystem string = "system" )
Variables ¶
var ( ErrMapStructureDecode = errors.New("MapStructureDecode function failed") ErrInconsistentLabels = errors.New("Extra Prometheus labels found without defaults set") )
var ( ErrInvalidInputType = errors.New("invalid input type for decoder") ErrInvalidPEMFile = errors.New("PEM file could not be added to certificate pool") )
Functions ¶
func Decoder ¶
func Decoder(target interface{}, allowUnused bool) (*mapstructure.Decoder, error)
Decoder returns the decoder for config maps.
func DefaultConfigFile ¶
func DefaultConfigFile() []byte
DefaultConfigFile returns the default embedded YAML config which sets the poller_defaults.
func LoadAndSanitizeConfig ¶
LoadAndSanitizeConfig is used purely for displaying the config to users. It removes sensitive keys from the config and provides a reserialized YAML view of it.
func MapStructureDecodeHookFunc ¶
func MapStructureDecodeHookFunc() mapstructure.DecodeHookFuncType
MapStructureDecodeHookFunc returns a DecodeHookFunc that applies output to the UnmarshalYAML function, when the target type implements the yaml.Unmarshaller interface.
Types ¶
type BackendConfig ¶
type BackendConfig struct { Target HostSpec `mapstructure:"target"` TLS TLS `mapstructure:"tls,omitempty"` // TLS configures TLS connectivity to the backend HTTPHeaders `mapstructure:"http_headers"` // HTTPHeaders configures modifications to the HTTP headers }
type Config ¶
type Config struct { Global GlobalConfig `mapstructure:"global,omitempty"` Proxychains map[string][]Proxy `mapstructure:"proxychains,omitempty"` Listeners map[string]ListenerConfig `mapstructure:"listeners,omitempty"` Sites []SiteConfig `mapstructure:"sites,omitempty"` }
type GlobalConfig ¶
type GlobalConfig struct { }
type HTTPHeaders ¶
type HTTPHeaders struct { // SetHeaders are headers to set on outbound requests. A common header to set is // Host in order to route the request. SetHeaders map[string][]string `mapstructure:"set_headers,omitempty"` // DelHeaders are a list of headers which should be explicitly removed. Names here are normalized // before removal, so spelling does not need to be exact. DelHeaders []string `mapstructure:"del_headers,omitempty"` }
HTTPHeaders configures HTTP header modifications.
type HostSpec ¶
type HostSpec struct { Host string // Host is the hostname Port uint16 // Port is the port number Network string // Network type (default TCP) }
func (*HostSpec) MarshalText ¶
MarshalText implements the TextMarshaller interface for HostSpec.
func (*HostSpec) UnmarshalText ¶
UnmarshalText implements the TextMarshaller interface for HostSpec.
type ListenerConfig ¶
type ListenerConfig struct { ListenAddr HostSpec `mapstructure:"listen_addr"` // ListenAddr is the hostname and port number ListenerType ListenerType `mapstructure:"listen_type"` // ListenerType is the type of listener to attach }
type ListenerType ¶
type ListenerType string
const (
SiteConfigTypeHTTPEdge ListenerType = "http-edge"
)
type LoggingConfig ¶
type MapStructureDecoder ¶
type MapStructureDecoder interface {
MapStructureDecode(interface{}) error
}
MapStructureDecoder is detected by MapStructureDecodeHookFunc to allow a type to decode itself.
type ProxyURL ¶
type ProxyURL string
ProxyURL is a custom type to validate roxy specifications.
func (*ProxyURL) MarshalText ¶
UnmarshalText MarshalText encoding.UnmarshalText.
func (*ProxyURL) UnmarshalText ¶
UnmarshalText implements encoding.UnmarshalText.
type SiteConfig ¶
type SiteConfig struct { Listener []string `mapstructure:"listener"` // Listener is the name of the listener to attach the site too Host string `mapstructure:"host"` // Host is the hostname to respond to Backend BackendConfig `mapstructure:"backend"` // Backend is the backend for the server Proxychain string `mapstructure:"proxychain"` // Proxychain is the proxychain to use for connections Method string `mapstructure:"method"` // Method is the type of proxy to use. Options are "edge" }
type Sum224 ¶
TLSCertificateMap encodes a list of certificates and stores them in a hashmap for easy lookups. It is similar to the standard library CertPool.
type TLS ¶
type TLS struct { Enable bool `mapstructure:"enable"` // TLS indicates that the connection should be made with TLS NoVerify bool `mapstructure:"no_verify,omitempty"` // TLSNoVerify means do not verify certificates ServerNameIndication *string `mapstructure:"sni_name,omitempty"` // The TLS SNI name to send. CACerts TLSCertificatePool `mapstructure:"ca_certs,omitempty"` // Path to CAfile to verify the service TLS with }
type TLSCertificateMap ¶
type TLSCertificateMap struct {
// contains filtered or unexported fields
}
func (*TLSCertificateMap) AddCert ¶
func (t *TLSCertificateMap) AddCert(cert *x509.Certificate) error
AddCert adds a certificate to a pool.
func (*TLSCertificateMap) GetCerts ¶
func (t *TLSCertificateMap) GetCerts() []*x509.Certificate
func (*TLSCertificateMap) HasCert ¶
func (t *TLSCertificateMap) HasCert(cert *x509.Certificate) bool
func (*TLSCertificateMap) HashCert ¶
func (t *TLSCertificateMap) HashCert(cert *x509.Certificate) Sum224
func (*TLSCertificateMap) MapStructureDecode ¶
func (t *TLSCertificateMap) MapStructureDecode(input interface{}) error
MapStructureDecode implements unmarshalling for TLSCertificateMap nolint: funlen,cyclop
type TLSCertificatePool ¶
TLSCertificatePool is our custom type for decoding a certificate pool out of YAML.
func (*TLSCertificatePool) MapStructureDecode ¶
func (t *TLSCertificatePool) MapStructureDecode(input interface{}) error
MapStructureDecode implements the yaml.Unmarshaler interface for tls_cacerts.
type URL ¶
URL is a custom URL type that allows validation at configuration load time.
func (*URL) MarshalText ¶
MarshalText implements the TextMarshaller interface for URLs.
func (*URL) MarshalYAML ¶
MarshalYAML implements the yaml.Marshaller interface for URLs.
func (*URL) UnmarshalText ¶
UnmarshalText implements the TextMarshaller interface for URLs.