types

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildRawFrontends

func BuildRawFrontends(hosts []*Host) (frontends []*Frontend, sslpassthrough []*Host, defaultBind *BindConfig)

BuildRawFrontends ...

Types

type AgentCheck

type AgentCheck struct {
	Addr     string
	Interval string
	Port     int
	Send     string
}

AgentCheck ...

type Backend

type Backend struct {
	//
	// core config
	//
	ID        string
	Namespace string
	Name      string
	Port      string
	Endpoints []*Endpoint
	EpNaming  EndpointNaming
	Paths     []*BackendPath
	PathsMap  *HostsMap
	//
	// per backend config
	//
	AgentCheck       AgentCheck
	BalanceAlgorithm string
	Cookie           Cookie
	CustomConfig     []string
	Dynamic          DynBackendConfig
	HealthCheck      HealthCheck
	Limit            BackendLimit
	ModeTCP          bool
	OAuth            OAuthConfig
	Resolver         string
	Server           ServerConfig
	Timeout          BackendTimeoutConfig
	TLS              BackendTLSConfig
	WhitelistTCP     []string
	//
	// per path config
	//
	// TODO refactor
	//
	// The current implementation is tricky. A small refactor is welcome
	// but can wait a little more. Multipath unit tests need to do a
	// better job as well.
	//
	// Following some tips in order to multipath work properly:
	//
	//   1. On backend annotation parsing, do not filter
	//      mapper.GetBackendConfig/Str() slice, instead populate
	//      haproxy type even with empty data. Backend.NeedACL() need
	//      to know all paths in order to work properly. Filter out
	//      empty/disabled items in the template.
	//
	//   2. Every config array added here, need also to be added
	//      in Backend.NeedACL() - haproxy/types/backend.go.
	//      Template uses this func in order to know if a config
	//      has two or more paths, and so need to be configured with ACL.
	//
	AuthHTTP      []*BackendConfigAuth
	Cors          []*BackendConfigCors
	HSTS          []*BackendConfigHSTS
	MaxBodySize   []*BackendConfigInt
	RewriteURL    []*BackendConfigStr
	SSLRedirect   []*BackendConfigBool
	WAF           []*BackendConfigStr
	WhitelistHTTP []*BackendConfigWhitelist
}

Backend ...

func (*Backend) AcquireEndpoint

func (b *Backend) AcquireEndpoint(ip string, port int, targetRef string) *Endpoint

AcquireEndpoint ...

func (*Backend) AddEmptyEndpoint

func (b *Backend) AddEmptyEndpoint() *Endpoint

AddEmptyEndpoint ...

func (*Backend) AddHostPath

func (b *Backend) AddHostPath(hostname, path string) *BackendPath

AddHostPath ...

func (*Backend) CreateConfigBool

func (b *Backend) CreateConfigBool(value bool) []*BackendConfigBool

CreateConfigBool ...

func (*Backend) FindEndpoint

func (b *Backend) FindEndpoint(target string) *Endpoint

FindEndpoint ...

func (*Backend) FindHostPath

func (b *Backend) FindHostPath(hostpath string) *BackendPath

FindHostPath ...

func (*Backend) HasCorsEnabled

func (b *Backend) HasCorsEnabled() bool

HasCorsEnabled ...

func (*Backend) HasModsec

func (b *Backend) HasModsec() bool

HasModsec ...

func (*Backend) HasSSLRedirect

func (b *Backend) HasSSLRedirect() bool

HasSSLRedirect ...

func (*Backend) HasSSLRedirectHostpath

func (b *Backend) HasSSLRedirectHostpath(hostpath string) bool

HasSSLRedirectHostpath ...

func (*Backend) HasSSLRedirectPaths

func (b *Backend) HasSSLRedirectPaths(paths *BackendPaths) bool

HasSSLRedirectPaths ...

func (*Backend) Hostnames

func (b *Backend) Hostnames() []string

Hostnames ...

func (*Backend) MaxBodySizeHostpath

func (b *Backend) MaxBodySizeHostpath(hostpath string) int64

MaxBodySizeHostpath ...

func (*Backend) NeedACL

func (b *Backend) NeedACL() bool

