config

package
v0.9.1-alpha Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const CurrentRuleSetVersion = "1"

Variables

View Source
var (
	ErrURLMissing          = errors.New("url property not present")
	ErrURLType             = errors.New("bad url type")
	ErrStrategyType        = errors.New("bad strategy type")
	ErrUnsupportedStrategy = errors.New("unsupported strategy")
)
View Source
var ErrEmptyRuleSet = errors.New("empty rule set")

Functions

func DecodeConfig

func DecodeConfig(input any, output any) error

Types

type Matcher

type Matcher struct {
	URL      string `json:"url" yaml:"url"`
	Strategy string `json:"strategy" yaml:"strategy"`
}

func (*Matcher) UnmarshalJSON

func (m *Matcher) UnmarshalJSON(data []byte) error

type MetaData

type MetaData struct {
	Hash    []byte    `json:"-" yaml:"-"`
	Source  string    `json:"-" yaml:"-"`
	ModTime time.Time `json:"-" yaml:"-"`
}

type Rule

type Rule struct {
	ID           string                   `json:"id" yaml:"id"`
	RuleMatcher  Matcher                  `json:"match" yaml:"match"`
	Upstream     string                   `json:"upstream" yaml:"upstream"`
	Methods      []string                 `json:"methods" yaml:"methods"`
	Execute      []config.MechanismConfig `json:"execute" yaml:"execute"`
	ErrorHandler []config.MechanismConfig `json:"on_error" yaml:"on_error"`
}

func (*Rule) DeepCopy

func (in *Rule) DeepCopy() *Rule

func (*Rule) DeepCopyInto

func (in *Rule) DeepCopyInto(out *Rule)

type RuleSet

type RuleSet struct {
	MetaData

	Version string `json:"version" yaml:"version"`
	Name    string `json:"name" yaml:"name"`
	Rules   []Rule `json:"rules" yaml:"rules"`
}

func ParseRules

func ParseRules(contentType string, reader io.Reader) (*RuleSet, error)

func (RuleSet) VerifyPathPrefix

func (rs RuleSet) VerifyPathPrefix(prefix string) error

Jump to

Keyboard shortcuts

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