types

package
v1.7.10 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2019 License: MIT Imports: 17 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"
)

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 return 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             `` /* 126-byte string literal not displayed */
}

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

type AccessLogFields

type AccessLogFields struct {
	DefaultMode string        `json:"defaultMode,omitempty" description:"Default mode for fields: keep | drop" export:"true"`
	Names       FieldNames    `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

type AccessLogFilters

type AccessLogFilters struct {
	StatusCodes   StatusCodes    `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   parse.Duration `json:"duration,omitempty" description:"Keep access logs when request took longer than the specified duration" export:"true"`
}

AccessLogFilters holds filters configuration

type Auth

type Auth struct {
	Basic       *Basic   `json:"basic,omitempty" export:"true"`
	Digest      *Digest  `json:"digest,omitempty" export:"true"`
	Forward     *Forward `json:"forward,omitempty" export:"true"`
	HeaderField string   `json:"headerField,omitempty" export:"true"`
}

Auth holds authentication configuration (BASIC, DIGEST, users)

type Backend

type Backend struct {
	Servers            map[string]Server   `json:"servers,omitempty"`
	CircuitBreaker     *CircuitBreaker     `json:"circuitBreaker,omitempty"`
	LoadBalancer       *LoadBalancer       `json:"loadBalancer,omitempty"`
	MaxConn            *MaxConn            `json:"maxConn,omitempty"`
	HealthCheck        *HealthCheck        `json:"healthCheck,omitempty"`
	Buffering          *Buffering          `json:"buffering,omitempty"`
	ResponseForwarding *ResponseForwarding `json:"forwardingResponse,omitempty"`
}

Backend holds backend configuration.

type Basic

type Basic struct {
	Users        `json:"users,omitempty" mapstructure:","`
	UsersFile    string `json:"usersFile,omitempty"`
	RemoveHeader bool   `json:"removeHeader,omitempty"`
}

Basic HTTP basic authentication

type Buckets

type Buckets []float64

Buckets holds Prometheus Buckets

func (*Buckets) Get

func (b *Buckets) Get() interface{}

Get []float64

func (*Buckets) Set

func (b *Buckets) Set(str string) error

Set adds strings elem into the the parser it splits str on "," and ";" and apply ParseFloat to string

func (*Buckets) SetValue

func (b *Buckets) SetValue(val interface{})

SetValue sets []float64 into the parser

func (*Buckets) String

func (b *Buckets) String() string

String return slice in a string

type Buffering

type Buffering struct {
	MaxRequestBodyBytes  int64  `json:"maxRequestBodyBytes,omitempty"`
	MemRequestBodyBytes  int64  `json:"memRequestBodyBytes,omitempty"`
	MaxResponseBodyBytes int64  `json:"maxResponseBodyBytes,omitempty"`
	MemResponseBodyBytes int64  `json:"memResponseBodyBytes,omitempty"`
	RetryExpression      string `json:"retryExpression,omitempty"`
}

Buffering holds request/response buffering configuration/

type CircuitBreaker

type CircuitBreaker struct {
	Expression string `json:"expression,omitempty"`
}

CircuitBreaker holds circuit breaker 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() (*tls.Config, error)

CreateTLSConfig creates a TLS config from ClientTLS structures

type Cluster

type Cluster struct {
	Node  string `description:"Node name" export:"true"`
	Store *Store `export:"true"`
}

Cluster holds cluster config

type ConfigMessage

type ConfigMessage struct {
	ProviderName  string
	Configuration *Configuration
}

ConfigMessage hold configuration information exchanged between parts of traefik.

type Configuration

type Configuration struct {
	Backends  map[string]*Backend         `json:"backends,omitempty"`
	Frontends map[string]*Frontend        `json:"frontends,omitempty"`
	TLS       []*traefiktls.Configuration `json:"-"`
}

Configuration of a provider.

type Configurations

type Configurations map[string]*Configuration

Configurations is for currentConfigurations Map

type Constraint