NeedACL ...

func (*Backend) SortEndpoints

func (b *Backend) SortEndpoints()

SortEndpoints ...

type BackendConfigAuth

type BackendConfigAuth struct {
	Paths        BackendPaths
	UserlistName string
	Realm        string
}

BackendConfigAuth ...

func (*BackendConfigAuth) String

func (b *BackendConfigAuth) String() string

String ...

type BackendConfigBool

type BackendConfigBool struct {
	Paths  BackendPaths
	Config bool
}

BackendConfigBool ...

func (*BackendConfigBool) String

func (b *BackendConfigBool) String() string

String ...

type BackendConfigCors

type BackendConfigCors struct {
	Paths  BackendPaths
	Config Cors
}

BackendConfigCors ...

func (*BackendConfigCors) String

func (b *BackendConfigCors) String() string

String ...

type BackendConfigHSTS

type BackendConfigHSTS struct {
	Paths  BackendPaths
	Config HSTS
}

BackendConfigHSTS ...

func (*BackendConfigHSTS) String

func (b *BackendConfigHSTS) String() string

String ...

type BackendConfigInt

type BackendConfigInt struct {
	Paths  BackendPaths
	Config int64
}

BackendConfigInt ...

func (*BackendConfigInt) String

func (b *BackendConfigInt) String() string

String ...

type BackendConfigStr

type BackendConfigStr struct {
	Paths  BackendPaths
	Config string
}

BackendConfigStr ...

func (*BackendConfigStr) String

func (b *BackendConfigStr) String() string

String ...

type BackendConfigWhitelist

type BackendConfigWhitelist struct {
	Paths  BackendPaths
	Config []string
}

BackendConfigWhitelist ...

func (*BackendConfigWhitelist) String

func (b *BackendConfigWhitelist) String() string

String ...

type BackendLimit

type BackendLimit struct {
	Connections int
	RPS         int
	Whitelist   []string
}

BackendLimit ...

type BackendPath

type BackendPath struct {
	ID       string
	Hostname string
	Hostpath string
	Path     string
}

BackendPath ...

func (*BackendPath) String

func (p *BackendPath) String() string

String ...

type BackendPaths

type BackendPaths struct {
	Items []*BackendPath
}

BackendPaths ...

func NewBackendPaths

func NewBackendPaths(paths ...*BackendPath) BackendPaths

NewBackendPaths ...

func (*BackendPaths) Add

func (p *BackendPaths) Add(paths ...*BackendPath)

Add ...

func (*BackendPaths) IDList

func (p *BackendPaths) IDList() string

IDList ...

type BackendTLSConfig

type BackendTLSConfig struct {
	AddCertHeader bool
	HasTLSAuth    bool
}

BackendTLSConfig ...

type BackendTimeoutConfig

type BackendTimeoutConfig struct {
	Connect     string
	HTTPRequest string
	KeepAlive   string
	Queue       string
	Server      string
	ServerFin   string
	Tunnel      string
}

BackendTimeoutConfig ...

type BindConfig

type BindConfig struct {
	Name   string
	Socket string
	ID     int
	Hosts  []*Host
	//
	AcceptProxy bool
	TLS         BindTLSConfig
	//
	Maps          *HostsMaps
	UseServerList *HostsMap
}

BindConfig ...

func NewFrontendBind

func NewFrontendBind(host *Host) *BindConfig

NewFrontendBind and BindConfig.Match should always sinchronize its attributes

type BindTLSConfig

type BindTLSConfig struct {
	ALPN       string
	CAFilename string
	CAHash     string
	TLSCert    string
	TLSCertDir string
}

BindTLSConfig ...

type BindUtils

type BindUtils interface {
	CreateX509CertsDir(bindName string, certs []string) (string, error)
}

BindUtils ...

type Cookie struct {
	Name     string
	Dynamic  bool
	Shared   bool
	Strategy string
}

Cookie ...

type CookieConfig

type CookieConfig struct {
	Key string
}

CookieConfig ...

type Cors

type Cors struct {
	Enabled bool
	//
	AllowCredentials bool
	AllowHeaders     string
	AllowMethods     string
	AllowOrigin      string
	ExposeHeaders    string
	MaxAge           int
}

