rules

package
v0.1.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckRule

func CheckRule(ruleConfig *config.RuleConfig) error

Types

type Exclusion

type Exclusion struct {
	Pattern string `xml:"pattern,attr"`
}

func (*Exclusion) Is

func (e *Exclusion) Is(test string) bool

type Rule

type Rule struct {
	From   string `xml:"from,attr"`
	To     string `xml:"to,attr"`
	FromRe *regexp.Regexp
}

func (*Rule) Apply

func (r *Rule) Apply(uri string) string

func (*Rule) Init

func (r *Rule) Init() error

type RuleSet

type RuleSet struct {
	Targets    []Target    `xml:"target"`
	Exclusions []Exclusion `xml:"exclusion"`
	Rules      []Rule      `xml:"rule"`
}

func LoadRuleSet

func LoadRuleSet(any interface{}) (*RuleSet, error)

func (*RuleSet) Apply

func (rs *RuleSet) Apply(urispec string) (*string, bool)

func (*RuleSet) Is

func (rs *RuleSet) Is(test string) bool

type RuleSets

type RuleSets struct {
	Lock sync.RWMutex
	// contains filtered or unexported fields
}

func NewRuleSets

func NewRuleSets() *RuleSets

func (*RuleSets) Apply

func (rs *RuleSets) Apply(test string) (*string, bool)

func (*RuleSets) LoadRuleSets

func (rs *RuleSets) LoadRuleSets(root string) (*RuleSets, error)

type Target

type Target struct {
	Host string `xml:"host,attr"`
}

func (*Target) Is

func (t *Target) Is(test string) bool

type Tester

type Tester interface {
	Is(string) bool
}

Jump to

Keyboard shortcuts

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