types

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LabelPrefix                                   = "traefik."
	SuffixPort                                    = "port"
	SuffixProtocol                                = "protocol"
	SuffixWeight                                  = "weight"
	SuffixFrontendAuthBasic                       = "frontend.auth.basic"
	SuffixFrontendBackend                         = "frontend.backend"
	SuffixFrontendEntryPoints                     = "frontend.entryPoints"
	SuffixFrontendPassHostHeader                  = "frontend.passHostHeader"
	SuffixFrontendPriority                        = "frontend.priority"
	SuffixFrontendRedirectEntryPoint              = "frontend.redirect.entryPoint"
	SuffixFrontendRedirectRegex                   = "frontend.redirect.regex"
	SuffixFrontendRedirectReplacement             = "frontend.redirect.replacement"
	SuffixFrontendRule                            = "frontend.rule"
	SuffixBackendLoadBalancerSticky               = "backend.loadbalancer.sticky"
	SuffixBackendLoadBalancerStickiness           = "backend.loadbalancer.stickiness"
	SuffixBackendLoadBalancerStickinessCookieName = "backend.loadbalancer.stickiness.cookieName"
	LabelDomain                                   = LabelPrefix + "domain"
	LabelEnable                                   = LabelPrefix + "enable"
	LabelPort                                     = LabelPrefix + SuffixPort
	LabelPortIndex                                = LabelPrefix + "portIndex"
	LabelProtocol                                 = LabelPrefix + SuffixProtocol
	LabelTags                                     = LabelPrefix + "tags"
	LabelWeight                                   = LabelPrefix + SuffixWeight
	LabelFrontendAuthBasic                        = LabelPrefix + SuffixFrontendAuthBasic
	LabelFrontendEntryPoints                      = LabelPrefix + SuffixFrontendEntryPoints
	LabelFrontendPassHostHeader                   = LabelPrefix + SuffixFrontendPassHostHeader
	LabelFrontendPassTLSCert                      = LabelPrefix + "frontend.passTLSCert"
	LabelFrontendPriority                         = LabelPrefix + SuffixFrontendPriority
	LabelFrontendRule                             = LabelPrefix + SuffixFrontendRule
	LabelFrontendRuleType                         = LabelPrefix + "frontend.rule.type"
	LabelFrontendRedirectEntryPoint               = LabelPrefix + SuffixFrontendRedirectEntryPoint
	LabelFrontendRedirectRegex                    = LabelPrefix + SuffixFrontendRedirectRegex
	LabelFrontendRedirectReplacement              = LabelPrefix + SuffixFrontendRedirectReplacement
	LabelTraefikFrontendValue                     = LabelPrefix + "frontend.value"
	LabelTraefikFrontendWhitelistSourceRange      = LabelPrefix + "frontend.whitelistSourceRange"
	LabelFrontendRequestHeaders                   = LabelPrefix + "frontend.headers.customRequestHeaders"
	LabelFrontendResponseHeaders                  = LabelPrefix + "frontend.headers.customResponseHeaders"
	LabelFrontendAllowedHosts                     = LabelPrefix + "frontend.headers.allowedHosts"
	LabelFrontendHostsProxyHeaders                = LabelPrefix + "frontend.headers.hostsProxyHeaders"
	LabelFrontendSSLRedirect                      = LabelPrefix + "frontend.headers.SSLRedirect"
	LabelFrontendSSLTemporaryRedirect             = LabelPrefix + "frontend.headers.SSLTemporaryRedirect"
	LabelFrontendSSLHost                          = LabelPrefix + "frontend.headers.SSLHost"
	LabelFrontendSSLProxyHeaders                  = LabelPrefix + "frontend.headers.SSLProxyHeaders"
	LabelFrontendSTSSeconds                       = LabelPrefix + "frontend.headers.STSSeconds"
	LabelFrontendSTSIncludeSubdomains             = LabelPrefix + "frontend.headers.STSIncludeSubdomains"
	LabelFrontendSTSPreload                       = LabelPrefix + "frontend.headers.STSPreload"
	LabelFrontendForceSTSHeader                   = LabelPrefix + "frontend.headers.forceSTSHeader"
	LabelFrontendFrameDeny                        = LabelPrefix + "frontend.headers.frameDeny"
	LabelFrontendCustomFrameOptionsValue          = LabelPrefix + "frontend.headers.customFrameOptionsValue"
	LabelFrontendContentTypeNosniff               = LabelPrefix + "frontend.headers.contentTypeNosniff"
	LabelFrontendBrowserXSSFilter                 = LabelPrefix + "frontend.headers.browserXSSFilter"
	LabelFrontendContentSecurityPolicy            = LabelPrefix + "frontend.headers.contentSecurityPolicy"
	LabelFrontendPublicKey                        = LabelPrefix + "frontend.headers.publicKey"
	LabelFrontendReferrerPolicy                   = LabelPrefix + "frontend.headers.referrerPolicy"
	LabelFrontendIsDevelopment                    = LabelPrefix + "frontend.headers.isDevelopment"
	LabelBackend                                  = LabelPrefix + "backend"
	LabelBackendID                                = LabelPrefix + "backend.id"
	LabelTraefikBackendCircuitbreaker             = LabelPrefix + "backend.circuitbreaker"
	LabelBackendCircuitbreakerExpression          = LabelPrefix + "backend.circuitbreaker.expression"
	LabelBackendHealthcheckPath                   = LabelPrefix + "backend.healthcheck.path"
	LabelBackendHealthcheckInterval               = LabelPrefix + "backend.healthcheck.interval"
	LabelBackendLoadbalancerMethod                = LabelPrefix + "backend.loadbalancer.method"
	LabelBackendLoadbalancerSticky                = LabelPrefix + SuffixBackendLoadBalancerSticky
	LabelBackendLoadbalancerStickiness            = LabelPrefix + SuffixBackendLoadBalancerStickiness
	LabelBackendLoadbalancerStickinessCookieName  = LabelPrefix + SuffixBackendLoadBalancerStickinessCookieName
	LabelBackendMaxconnAmount                     = LabelPrefix + "backend.maxconn.amount"
	LabelBackendMaxconnExtractorfunc              = LabelPrefix + "backend.maxconn.extractorfunc"
)

