types

package
v2.0.0-alpha7+incompat... Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AccessLogKeep is the keep string value
	AccessLogKeep = "keep"
	// AccessLogDrop is the drop string value
	AccessLogDrop = "drop"
	// AccessLogRedact is the redact string value
	AccessLogRedact = "redact"
)
View Source
const (
	// CommonFormat is the common logging format (CLF).
	CommonFormat string = "common"

	// JSONFormat is the JSON logging format.
	JSONFormat string = "json"
)

Variables

This section is empty.

Functions

func CanonicalDomain

func CanonicalDomain(domain string) string

CanonicalDomain returns a lower case domain with trim space.

func MatchDomain

func MatchDomain(domain string, certDomain string) bool

MatchDomain returns true if a domain match the cert domain.

Types

type AccessLog

type AccessLog struct {
	FilePath      string            `json:"file,omitempty" description:"Access log file path. Stdout is used when omitted or empty." export:"true"`
	Format        string            `json:"format,omitempty" description:"Access log format: json | common" export:"true"`
	Filters       *AccessLogFilters `json:"filters,omitempty" description:"Access log filters, used to keep only specific access logs." export:"true"`
	Fields        *AccessLogFields  `json:"fields,omitempty" description:"AccessLogFields." export:"true"`
	BufferingSize int64             `json:"bufferingSize,omitempty" description:"Number of access log lines to process in a buffered way." export:"true"`
}

AccessLog holds the configuration settings for the access logger (middlewares/accesslog).

func (*AccessLog) SetDefaults

func (l *AccessLog) SetDefaults()

SetDefaults sets the default values.

type AccessLogFields

type AccessLogFields struct {
	DefaultMode string            `json:"defaultMode,omitempty" description:"Default mode for fields: keep | drop" export:"true"`
	Names       map[string]string `json:"names,omitempty" description:"Override mode for fields" export:"true"`
	Headers     *FieldHeaders     `json:"headers,omitempty" description:"Headers to keep, drop or redact" export:"true"`
}

AccessLogFields holds configuration for access log fields

func (*AccessLogFields) Keep

func (f *AccessLogFields) Keep(field string) bool

Keep check if the field need to be kept or dropped

func (*AccessLogFields) KeepHeader

func (f *AccessLogFields) KeepHeader(header string) string

KeepHeader checks if the headers need to be kept, dropped or redacted and returns the status

func (*AccessLogFields) SetDefaults

func (f *AccessLogFields) SetDefaults()

SetDefaults sets the default values.

type AccessLogFilters

type AccessLogFilters struct {
	StatusCodes   []string `json:"statusCodes,omitempty" description:"Keep access logs with status codes in the specified range." export:"true"`
	RetryAttempts bool     `json:"retryAttempts,omitempty" description:"Keep access logs when at least one retry happened." export:"true"`
	MinDuration   Duration `json:"duration,omitempty" description:"Keep access logs when request took longer than the specified duration." export:"true"`
}

AccessLogFilters holds filters configuration

type ClientTLS

type ClientTLS struct {
	CA                 string `description:"TLS CA" json:"ca,omitempty"`
	CAOptional         bool   `description:"TLS CA.Optional" json:"caOptional,omitempty"`
	Cert               string `description:"TLS cert" json:"cert,omitempty"`
	Key                string `description:"TLS key" json:"key,omitempty"`
	InsecureSkipVerify bool   `description:"TLS insecure skip verify" json:"insecureSkipVerify,omitempty"`
}

ClientTLS holds TLS specific configurations as client CA, Cert and Key can be either path or file contents

func (*ClientTLS) CreateTLSConfig

func (clientTLS *ClientTLS) CreateTLSConfig(ctx context.Context) (*tls.Config, error)

CreateTLSConfig creates a TLS config from ClientTLS structures

type Datadog

type Datadog struct {
	Address      string   `description:"DataDog's address."`
	PushInterval Duration `description:"DataDog push interval." export:"true"`
}

Datadog contains address and metrics pushing interval configuration

func (*Datadog) SetDefaults

func (d *Datadog) SetDefaults()

SetDefaults sets the default values.

type Domain

type Domain struct {
	Main string   `description:"Default subject name."`
	SANs []string `description:"Subject alternative names."`
}

Domain holds a domain name with SANs.

func (*Domain) Set

func (d *Domain) Set(domains []string)

Set sets a domains from an array of strings.

func (*Domain) ToStrArray

func (d *Domain) ToStrArray() []string

ToStrArray convert a domain into an array of strings.

type Domains

type Domains []Domain

Domains parse []Domain.

func (*Domains) Get

func (ds *Domains) Get() interface{}

Get []Domain.

func (*Domains) Set

func (ds *Domains) Set(str string) error

Set []Domain

func (*Domains) SetValue

func (ds *Domains) SetValue(val interface{})

SetValue sets []Domain into the parser

func (*Domains) String

func (ds *Domains) String() string

String returns []Domain in string.

type Duration

type Duration time.Duration

Duration is a custom type suitable for parsing duration values. It supports `time.ParseDuration`-compatible values and suffix-less digits; in the latter case, seconds are assumed.

func (*Duration) Get

func (d *Duration) Get() interface{}

Get returns the duration value.

func (*Duration) MarshalJSON

func (d *Duration) MarshalJSON() ([]byte, error)