Cors ...

type DHParamConfig

type DHParamConfig struct {
	Filename       string
	DefaultMaxSize int
}

DHParamConfig ...

type DNSConfig

type DNSConfig struct {
	ClusterDomain string
	Resolvers     []*DNSResolver
}

DNSConfig ...

func (*DNSConfig) String

func (dns *DNSConfig) String() string

type DNSNameserver

type DNSNameserver struct {
	Name     string
	Endpoint string
}

DNSNameserver ...

func (*DNSNameserver) String

func (dns *DNSNameserver) String() string

type DNSResolver

type DNSResolver struct {
	Name                string
	Nameservers         []*DNSNameserver
	AcceptedPayloadSize int
	HoldObsolete        string
	HoldValid           string
	TimeoutRetry        string
}

DNSResolver ...

func (*DNSResolver) String

func (dns *DNSResolver) String() string

type DrainConfig

type DrainConfig struct {
	Drain      bool
	Redispatch bool
}

DrainConfig ...

type DynBackendConfig

type DynBackendConfig struct {
	BlockSize    int
	DynUpdate    bool
	MinFreeSlots int
}

DynBackendConfig ...

type Endpoint

type Endpoint struct {
	Enabled   bool
	IP        string
	Name      string
	Port      int
	Target    string
	TargetRef string
	Weight    int
}

Endpoint ...

func (*Endpoint) IsEmpty

func (ep *Endpoint) IsEmpty() bool

IsEmpty ...

type EndpointNaming

type EndpointNaming int

EndpointNaming ...

const (
	EpSequence EndpointNaming = iota
	EpIPPort
	EpTargetRef
)

...

type Frontend

type Frontend struct {
	Name  string
	Binds []*BindConfig
	Hosts []*Host
	//
	Timeout HostTimeoutConfig
	//
	Maps                       *HostsMaps
	HostBackendsMap            *HostsMap
	MaxBodySizeMap             *HostsMap
	RootRedirMap               *HostsMap
	SNIBackendsMap             *HostsMap
	TLSInvalidCrtErrorList     *HostsMap
	TLSInvalidCrtErrorPagesMap *HostsMap
	TLSNoCrtErrorList          *HostsMap
	TLSNoCrtErrorPagesMap      *HostsMap
}

Frontend ...

func NewFrontend

func NewFrontend(host *Host) *Frontend

NewFrontend and Frontend.Match should always sinchronize its attributes

func (*Frontend) HasInvalidErrorPage

func (f *Frontend) HasInvalidErrorPage() bool

HasInvalidErrorPage ...

func (*Frontend) HasMaxBody

func (f *Frontend) HasMaxBody() bool

HasMaxBody ...

func (*Frontend) HasNoCrtErrorPage

func (f *Frontend) HasNoCrtErrorPage() bool

HasNoCrtErrorPage ...

func (*Frontend) HasTLSAuth

func (f *Frontend) HasTLSAuth() bool

HasTLSAuth ...

func (*Frontend) HasTLSMandatory

func (f *Frontend) HasTLSMandatory() bool

HasTLSMandatory ...

func (*Frontend) String

func (f *Frontend) String() string

String ...

type FrontendGroup

type FrontendGroup struct {
	Frontends []*Frontend
	//
	DefaultBind       *BindConfig
	HasSSLPassthrough bool
	ToHTTPBind        BindConfig
	//
	Maps              *HostsMaps
	HTTPFrontsMap     *HostsMap
	HTTPRootRedirMap  *HostsMap
	HTTPSRedirMap     *HostsMap
	SSLPassthroughMap *HostsMap
	VarNamespaceMap   *HostsMap
}

FrontendGroup ...

func (*FrontendGroup) HasTCPProxy

func (fg *FrontendGroup) HasTCPProxy() bool

HasTCPProxy ...

func (*FrontendGroup) HasVarNamespace

func (fg *FrontendGroup) HasVarNamespace() bool

HasVarNamespace ...

type Global

