rules

package
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: May 25, 2020 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NotDefined = OptionalBool(0)
	False      = OptionalBool(1)
	True       = OptionalBool(2)
)

Variables

View Source
var (
	ErrIllegalPath = errors.New("illegal path")
)

Functions

func ParsePath

func ParsePath(in string, faultTolerant bool) ([]string, error)

Types

type Address

type Address interface {
	Matches(net.IP) bool
}

func AnnotationAddresses added in v0.1.6

func AnnotationAddresses(name, value string) (result []Address, err error)

type Annotations added in v0.1.6

type Annotations map[string]string

type ByHost

type ByHost struct {
	// contains filtered or unexported fields
}

func NewByHost

func NewByHost(onAdded OnAdded, onRemoved OnRemoved) *ByHost

func (*ByHost) All

func (instance *ByHost) All(consumer func(Rule) error) error

func (*ByHost) Clone

func (instance *ByHost) Clone() *ByHost

func (*ByHost) Find

func (instance *ByHost) Find(host string, path []string) (Rules, error)

func (*ByHost) HasContent

func (instance *ByHost) HasContent() bool

func (*ByHost) Put

func (instance *ByHost) Put(r Rule) error

func (*ByHost) Remove

func (instance *ByHost) Remove(predicate Predicate) error

type ByPath

type ByPath struct {
	// contains filtered or unexported fields
}

func NewByPath

func NewByPath(onAdded OnAdded, onRemoved OnRemoved) *ByPath

func (*ByPath) All

func (instance *ByPath) All(consumer func(Rule) error) error

func (*ByPath) Clone

func (instance *ByPath) Clone() *ByPath

func (*ByPath) Find

func (instance *ByPath) Find(path []string) (Rules, error)

func (*ByPath) HasContent

func (instance *ByPath) HasContent() bool

func (*ByPath) Put

func (instance *ByPath) Put(r Rule) error

func (*ByPath) Remove

func (instance *ByPath) Remove(predicate Predicate) error

type CertificateQuery

type CertificateQuery struct {
	Host string
}

type CertificateRepository

type CertificateRepository interface {
	FindCertificatesBy(CertificateQuery) (Certificates, error)
}

type Certificates

type Certificates []*tls.Certificate

type CertificatesByHost

type CertificatesByHost struct {
	// contains filtered or unexported fields
}

func (*CertificatesByHost) Add

func (instance *CertificatesByHost) Add(certificate tls.Certificate) error

func (*CertificatesByHost) AddBytes

func (instance *CertificatesByHost) AddBytes(certificate, privateKey []byte) error

func (CertificatesByHost) Find

func (instance CertificatesByHost) Find(host string) Certificates

type CombinedRepository

type CombinedRepository interface {
	Repository
	CertificateRepository
}

func NewRepository

func NewRepository() (CombinedRepository, error)

type ForceableBool

type ForceableBool struct {
	Value  bool
	Forced bool
}

func (*ForceableBool) Set

func (instance *ForceableBool) Set(plain string) error

func (ForceableBool) String

func (instance ForceableBool) String() string
type Header struct {
	Key    string
	Value  string
	Forced bool
	Add    bool
	Del    bool
}

func (*Header) Set

func (instance *Header) Set(plain string) error

func (Header) String

func (instance Header) String() string

type Headers

type Headers []Header

func (*Headers) IsCumulative

func (instance *Headers) IsCumulative() bool

func (*Headers) Set

func (instance *Headers) Set(plain string) error

func (Headers) String

func (instance Headers) String() string

type KubernetesBasedRepository added in v0.1.6

type KubernetesBasedRepository struct {
	Environment  *kubernetes.Environment
	ByHostRules  *ByHost
	ResyncAfter  time.Duration
	IngressClass []string

	CertificatesSecret string
	CertificatesByHost CertificatesByHost
	OptionsFactory     OptionsFactory
}

func (*KubernetesBasedRepository) All added in v0.1.6

func (instance *KubernetesBasedRepository) All(consumer func(Rule) error) error

func (*KubernetesBasedRepository) FindBy added in v0.1.6

func (instance *KubernetesBasedRepository) FindBy(q Query) (Rules, error)

func (*KubernetesBasedRepository) FindCertificatesBy added in v0.1.6

func (instance *KubernetesBasedRepository) FindCertificatesBy(q CertificateQuery) (Certificates, error)

func (*KubernetesBasedRepository) Init added in v0.1.6

func (instance *KubernetesBasedRepository) Init(stop support.Channel) error

func (*KubernetesBasedRepository) RegisterFlag added in v0.1.6

func (instance *KubernetesBasedRepository) RegisterFlag(fe support.FlagEnabled, appPrefix string) error

type OnAdded

type OnAdded func(path []string, r Rule)

type OnRemoved

type OnRemoved func(path []string, r Rule)

type OptionalBool

type OptionalBool uint8

func AnnotationIsTrue added in v0.1.6

func AnnotationIsTrue(name, value string) (OptionalBool, error)

func (OptionalBool) IsEnabled

func (instance OptionalBool) IsEnabled(def bool) bool

func (OptionalBool) IsEnabledOrForced

func (instance OptionalBool) IsEnabledOrForced(def ForceableBool) bool

func (*OptionalBool) Set

func (instance *OptionalBool) Set(plain string) error

func (OptionalBool) String

func (instance OptionalBool) String() string

type Options

type Options map[string]OptionsPart

func (Options) IsRelevant