MarshalJSON serializes the given duration value.

func (*Duration) MarshalText

func (d *Duration) MarshalText() ([]byte, error)

MarshalText serialize the given duration value into a text.

func (*Duration) Set

func (d *Duration) Set(s string) error

Set sets the duration from the given string value.

func (*Duration) SetValue

func (d *Duration) SetValue(val interface{})

SetValue sets the duration from the given Duration-asserted value.

func (*Duration) String

func (d *Duration) String() string

String returns a string representation of the duration value.

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(text []byte) error

UnmarshalJSON deserializes the given text into a duration value.

func (*Duration) UnmarshalText

func (d *Duration) UnmarshalText(text []byte) error

UnmarshalText deserializes the given text into a duration value. It is meant to support TOML decoding of durations.

type FieldHeaders

type FieldHeaders struct {
	DefaultMode string            `json:"defaultMode,omitempty" description:"Default mode for fields: keep | drop | redact" export:"true"`
	Names       map[string]string `json:"names,omitempty" description:"Override mode for headers" export:"true"`
}

FieldHeaders holds configuration for access log headers

type HTTPCodeRanges

type HTTPCodeRanges [][2]int

HTTPCodeRanges holds HTTP code ranges

func NewHTTPCodeRanges

func NewHTTPCodeRanges(strBlocks []string) (HTTPCodeRanges, error)

NewHTTPCodeRanges creates HTTPCodeRanges from a given []string. Break out the http status code ranges into a low int and high int for ease of use at runtime

func (HTTPCodeRanges) Contains

func (h HTTPCodeRanges) Contains(statusCode int) bool

Contains tests whether the passed status code is within one of its HTTP code ranges.

type HostResolverConfig

type HostResolverConfig struct {
	CnameFlattening bool   `description:"A flag to enable/disable CNAME flattening" export:"true"`
	ResolvConfig    string `description:"resolv.conf used for DNS resolving" export:"true"`
	ResolvDepth     int    `description:"The maximal depth of DNS recursive resolving" export:"true"`
}

HostResolverConfig contain configuration for CNAME Flattening.

func (*HostResolverConfig) SetDefaults

func (h *HostResolverConfig) SetDefaults()

SetDefaults sets the default values.

type InfluxDB

type InfluxDB struct {
	Address         string   `description:"InfluxDB address."`
	Protocol        string   `description:"InfluxDB address protocol (udp or http)."`
	PushInterval    Duration `description:"InfluxDB push interval." export:"true"`
	Database        string   `description:"InfluxDB database used when protocol is http." export:"true"`
	RetentionPolicy string   `description:"InfluxDB retention policy used when protocol is http." export:"true"`
	Username        string   `description:"InfluxDB username (only with http)." export:"true"`
	Password        string   `description:"InfluxDB password (only with http)." export:"true"`
}

InfluxDB contains address, login and metrics pushing interval configuration

func (*InfluxDB) SetDefaults

func (i *InfluxDB) SetDefaults()

SetDefaults sets the default values.

type Metrics

type Metrics struct {
	Prometheus *Prometheus `description:"Prometheus metrics exporter type." export:"true" label:"allowEmpty"`
	Datadog    *Datadog    `description:"DataDog metrics exporter type." export:"true" label:"allowEmpty"`
	StatsD     *Statsd     `description:"StatsD metrics exporter type." export:"true" label:"allowEmpty"`
	InfluxDB   *InfluxDB   `description:"InfluxDB metrics exporter type." label:"allowEmpty"`
}

Metrics provides options to expose and send Traefik metrics to different third party monitoring systems

type Prometheus

type Prometheus struct {
	Buckets     []float64 `description:"Buckets for latency metrics." export:"true"`
	EntryPoint  string    `description:"EntryPoint." export:"true"`
	Middlewares []string  `description:"Middlewares." export:"true"`
}

Prometheus can contain specific configuration used by the Prometheus Metrics exporter

func (*Prometheus) SetDefaults

func (p *Prometheus) SetDefaults()

SetDefaults sets the default values.

type RouteAppender

type RouteAppender interface {
	Append(systemRouter *mux.Router)
}

RouteAppender appends routes on a router (/api, /ping ...)

type Statistics

type Statistics struct {
	RecentErrors int `description:"Number of recent errors logged." export:"true"`
}

Statistics provides options for monitoring request and response stats

func (*Statistics) SetDefaults

func (s *Statistics) SetDefaults()

SetDefaults sets the default values.

type Statsd

type Statsd struct {
	Address      string   `description:"StatsD address."`
	PushInterval Duration `description:"StatsD push interval." export:"true"`
}

Statsd contains address and metrics pushing interval configuration

func (*Statsd) SetDefaults

func (s *Statsd) SetDefaults()

SetDefaults sets the default values.

type TraefikLog

type TraefikLog struct {
	Level    string `description:"Log level set to traefik logs." export:"true"`
	FilePath string `json:"file,omitempty" description:"Traefik log file path. Stdout is used when omitted or empty."`
	Format   string `json:"format,omitempty" description:"Traefik log format: json | common"`
}

TraefikLog holds the configuration settings for the traefik logger.

func (*TraefikLog) SetDefaults

func (l *TraefikLog) SetDefaults()

SetDefaults sets the default values.

Jump to

Keyboard shortcuts

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