Traefik labels

Variables

This section is empty.

Functions

func CanonicalDomain added in v1.1.0

func CanonicalDomain(domain string) string

CanonicalDomain returns a lower case domain with trim space

func ServiceLabel added in v1.4.0

func ServiceLabel(key, serviceName string) string

ServiceLabel converts a key value of Label*, given a serviceName, into a pattern <LabelPrefix>.<serviceName>.<property>

i.e. For LabelFrontendRule and serviceName=app it will return "traefik.app.frontend.rule"

func SplitAndTrimString added in v1.5.0

func SplitAndTrimString(base string) []string

SplitAndTrimString splits separatedString at the comma character and trims each piece, filtering out empty pieces. Returns the list of pieces or nil if the input did not contain a non-empty piece.

Types

type AccessLog added in v1.4.0

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

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

type Auth added in v1.1.0

type Auth struct {
	Basic       *Basic   `export:"true"`
	Digest      *Digest  `export:"true"`
	Forward     *Forward `export:"true"`
	HeaderField string   `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"`
}

Backend holds backend configuration.

type Basic added in v1.1.0

type Basic struct {
	Users     `mapstructure:","`
	UsersFile string
}

Basic HTTP basic authentication

type Buckets added in v1.2.0

type Buckets []float64

Buckets holds Prometheus Buckets

func (*Buckets) Get added in v1.2.0

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

Get []float64

func (*Buckets) Set added in v1.2.0

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 added in v1.2.0

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

SetValue sets []float64 into the parser

func (*Buckets) String added in v1.2.0

func (b *Buckets) String() string

String return slice in a string

type CircuitBreaker

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

CircuitBreaker holds circuit breaker configuration.

type ClientTLS added in v1.4.0

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

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

func (*ClientTLS) CreateTLSConfig added in v1.4.0

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

CreateTLSConfig creates a TLS config from ClientTLS structures

type Cluster added in v1.1.0

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:"tls,omitempty"`
}

Configuration of a provider.

type Configurations added in v1.4.0

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 added in v1.1.0

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 added in v1.1.0

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 Datadog added in v1.4.0

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 added in v1.1.0

type Digest struct {
	Users     `mapstructure:","`
	UsersFile string
}

Digest HTTP authentication

type ErrorPage added in v1.4.0

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 Forward added in v1.4.0

type Forward struct {
	Address            string     `description:"Authentication server address"`
	TLS                *ClientTLS `description:"Enable TLS support" export:"true"`
	TrustForwardHeader bool       `description:"Trust X-Forwarded-* headers" export:"true"`
}

Forward authentication

type Frontend

type Frontend struct {
	EntryPoints          []string             `json:"entryPoints,omitempty"`
	Backend              string               `json:"backend,omitempty"`
	Routes               map[string]Route     `json:"routes,omitempty"`
	PassHostHeader       bool                 `json:"passHostHeader,omitempty"`
	PassTLSCert          bool                 `json:"passTLSCert,omitempty"`
	Priority             int                  `json:"priority"`
	BasicAuth            []string             `json:"basicAuth"`
	WhitelistSourceRange []string             `json:"whitelistSourceRange,omitempty"`
	Headers              *Headers             `json:"headers,omitempty"`
	Errors               map[string]ErrorPage `json:"errors,omitempty"`
	RateLimit            *RateLimit           `json:"ratelimit,omitempty"`
	Redirect             *Redirect            `json:"redirect,omitempty"`
}

Frontend holds frontend configuration.

type Headers added in v1.4.0

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"`
	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"`
	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 added in v1.4.0

func (h *Headers) HasCustomHeadersDefined() bool

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

func (*Headers) HasSecureHeadersDefined added in v1.4.0

func (h *Headers) HasSecureHeadersDefined() bool

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

type HealthCheck added in v1.2.0

type HealthCheck struct {
	Path     string `json:"path,omitempty"`
	Port     int    `json:"port,omitempty"`
	Interval string `json:"interval,omitempty"`
}

HealthCheck holds HealthCheck configuration

type InfluxDB added in v1.5.0

type InfluxDB struct {
	Address      string `description:"InfluxDB address"`
	PushInterval string `description:"InfluxDB push interval"`
}

InfluxDB contains address and metrics pushing interval configuration

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 added in v1.2.0

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 added in v1.2.0

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 added in v1.5.0

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 added in v1.5.0

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 added in v1.5.0

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

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

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 Statistics added in v1.2.0

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

Statistics provides options for monitoring request and response stats

type Statsd added in v1.4.0

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 Stickiness added in v1.4.0

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

Stickiness holds sticky session configuration.

type Store added in v1.1.0

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

Store holds KV store cluster config

type TraefikLog added in v1.5.0

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 added in v1.1.0

type Users []string

Users authentication users

Jump to

Keyboard shortcuts

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