rules

package
v0.7.12 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func AnnotationIsBool added in v0.7.0

func AnnotationIsBool(name, v string) (value.Bool, error)

func AnnotationIsForcibleBool added in v0.4.0

func AnnotationIsForcibleBool(name, v string) (result value.ForcibleBool, err error)

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 (this *ByHost) All(consumer func(Rule) error) error

func (*ByHost) Clone

func (this *ByHost) Clone() *ByHost

func (*ByHost) Find

func (this *ByHost) Find(host value.Fqdn, path []string) (Rules, error)

func (*ByHost) Put

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

func (*ByHost) Remove

func (this *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 (this *ByPath) All(consumer func(Rule) error) error

func (*ByPath) Clone

func (this *ByPath) Clone() *ByPath

func (*ByPath) Find

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

func (*ByPath) HasContent

func (this *ByPath) HasContent() bool

func (*ByPath) Put

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

func (*ByPath) Remove

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

type CertificateQuery

type CertificateQuery struct {
	Host value.WildcardSupportingFqdn
}

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 (*CertificatesByHost) AddBytes

func (this *CertificatesByHost) AddBytes(source support.ObjectReference, certificate, privateKey []byte) (value.WildcardSupportingFqdns, error)

func (*CertificatesByHost) Find

func (*CertificatesByHost) RemoveBySource added in v0.7.0

type CombinedRepository

type CombinedRepository interface {
	Repository
	CertificateRepository
}

func NewRepository

func NewRepository(s *settings.Settings, logger log.Logger) (CombinedRepository, error)

type KubernetesBasedRepository added in v0.1.6

type KubernetesBasedRepository struct {
	Environment *kubernetes.Environment
	ByHostRules *ByHost
	Logger      log.Logger

	CertificatesByHost CertificatesByHost
	OptionsFactory     OptionsFactory
	// contains filtered or unexported fields
}

func (*KubernetesBasedRepository) All added in v0.1.6

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

func (*KubernetesBasedRepository) FindBy added in v0.1.6

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

func (*KubernetesBasedRepository) FindCertificatesBy added in v0.1.6

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

func (*KubernetesBasedRepository) Init added in v0.1.6

type OnAdded

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

type OnRemoved

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

type Options

type Options map[string]OptionsPart

func (Options) IsRelevant

func (this Options) IsRelevant() bool

func (*Options) Set added in v0.1.6

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

type OptionsCompress added in v0.7.0

type OptionsCompress struct {
	Enabled value.Bool `json:"enabled,omitempty"`
}

func OptionsCompressOf added in v0.7.0

func OptionsCompressOf(rule Rule) *OptionsCompress

func (OptionsCompress) IsRelevant added in v0.7.0

func (this OptionsCompress) IsRelevant() bool

func (OptionsCompress) Name added in v0.7.0

func (this OptionsCompress) Name() string

func (*OptionsCompress) Set added in v0.7.0

func (this *OptionsCompress) Set(annotations Annotations) (err error)

type OptionsCors added in v0.1.6

type OptionsCors struct {
	Enabled            value.ForcibleBool  `json:"enabled,omitempty"`
	AllowedOriginsHost value2.HostPatterns `json:"allowedOriginsHost,omitempty"`
	AllowedMethods     value2.Methods      `json:"allowedMethods,omitempty"`
	AllowedHeaders     value2.HeaderNames  `json:"allowedHeaders,omitempty"`
	AllowedCredentials value.Bool          `json:"allowedCredentials,omitempty"`
	MaxAge             value.Duration      `json:"maxAge,omitempty"`
}

func OptionsCorsOf added in v0.1.6

func OptionsCorsOf(rule Rule) *OptionsCors

func (OptionsCors) IsRelevant added in v0.1.6

func (this OptionsCors) IsRelevant() bool

func (OptionsCors) Name added in v0.1.6

func (this OptionsCors) Name() string

func (*OptionsCors) Set added in v0.1.6

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

type OptionsCustomHeaders added in v0.1.6

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

func OptionsCustomHeadersOf added in v0.1.6

func OptionsCustomHeadersOf(rule Rule) *OptionsCustomHeaders

func (OptionsCustomHeaders) IsRelevant added in v0.1.6

func (this OptionsCustomHeaders) IsRelevant() bool

func (OptionsCustomHeaders) Name added in v0.1.6

func (this OptionsCustomHeaders) Name() string

func (*OptionsCustomHeaders) Set added in v0.1.6

func (this *OptionsCustomHeaders) 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 value.Bool `json:"stripRulePathPrefix,omitempty"`
	PathPrefix          []string   `json:"pathPrefix,omitempty"`
	XForwardedPrefix    value.Bool `json:"xForwardedPrefix,omitempty"`
}

func OptionsPrefixOf added in v0.1.6

func OptionsPrefixOf(rule Rule) *OptionsPrefix

func (OptionsPrefix) IsRelevant added in v0.1.6

func (this OptionsPrefix) IsRelevant() bool

func (OptionsPrefix) Name added in v0.1.6

func (this OptionsPrefix) Name() string

func (*OptionsPrefix) Set added in v0.1.6

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

type OptionsSecure added in v0.1.6

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

func OptionsSecureOf added in v0.1.6

func OptionsSecureOf(rule Rule) *OptionsSecure

func (OptionsSecure) IsRelevant added in v0.1.6

func (this OptionsSecure) IsRelevant() bool

func (OptionsSecure) Name added in v0.1.6

func (this OptionsSecure) Name() string

func (*OptionsSecure) Set added in v0.1.6

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

type PathType added in v0.7.0

type PathType uint8
const (
	PathTypeExact PathType = iota
	PathTypePrefix
)

func ParsePathType added in v0.7.0

func ParsePathType(in *networkingv1.PathType) (PathType, error)

func (PathType) String added in v0.7.0

func (this PathType) String() string

type Predicate

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

func PredicateByObjectReference added in v0.7.0

func PredicateByObjectReference(or support.ObjectReference) Predicate

type Query

type Query struct {
	Host value.Fqdn
	Path string
}

type Repository

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

type Rule

type Rule interface {
	Host() value.WildcardSupportingFqdn
	Path() []string
	PathType() PathType
	Source() support.ObjectReference
	Backend() net.Addr
	Options() Options
	Statistics() *Statistics

	tree.Cloneable[Rule]
}

func NewRule

func NewRule(host value.WildcardSupportingFqdn, path []string, pathType PathType, source support.ObjectReference, backend net.Addr, options Options) Rule

type Rules

type Rules interface {
	Get(int) Rule
	Len() int
	Any() Rule
	AnyFilteredBy(path []string) Rule
}

type Statistics

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

func (*Statistics) MarkUsed

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

func (*Statistics) MarshalJSON

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

func (*Statistics) NumberOfUsages

func (this *Statistics) NumberOfUsages() uint64

func (*Statistics) TotalDuration

func (this *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