rules

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2020 License: MIT Imports: 20 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
}

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 OnAdded

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

type OnRemoved

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

type OptionalBool

type OptionalBool uint8

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 struct {
	Cors OptionalBool `json:"cors,omitempty"`

	ForceSecure OptionalBool `json:"forceSecure,omitempty"`

	StripRulePathPrefix OptionalBool `json:"stripRulePathPrefix,omitempty"`
	PathPrefix          []string     `json:"pathPrefix,omitempty"`
	XForwardedPrefix    OptionalBool `json:"xForwardedPrefix,omitempty"`

	WhitelistedRemotes []Address `json:"whitelistedRemotes,omitempty"`

	RequestHeaders  Headers `json:"requestHeaders,omitempty"`
	ResponseHeaders Headers `json:"responseHeaders,omitempty"`
}

func (Options) IsRelevant

func (instance Options) IsRelevant() bool

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