type Global struct {
	Bind            GlobalBindConfig
	Procs           ProcsConfig
	Syslog          SyslogConfig
	MaxConn         int
	Timeout         TimeoutConfig
	SSL             SSLConfig
	DNS             DNSConfig
	ModSecurity     ModSecurityConfig
	Cookie          CookieConfig
	DrainSupport    DrainConfig
	ForwardFor      string
	LoadServerState bool
	AdminSocket     string
	Healthz         HealthzConfig
	Stats           StatsConfig
	StrictHost      bool
	CustomConfig    []string
	CustomDefaults  []string
	CustomFrontend  []string
}

Global ...

type GlobalBindConfig

type GlobalBindConfig struct {
	AcceptProxy    bool
	HTTPBind       string
	HTTPSBind      string
	TCPBindIP      string
	FrontingBind   string
	FrontingSockID int
}

GlobalBindConfig ...

func (GlobalBindConfig) HasFrontingProxy

func (b GlobalBindConfig) HasFrontingProxy() bool

HasFrontingProxy ...

func (GlobalBindConfig) ShareHTTPPort

func (b GlobalBindConfig) ShareHTTPPort() bool

ShareHTTPPort ...

type HSTS

type HSTS struct {
	Enabled    bool
	MaxAge     int
	Subdomains bool
	Preload    bool
}

HSTS ...

type HealthCheck

type HealthCheck struct {
	Addr      string
	FallCount int
	Interval  string
	Port      int
	RiseCount int
	URI       string
}

HealthCheck ...

type HealthzConfig

type HealthzConfig struct {
	BindIP string
	Port   int
}

HealthzConfig ...

type Host

type Host struct {
	Hostname string
	Paths    []*HostPath
	//
	Alias                  HostAliasConfig
	HTTPPassthroughBackend string
	RootRedirect           string
	SSLPassthrough         bool
	Timeout                HostTimeoutConfig
	TLS                    HostTLSConfig
	VarNamespace           bool
}

Host ...

Wildcard `*` hostname is a catch all and will be used if no other hostname, alias or regex matches the request. If wildcard hostname is not declared, the default backend will be used. If the default backend is empty, a default 404 page generated by HAProxy will be used.

func (*Host) AddPath

func (h *Host) AddPath(backend *Backend, path string)

AddPath ...

func (*Host) FindPath

func (h *Host) FindPath(path string) *HostPath

FindPath ...

func (*Host) HasTLSAuth

func (h *Host) HasTLSAuth() bool

HasTLSAuth ...

func (*Host) String

func (h *Host) String() string

String ...

type HostAliasConfig

type HostAliasConfig struct {
	AliasName  string
	AliasRegex string
}

HostAliasConfig ...

type HostBackend

type HostBackend struct {
	ID        string
	Namespace string
	Name      string
	Port      string
}

HostBackend ...

type HostPath

type HostPath struct {
	Path    string
	Backend HostBackend
}

HostPath ...

Root context `/` path is a catch all and will be used if no other path matches the request on this host. If a root context path is not declared, the default backend will be used. If the default backend is empty, a default 404 page generated by HAProxy will be used.

type HostTLSConfig

type HostTLSConfig struct {
	CAErrorPage      string
	CAFilename       string
	CAHash           string
	CAVerifyOptional bool
	TLSFilename      string
	TLSHash          string
}

HostTLSConfig ...

func (*HostTLSConfig) HasTLS

func (h *HostTLSConfig) HasTLS() bool

HasTLS ...

type HostTimeoutConfig

type HostTimeoutConfig struct {
	Client    string
	ClientFin string
}

HostTimeoutConfig ...

type HostsMap

type HostsMap struct {
	Match     []*HostsMapEntry
	MatchFile string
	Regex     []*HostsMapEntry
	RegexFile string
}

HostsMap ...

func (*HostsMap) AppendAliasName

func (hm *HostsMap) AppendAliasName(base, value string)

AppendAliasName ...

func (*HostsMap) AppendAliasRegex

func (hm *HostsMap) AppendAliasRegex(base, value string)

AppendAliasRegex ...

func (*HostsMap) AppendHostname

func (hm *HostsMap) AppendHostname(base, value string)

AppendHostname ...

func (*HostsMap) AppendPath

func (hm *HostsMap) AppendPath(path, id string)

AppendPath ...

func (*HostsMap) HasHost

func (hm *HostsMap) HasHost() bool

HasHost ...

func (*HostsMap) HasRegex

func (hm *HostsMap) HasRegex() bool

HasRegex ...

type HostsMapEntry

type HostsMapEntry struct {
	Key   string
	Value string
}

HostsMapEntry ...

type HostsMaps

type HostsMaps struct {
	Items []*HostsMap
}

HostsMaps ...

func CreateMaps

func CreateMaps() *HostsMaps

CreateMaps ...

func (*HostsMaps) AddMap

func (hm *HostsMaps) AddMap(filename string) *HostsMap

AddMap ...

type ModSecurityConfig

type ModSecurityConfig struct {
	Endpoints []string
	Timeout   ModSecurityTimeoutConfig
}

ModSecurityConfig ...

type ModSecurityTimeoutConfig

type ModSecurityTimeoutConfig struct {
	Hello      string
	Idle       string
	Processing string
}

ModSecurityTimeoutConfig ...

type OAuthConfig

type OAuthConfig struct {
	Impl        string
	BackendName string
	URIPrefix   string
	Headers     map[string]string
}

OAuthConfig ...

type ProcsConfig

type ProcsConfig struct {
	Nbproc          int
	Nbthread        int
	NbprocBalance   int
	NbprocSSL       int
	BindprocBalance string
	BindprocSSL     string
	CPUMap          string
}

ProcsConfig ...

type SSLConfig

type SSLConfig struct {
	ALPN          string
	DHParam       DHParamConfig
	Ciphers       string
	Options       string
	Engine        string
	ModeAsync     bool
	HeadersPrefix string
}

SSLConfig ...

type ServerConfig

type ServerConfig struct {
	CAFilename    string
	CAHash        string
	Ciphers       string // TLS up to 1.2
	CipherSuites  string // TLS 1.3
	CRLFilename   string
	CRLHash       string
	CrtFilename   string
	CrtHash       string
	InitialWeight int
	MaxConn       int
	MaxQueue      int
	Options       string
	Protocol      string
	Secure        bool
	SendProxy     string
}

ServerConfig ...

type StatsConfig

type StatsConfig struct {
	AcceptProxy bool
	Auth        string
	BindIP      string
	Port        int
	TLSFilename string
	TLSHash     string
}

StatsConfig ...

type SyslogConfig

type SyslogConfig struct {
	Endpoint       string
	Format         string
	HTTPLogFormat  string
	HTTPSLogFormat string
	Tag            string
	TCPLogFormat   string
}

SyslogConfig ...

type TCPBackend

type TCPBackend struct {
	Name          string
	Port          int
	Endpoints     []*TCPEndpoint
	CheckInterval string
	SSL           TCPSSL
	ProxyProt     TCPProxyProt
}

TCPBackend ...

func (*TCPBackend) AddEndpoint

func (b *TCPBackend) AddEndpoint(ip string, port int) *TCPEndpoint

AddEndpoint ...

func (*TCPBackend) String

func (b *TCPBackend) String() string

String ...

type TCPEndpoint

type TCPEndpoint struct {
	Name   string
	IP     string
	Port   int
	Target string
}

TCPEndpoint ...

func (*TCPEndpoint) String

func (ep *TCPEndpoint) String() string

String ...

type TCPProxyProt

type TCPProxyProt struct {
	Decode        bool
	EncodeVersion string
}

TCPProxyProt ...

type TCPSSL

type TCPSSL struct {
	Filename string
}

TCPSSL ...

type TimeoutConfig

type TimeoutConfig struct {
	HostTimeoutConfig
	BackendTimeoutConfig
	Stop string
}

TimeoutConfig ...

type User

type User struct {
	Name      string
	Passwd    string
	Encrypted bool
}

User ...

type Userlist

type Userlist struct {
	Name  string
	Users []User
}

Userlist ...

func (*Userlist) String

func (u *Userlist) String() string

type UserlistConfig

type UserlistConfig struct {
	Name  string
	Realm string
}

UserlistConfig ...

Jump to

Keyboard shortcuts

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