type Constraint struct {
	Key string `export:"true"`
	// MustMatch is true if operator is "==" or false if operator is "!="
	MustMatch bool `export:"true"`
	// TODO: support regex
	Regex string `export:"true"`
}

Constraint hold a parsed constraint expression

func NewConstraint

func NewConstraint(exp string) (*Constraint, error)

NewConstraint receive a string and return a *Constraint, after checking syntax and parsing the constraint expression

func (*Constraint) MarshalText

func (c *Constraint) MarshalText() (text []byte, err error)

MarshalText encodes the receiver into UTF-8-encoded text and returns the result.

func (*Constraint) MatchConstraintWithAtLeastOneTag

func (c *Constraint) MatchConstraintWithAtLeastOneTag(tags []string) bool

MatchConstraintWithAtLeastOneTag tests a constraint for one single service

func (*Constraint) String

func (c *Constraint) String() string

func (*Constraint) UnmarshalText

func (c *Constraint) UnmarshalText(text []byte) error

UnmarshalText define how unmarshal in TOML parsing

type Constraints

type Constraints []*Constraint

Constraints holds a Constraint parser

func (*Constraints) Get

func (cs *Constraints) Get() interface{}

Get []*Constraint

func (*Constraints) Set

func (cs *Constraints) Set(str string) error

Set []*Constraint

func (*Constraints) SetValue

func (cs *Constraints) SetValue(val interface{})

SetValue sets []*Constraint into the parser

func (*Constraints) String

func (cs *Constraints) String() string

String returns []*Constraint in string

func (*Constraints) Type

func (cs *Constraints) Type() string

Type exports the Constraints type as a string

type DNSResolvers

type DNSResolvers []string

DNSResolvers is a list of DNSes that we will try to resolve the challenged FQDN against

func (*DNSResolvers) Get

func (r *DNSResolvers) Get() interface{}

Get return the DNSResolvers list

func (*DNSResolvers) Set

func (r *DNSResolvers) Set(value string) error

Set is the method to set the flag value, part of the flag.Value interface. Set's argument is a string to be parsed to set the flag. It's a comma-separated list, so we split it.

func (*DNSResolvers) SetValue

func (r *DNSResolvers) SetValue(val interface{})

SetValue sets the DNSResolvers list

func (*DNSResolvers) String

func (r *DNSResolvers) String() string

String is the method to format the flag's value, part of the flag.Value interface. The String method's output will be used in diagnostics.

func (*DNSResolvers) Type

func (r *DNSResolvers) Type() string

Type is type of the struct

type Datadog

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

Datadog contains address and metrics pushing interval configuration

type Digest

type Digest struct {
	Users        `json:"users,omitempty" mapstructure:","`
	UsersFile    string `json:"usersFile,omitempty"`
	RemoveHeader bool   `json:"removeHeader,omitempty"`
}

Digest HTTP authentication

type Domain

type Domain struct {
	Main string
	SANs []string
}

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 ErrorPage

type ErrorPage struct {
	Status  []string `json:"status,omitempty"`
	Backend string   `json:"backend,omitempty"`
	Query   string   `json:"query,omitempty"`
}

ErrorPage holds custom error page configuration

type FieldHeaderNames

type FieldHeaderNames map[string]string

FieldHeaderNames holds maps of fields with specific mode

func (*FieldHeaderNames) Get

func (f *FieldHeaderNames) Get() interface{}

Get return the FieldHeaderNames map

func (*FieldHeaderNames) Set

func (f *FieldHeaderNames) Set(value string) error

Set is the method to set the flag value, part of the flag.Value interface. Set's argument is a string to be parsed to set the flag. It's a space-separated list, so we split it.

func (*FieldHeaderNames) SetValue

func (f *FieldHeaderNames) SetValue(val interface{})

SetValue sets the FieldHeaderNames map with val

func (*FieldHeaderNames) String

func (f *FieldHeaderNames) String() string

String is the method to format the flag's value, part of the flag.Value interface. The String method's output will be used in diagnostics.

