Documentation
¶
Index ¶
- func AppendReplace(dst []byte, srcFilter, dstFilter, s string) []byte
- func IsWildcardFilter(filter string) bool
- func MatchAll(filters []string) bool
- func MatchFilter(filter, s string) bool
- func MatchFilters(filters []string, s string) bool
- type Filter
- func (f *Filter) AddAllowFilter(filter string)
- func (f *Filter) AddAllowFilters(filters []string)
- func (f *Filter) AddDenyFilter(filter string)
- func (f *Filter) AddDenyFilters(filters []string)
- func (f *Filter) Clone() *Filter
- func (f *Filter) GetAllowFilters() []string
- func (f *Filter) GetAllowStrings() ([]string, bool)
- func (f *Filter) GetDenyFilters() []string
- func (f *Filter) MatchAll() bool
- func (f *Filter) MatchNothing() bool
- func (f *Filter) MatchString(s string) bool
- func (f *Filter) MatchStringOrWildcard(s string) bool
- func (f *Filter) Reset()
- func (f *Filter) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendReplace ¶
AppendReplace replaces srcFilter prefix with dstFilter prefix at s, appends the result to dst and returns it.
func IsWildcardFilter ¶
IsWildcardFilter returns true if the filter ends with '*', e.g. it matches any string containing the prefix in front of '*'.
func MatchFilter ¶
MatchFilter returns true if s matches filter.
func MatchFilters ¶
MatchFilters returns true if s matches any filter from filters.
Types ¶
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter allow filtering by full strings and by prefixes ending with '*'.
func (*Filter) AddAllowFilter ¶
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 ¶
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 ¶
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 ¶
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) GetAllowFilters ¶
GetAllowFilters returns allow filters from f.
func (*Filter) GetAllowStrings ¶
GetAllowStrings returns the list of allow strings if there are no wildcard filters in the allow list
It returns false if there are wildcard filters
func (*Filter) GetDenyFilters ¶
GetDenyFilters returns deny filters from f.
func (*Filter) MatchNothing ¶
MatchNothing returns true if f doesn't match anything.
func (*Filter) MatchString ¶
MatchString returns true if s matches f.
func (*Filter) MatchStringOrWildcard ¶
MatchStringOrWildcard returns true if s matches f.
s may be either a regular string or a wildcard ending with '*'. If s is a wildcard, then true is returned if at least a single string matching this wildcard matches f.