func (instance Options) IsRelevant() bool

func (*Options) Set added in v0.1.6

func (instance *Options) Set(annotations Annotations) error

type OptionsCors added in v0.1.6

type OptionsCors struct {
	Cors OptionalBool `json:"cors,omitempty"`
}

func OptionsCorsOf added in v0.1.6

func OptionsCorsOf(options Options) *OptionsCors

func (OptionsCors) IsRelevant added in v0.1.6

func (instance OptionsCors) IsRelevant() bool

func (OptionsCors) Name added in v0.1.6

func (instance OptionsCors) Name() string

func (*OptionsCors) Set added in v0.1.6

func (instance *OptionsCors) Set(annotations Annotations) (err error)

type OptionsCustomHeaders added in v0.1.6

type OptionsCustomHeaders struct {
	RequestHeaders  Headers `json:"requestHeaders,omitempty"`
	ResponseHeaders Headers `json:"responseHeaders,omitempty"`
}

func OptionsCustomHeadersOf added in v0.1.6

func OptionsCustomHeadersOf(options Options) *OptionsCustomHeaders

func (OptionsCustomHeaders) IsRelevant added in v0.1.6

func (instance OptionsCustomHeaders) IsRelevant() bool

func (OptionsCustomHeaders) Name added in v0.1.6

func (instance OptionsCustomHeaders) Name() string

func (*OptionsCustomHeaders) Set added in v0.1.6

func (instance *OptionsCustomHeaders) Set(annotations Annotations) (err error)

type OptionsEncoding added in v0.1.14

type OptionsEncoding struct {
	TransportEncoding string `json:"transportEncoding,omitempty"`
}

func OptionsEncodingOf added in v0.1.14

func OptionsEncodingOf(options Options) *OptionsEncoding

func (OptionsEncoding) IsRelevant added in v0.1.14

func (instance OptionsEncoding) IsRelevant() bool

func (OptionsEncoding) Name added in v0.1.14

func (instance OptionsEncoding) Name() string

func (*OptionsEncoding) Set added in v0.1.14

func (instance *OptionsEncoding) Set(annotations Annotations) (err error)

type OptionsFactory added in v0.1.6

type OptionsFactory func() Options
var (
	DefaultOptionsFactory OptionsFactory = newOptions
)

type OptionsPart added in v0.1.6

type OptionsPart interface {
	Name() string
	IsRelevant() bool
	Set(annotations Annotations) error
}

func RegisterDefaultOptionsPart added in v0.1.6

func RegisterDefaultOptionsPart(prototype OptionsPart) OptionsPart

type OptionsPrefix added in v0.1.6

type OptionsPrefix struct {
	StripRulePathPrefix OptionalBool `json:"stripRulePathPrefix,omitempty"`
	PathPrefix          []string     `json:"pathPrefix,omitempty"`
	XForwardedPrefix    OptionalBool `json:"xForwardedPrefix,omitempty"`
}

func OptionsPrefixOf added in v0.1.6

func OptionsPrefixOf(options Options) *OptionsPrefix

func (OptionsPrefix) IsRelevant added in v0.1.6

func (instance OptionsPrefix) IsRelevant() bool

func (OptionsPrefix) Name added in v0.1.6

func (instance OptionsPrefix) Name() string

func (*OptionsPrefix) Set added in v0.1.6

func (instance *OptionsPrefix) Set(annotations Annotations) (err error)

type OptionsSecure added in v0.1.6

type OptionsSecure struct {
	ForceSecure        OptionalBool `json:"forceSecure,omitempty"`
	WhitelistedRemotes []Address    `json:"whitelistedRemotes,omitempty"`
}

func OptionsSecureOf added in v0.1.6

func OptionsSecureOf(options Options) *OptionsSecure

func (OptionsSecure) IsRelevant added in v0.1.6

func (instance OptionsSecure) IsRelevant() bool

func (OptionsSecure) Name added in v0.1.6

func (instance OptionsSecure) Name() string

func (*OptionsSecure) Set added in v0.1.6

func (instance *OptionsSecure) Set(annotations Annotations) (err error)

type Predicate

type Predicate func(path []string, r Rule) bool

func PredicateBySource

func PredicateBySource(reference SourceReference) Predicate

type Query

type Query struct {
	Host string
	Path string
}

type Repository

type Repository interface {
	support.FlagRegistrar
	Init(stop support.Channel) error
	All(consumer func(Rule) error) error
	FindBy(Query) (Rules, error)
}

type Rule

type Rule interface {
	Host() string
	Path() []string
	Source() SourceReference
	Backend() net.Addr
	Options() Options
	Statistics() *Statistics
}

func NewRule

func NewRule(host string, path []string, source SourceReference, backend net.Addr, options Options) Rule

type Rules

type Rules interface {
	Get(int) Rule
	Len() int
	Any() Rule
}

type SourceReference

type SourceReference interface {
	Name() string
	Type() string
	String() string
	Equals(SourceReference) bool
}

type Statistics

type Statistics struct {
	// contains filtered or unexported fields
}

func (*Statistics) MarkUsed

func (instance *Statistics) MarkUsed(duration time.Duration)

func (*Statistics) MarshalJSON

func (instance *Statistics) MarshalJSON() ([]byte, error)

func (*Statistics) NumberOfUsages

func (instance *Statistics) NumberOfUsages() uint64

func (*Statistics) TotalDuration

func (instance *Statistics) TotalDuration() time.Duration

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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