type FieldHeaders

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

FieldHeaders holds configuration for access log headers

type FieldNames

type FieldNames map[string]string

FieldNames holds maps of fields with specific mode

func (*FieldNames) Get

func (f *FieldNames) Get() interface{}

Get return the FieldNames map

func (*FieldNames) Set

func (f *FieldNames) Set(value string) error

Set is the method to set the flag value, part of the flag.Value interface. Set's argument is a string to be parsed to set the flag. It's a space-separated list, so we split it.

func (*FieldNames) SetValue

func (f *FieldNames) SetValue(val interface{})

SetValue sets the FieldNames map with val

func (*FieldNames) String

func (f *FieldNames) String() string

String is the method to format the flag's value, part of the flag.Value interface. The String method's output will be used in diagnostics.

type Forward

type Forward struct {
	Address             string     `description:"Authentication server address" json:"address,omitempty"`
	TLS                 *ClientTLS `description:"Enable TLS support" json:"tls,omitempty" export:"true"`
	TrustForwardHeader  bool       `description:"Trust X-Forwarded-* headers" json:"trustForwardHeader,omitempty" export:"true"`
	AuthResponseHeaders []string   `description:"Headers to be forwarded from auth response" json:"authResponseHeaders,omitempty"`
}

Forward authentication

type Frontend

type Frontend struct {
	EntryPoints          []string              `json:"entryPoints,omitempty" hash:"ignore"`
	Backend              string                `json:"backend,omitempty"`
	Routes               map[string]Route      `json:"routes,omitempty" hash:"ignore"`
	PassHostHeader       bool                  `json:"passHostHeader,omitempty"`
	PassTLSCert          bool                  `json:"passTLSCert,omitempty"` // Deprecated use PassTLSClientCert instead
	PassTLSClientCert    *TLSClientHeaders     `json:"passTLSClientCert,omitempty"`
	Priority             int                   `json:"priority"`
	BasicAuth            []string              `json:"basicAuth"`                      // Deprecated
	WhitelistSourceRange []string              `json:"whitelistSourceRange,omitempty"` // Deprecated
	WhiteList            *WhiteList            `json:"whiteList,omitempty"`
	Headers              *Headers              `json:"headers,omitempty"`
	Errors               map[string]*ErrorPage `json:"errors,omitempty"`
	RateLimit            *RateLimit            `json:"ratelimit,omitempty"`
	Redirect             *Redirect             `json:"redirect,omitempty"`
	Auth                 *Auth                 `json:"auth,omitempty"`
}

Frontend holds frontend configuration.

func (*Frontend) Hash

func (f *Frontend) Hash() (string, error)

Hash returns the hash value of a Frontend struct.

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 Headers

type Headers struct {
	CustomRequestHeaders  map[string]string `json:"customRequestHeaders,omitempty"`
	CustomResponseHeaders map[string]string `json:"customResponseHeaders,omitempty"`

	AllowedHosts            []string          `json:"allowedHosts,omitempty"`
	HostsProxyHeaders       []string          `json:"hostsProxyHeaders,omitempty"`
	SSLRedirect             bool              `json:"sslRedirect,omitempty"`
	SSLTemporaryRedirect    bool              `json:"sslTemporaryRedirect,omitempty"`
	SSLHost                 string            `json:"sslHost,omitempty"`
	SSLProxyHeaders         map[string]string `json:"sslProxyHeaders,omitempty"`
	SSLForceHost            bool              `json:"sslForceHost,omitempty"`
	STSSeconds              int64             `json:"stsSeconds,omitempty"`
	STSIncludeSubdomains    bool              `json:"stsIncludeSubdomains,omitempty"`
	STSPreload              bool              `json:"stsPreload,omitempty"`
	ForceSTSHeader          bool              `json:"forceSTSHeader,omitempty"`
	FrameDeny               bool              `json:"frameDeny,omitempty"`
	CustomFrameOptionsValue string            `json:"customFrameOptionsValue,omitempty"`
	ContentTypeNosniff      bool              `json:"contentTypeNosniff,omitempty"`
	BrowserXSSFilter        bool              `json:"browserXssFilter,omitempty"`
	CustomBrowserXSSValue   string            `json:"customBrowserXSSValue,omitempty"`
	ContentSecurityPolicy   string            `json:"contentSecurityPolicy,omitempty"`
	PublicKey               string            `json:"publicKey,omitempty"`
	ReferrerPolicy          string            `json:"referrerPolicy,omitempty"`
	IsDevelopment           bool              `json:"isDevelopment,omitempty"`
}

