prefixfilter

package
v1.117.1-cluster Latest Latest
Warning

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

Go to latest
Published: May 15, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendReplace

func AppendReplace(dst []byte, srcFilter, dstFilter, s string) []byte

AppendReplace replaces srcFilter prefix with dstFilter prefix at s, appends the result to dst and returns it.

func IsWildcardFilter

func IsWildcardFilter(filter string) bool

IsWildcardFilter returns true if the filter ends with '*', e.g. it matches any string containing the prefix in front of '*'.

func MatchFilter

func MatchFilter(filter, s string) bool

MatchFilter returns true if s matches filter.

func MatchFilters

func MatchFilters(filters []string, s string) bool

MatchFilters returns true if s matches any filter from filters.

func PutFilter

func PutFilter(f *Filter)

PutFilter returns f to the pool.

f cannot be used after PutFilter call.

Types

type Filter

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

Filter allow filtering by full strings and by prefixes ending with '*'.

func GetFilter

func GetFilter() *Filter

GetFilter returns Filter from the pool.

Return the filter to the pool via PutFilter when it is no longer needed.

func (*Filter) AddAllowFilter

func (f *Filter) AddAllowFilter(filter string)

AddAllowFilter adds the given filter to allowlist at f.

The filter may end with '*'. In this case it matches all the strings starting with the prefix before '*'.

func (*Filter) AddAllowFilters

func (f *Filter) AddAllowFilters(filters []string)

AddAllowFilters adds the given filters to allowlist at f.

Every filter may end with '*'. In this case it matches all the strings starting with the prefix before '*'.

func (*Filter) AddDenyFilter

func (f *Filter) AddDenyFilter(filter string)

AddDenyFilter adds the the given filter to denylist at f.

Every filter may end with '*'. In this case it stops matching all the strings starting with the prefix before '*'.

func (*Filter) AddDenyFilters

func (f *Filter) AddDenyFilters(filters []string)

AddDenyFilters adds the given filters to denylist at f.

Every filter may end with '*'. In this case it stops matching all the strings starting with the prefix before '*'.

func (*Filter) MatchString

func (f *Filter) MatchString(s string) bool

MatchString returns true if s matches f.

func (*Filter) Reset

func (f *Filter) Reset()

Reset resets f to the initial zero state.

Jump to

Keyboard shortcuts

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