filter

package
v0.0.3-pre13 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2022 License: Apache-2.0 Imports: 4 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chain

type Chain []*Filter

func NewAcceptAllFilterChain

func NewAcceptAllFilterChain() Chain

NewAcceptAllFilterChain returns a filter chain that accepts any paths/prefixes

func NewDrainFilterChain

func NewDrainFilterChain() Chain

NewDrainFilterChain creates a filter chain that rejects any paths/prefixes

func (Chain) Equal

func (c Chain) Equal(d Chain) bool

Equal compares twp filter chains

func (Chain) Process

func (c Chain) Process(p *net.Prefix, pa *route.Path) (modPath *route.Path, reject bool)

Process processes a filter chain

type CommunityFilter

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

func (*CommunityFilter) Matches

func (f *CommunityFilter) Matches(coms *types.Communities) bool

type ExactMatcher

type ExactMatcher struct{}

func NewExactMatcher

func NewExactMatcher() *ExactMatcher

func (*ExactMatcher) Match

func (e *ExactMatcher) Match(pattern, prefix *net.Prefix) bool

type Filter

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

func NewAcceptAllFilter

func NewAcceptAllFilter() *Filter

NewAcceptAllFilter returns a filter accepting any paths/prefixes

func NewDrainFilter

func NewDrainFilter() *Filter

NewDrainFilter returns a filter rejecting any paths/prefixes

func NewFilter

func NewFilter(name string, terms []*Term) *Filter

func (*Filter) Name

func (f *Filter) Name() string

Name returns the name of the filter

func (*Filter) Process

func (f *Filter) Process(p *net.Prefix, pa *route.Path) FilterResult

Process processes a filter

type FilterResult

type FilterResult struct {
	Path      *route.Path
	Terminate bool
	Reject    bool
}

type InRangeMatcher

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

func NewInRangeMatcher

func NewInRangeMatcher(min, max uint8) *InRangeMatcher

func (*InRangeMatcher) Match

func (i *InRangeMatcher) Match(pattern, prefix *net.Prefix) bool

type LargeCommunityFilter

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

LargeCommunityFilter represents a filter for large communities

func (*LargeCommunityFilter) Matches

func (f *LargeCommunityFilter) Matches(coms *types.LargeCommunities) bool

Matches checks if a community f.community is on the filter list

type LongerMatcher

type LongerMatcher struct{}

func NewLongerMatcher

func NewLongerMatcher() *LongerMatcher

func (*LongerMatcher) Match

func (e *LongerMatcher) Match(pattern, prefix *net.Prefix) bool

type OrLongerMatcher

type OrLongerMatcher struct{}

func NewOrLongerMatcher

func NewOrLongerMatcher() *OrLongerMatcher

func (*OrLongerMatcher) Match

func (e *OrLongerMatcher) Match(pattern, prefix *net.Prefix) bool

type PrefixList

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

func NewPrefixList

func NewPrefixList(pfxs ...*net.Prefix) *PrefixList

func NewPrefixListWithMatcher

func NewPrefixListWithMatcher(matcher PrefixMatcher, pfxs ...*net.Prefix) *PrefixList

func (*PrefixList) Matches

func (l *PrefixList) Matches(p *net.Prefix) bool

type PrefixMatcher

type PrefixMatcher interface {
	Match(pattern, prefix *net.Prefix) bool
	// contains filtered or unexported methods
}

type RouteFilter

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

func NewRouteFilter

func NewRouteFilter(pattern *net.Prefix, matcher PrefixMatcher) *RouteFilter

func (*RouteFilter) Matches

func (f *RouteFilter) Matches(prefix *net.Prefix) bool

type Term

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

Term matches a path against a list of conditions and performs actions if it matches

func NewTerm

func NewTerm(name string, from []*TermCondition, then []actions.Action) *Term

NewTerm creates a new term

func (*Term) Process

func (t *Term) Process(p *net.Prefix, pa *route.Path) TermResult

Process processes a path returning if the path should be rejected and returns a possible modified version of the path

type TermCondition

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

func NewTermCondition

func NewTermCondition(prefixLists []*PrefixList, routeFilters []*RouteFilter) *TermCondition

func NewTermConditionWithPrefixLists

func NewTermConditionWithPrefixLists(filters ...*PrefixList) *TermCondition

func NewTermConditionWithRouteFilters

func NewTermConditionWithRouteFilters(filters ...*RouteFilter) *TermCondition

func (*TermCondition) Matches

func (f *TermCondition) Matches(p *net.Prefix, pa *route.Path) bool

type TermResult

type TermResult struct {
	Path      *route.Path
	Terminate bool
	Reject    bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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