Headers holds the custom header configuration

func (*Headers) HasCustomHeadersDefined

func (h *Headers) HasCustomHeadersDefined() bool

HasCustomHeadersDefined checks to see if any of the custom header elements have been set

func (*Headers) HasSecureHeadersDefined

func (h *Headers) HasSecureHeadersDefined() bool

HasSecureHeadersDefined checks to see if any of the secure header elements have been set

type HealthCheck

type HealthCheck struct {
	Scheme   string            `json:"scheme,omitempty"`
	Path     string            `json:"path,omitempty"`
	Port     int               `json:"port,omitempty"`
	Interval string            `json:"interval,omitempty"`
	Hostname string            `json:"hostname,omitempty"`
	Headers  map[string]string `json:"headers,omitempty"`
}

HealthCheck holds HealthCheck configuration

type InfluxDB

type InfluxDB struct {
	Address         string `description:"InfluxDB address"`
	Protocol        string `description:"InfluxDB address protocol (udp or http)"`
	PushInterval    string `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"`
}

InfluxDB contains address and metrics pushing interval configuration

type InternalRouter

type InternalRouter interface {
	AddRoutes(systemRouter *mux.Router)
}

InternalRouter router used by server to register internal routes (/api, /ping ...)

type LoadBalancer

type LoadBalancer struct {
	Method     string      `json:"method,omitempty"`
	Sticky     bool        `json:"sticky,omitempty"` // Deprecated: use Stickiness instead
	Stickiness *Stickiness `json:"stickiness,omitempty"`
}

LoadBalancer holds load balancing configuration.

type LoadBalancerMethod

type LoadBalancerMethod uint8

LoadBalancerMethod holds the method of load balancing to use.

const (
	// Wrr (default) = Weighted Round Robin
	Wrr LoadBalancerMethod = iota
	// Drr = Dynamic Round Robin
	Drr
)

func NewLoadBalancerMethod

func NewLoadBalancerMethod(loadBalancer *LoadBalancer) (LoadBalancerMethod, error)

NewLoadBalancerMethod create a new LoadBalancerMethod from a given LoadBalancer.

type MaxConn

type MaxConn struct {
	Amount        int64  `json:"amount,omitempty"`
	ExtractorFunc string `json:"extractorFunc,omitempty"`
}

MaxConn holds maximum connection configuration

type Metrics

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

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

type Prometheus

type Prometheus struct {
	Buckets    Buckets `description:"Buckets for latency metrics" export:"true"`
	EntryPoint string  `description:"EntryPoint" export:"true"`
}

Prometheus can contain specific configuration used by the Prometheus Metrics exporter

type Rate

type Rate struct {
	Period  flaeg.Duration `json:"period,omitempty"`
	Average int64          `json:"average,omitempty"`
	Burst   int64          `json:"burst,omitempty"`
}

Rate holds a rate limiting configuration for a specific time period

type RateLimit

type RateLimit struct {
	RateSet       map[string]*Rate `json:"rateset,omitempty"`
	ExtractorFunc string           `json:"extractorFunc,omitempty"`
}

RateLimit holds a rate limiting configuration for a given frontend

type Redirect

type Redirect struct {
	EntryPoint  string `json:"entryPoint,omitempty"`
	Regex       string `json:"regex,omitempty"`
	Replacement string `json:"replacement,omitempty"`
	Permanent   bool   `json:"permanent,omitempty"`
}

Redirect configures a redirection of an entry point to another, or to an URL

type ResponseForwarding

type ResponseForwarding struct {
	FlushInterval string `json:"flushInterval,omitempty"`
}

ResponseForwarding holds configuration for the forward of the response

type Route

type Route struct {
	Rule string `json:"rule,omitempty"`
}

Route holds route configuration.

type Server

type Server struct {
	URL    string `json:"url,omitempty"`
	Weight int    `json:"weight"`
}

Server holds server configuration.

type ServerRoute

type ServerRoute struct {
	Route              *mux.Route
	StripPrefixes      []string
	StripPrefixesRegex []string
	AddPrefix          string
	ReplacePath        string
	ReplacePathRegex   string
}

ServerRoute holds ServerRoute configuration.

type Statistics

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

Statistics provides options for monitoring request and response stats

type Statsd

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

Statsd contains address and metrics pushing interval configuration

type StatusCodes

type StatusCodes []string

StatusCodes holds status codes ranges to filter access log

func (*StatusCodes) Get

func (s *StatusCodes) Get() interface{}

Get StatusCodes

func (*StatusCodes) Set

func (s *StatusCodes) Set(str string) error

Set adds strings elem into the the parser it splits str on , and ;

func (*StatusCodes) SetValue

func (s *StatusCodes) SetValue(val interface{})

SetValue sets StatusCodes into the parser

func (*StatusCodes) String

func (s *StatusCodes) String() string

String return slice in a string

type Stickiness

type Stickiness struct {
	CookieName string `json:"cookieName,omitempty"`
}

Stickiness holds sticky session configuration.

type Store

type Store struct {
	store.Store
	// like this "prefix" (without the /)
	Prefix string `export:"true"`
}

Store holds KV store cluster config

type TLSCLientCertificateDNInfos

type TLSCLientCertificateDNInfos struct {
	Country         bool `description:"Add Country info in header" json:"country"`
	Province        bool `description:"Add Province info in header" json:"province"`
	Locality        bool `description:"Add Locality info in header" json:"locality"`
	Organization    bool `description:"Add Organization info in header" json:"organization"`
	CommonName      bool `description:"Add CommonName info in header" json:"commonName"`
	SerialNumber    bool `description:"Add SerialNumber info in header" json:"serialNumber"`
	DomainComponent bool `description:"Add Domain Component info in header" json:"domainComponent"`
}

TLSCLientCertificateDNInfos holds the client TLS certificate distinguished name infos configuration cf https://tools.ietf.org/html/rfc3739

type TLSClientCertificateInfos

type TLSClientCertificateInfos struct {
	NotAfter  bool                         `description:"Add NotAfter info in header" json:"notAfter"`
	NotBefore bool                         `description:"Add NotBefore info in header" json:"notBefore"`
	Sans      bool                         `description:"Add Sans info in header" json:"sans"`
	Subject   *TLSCLientCertificateDNInfos `description:"Add Subject info in header" json:"subject,omitempty"`
	Issuer    *TLSCLientCertificateDNInfos `description:"Add Issuer info in header" json:"issuer,omitempty"`
}

TLSClientCertificateInfos holds the client TLS certificate infos configuration

type TLSClientHeaders

type TLSClientHeaders struct {
	PEM   bool                       `description:"Enable header with escaped client pem" json:"pem"`
	Infos *TLSClientCertificateInfos `description:"Enable header with configured client cert infos" json:"infos,omitempty"`
}

TLSClientHeaders holds the TLS client cert headers configuration.

type TraefikLog

type TraefikLog struct {
	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.

type Users

type Users []string

Users authentication users

type WhiteList

type WhiteList struct {
	SourceRange      []string `json:"sourceRange,omitempty"`
	UseXForwardedFor bool     `json:"useXForwardedFor,omitempty" export:"true"`
}

WhiteList contains white list configuration.

Jump to

Keyboard shortcuts

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