Back to

Package rules

Latest Go to latest

The latest major version is .

Published: Jul 30, 2020 | License: Apache-2.0 | Module:


Package rules provides primitives for working with routing rules.


type Rule

type Rule struct {
	Regexs     []string
	Prefixes   []string
	Targets    []target.Target
	Continue   bool
	CompiledRE []*regexp.Regexp
	// contains filtered or unexported fields

Rule is a routing rule.

func (Rule) Match

func (rl Rule) Match(r *rec.Rec, measureRegex bool) bool

Match a record with any of the rule regexps

type Rules

type Rules struct {
	// contains filtered or unexported fields

Rules represent all the routing rules/routing table.

func Build

func Build(crs conf.Rules, clusters target.Clusters, measureRegex bool, ms *metrics.Prom) (Rules, error)

Build reads rules from config, compiles them.

func TestBuild

func TestBuild(crs conf.Rules, clusters map[string]*target.TestTarget, measureRegex bool, ms *metrics.Prom) (Rules, error)

TestBuild makes a set of rules for testgin.

func (Rules) RouteRec

func (rs Rules) RouteRec(r *rec.Rec, lg *zap.Logger)

RouteRec a record by following the rules

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier