Documentation
¶
Index ¶
- Constants
- Variables
- func Load[T any](m WriteableMatcher[T], s string, parseString ParseStringFunc[T]) error
- func LoadFromTextReader[T any](m WriteableMatcher[T], r io.Reader, parseString ParseStringFunc[T]) error
- func NormalizeDomain(s string) string
- func TrimDot(s string) string
- type FullMatcher
- type KeywordMatcher
- type Matcher
- type MixMatcher
- type ParseStringFunc
- type RegexMatcher
- type ReverseDomainScanner
- type SubDomainMatcher
- type WriteableMatcher
Constants ¶
View Source
const ( MatcherFull = "full" MatcherDomain = "domain" MatcherRegexp = "regexp" MatcherKeyword = "keyword" )
Variables ¶
View Source
var ErrNodefaultMatcher = errors.New("default matcher is not set")
Functions ¶
func Load ¶
func Load[T any](m WriteableMatcher[T], s string, parseString ParseStringFunc[T]) error
Load loads data from a string, parsing it with parseString function.
func LoadFromTextReader ¶
func LoadFromTextReader[T any](m WriteableMatcher[T], r io.Reader, parseString ParseStringFunc[T]) error
LoadFromTextReader loads multiple lines from reader r. r
func NormalizeDomain ¶
NormalizeDomain normalize domain string s. It removes the suffix "." and make sure the domain is in lower case. e.g. a fqdn "GOOGLE.com." will become "google.com"
Types ¶
type FullMatcher ¶
type FullMatcher[T any] struct { // contains filtered or unexported fields }
func NewFullMatcher ¶
func NewFullMatcher[T any]() *FullMatcher[T]
func (*FullMatcher[T]) Add ¶
func (m *FullMatcher[T]) Add(s string, v T) error
Add adds domain s to this matcher, s can be a fqdn or not.
func (*FullMatcher[T]) Len ¶
func (m *FullMatcher[T]) Len() int
func (*FullMatcher[T]) Match ¶
func (m *FullMatcher[T]) Match(s string) (v T, ok bool)
type KeywordMatcher ¶
type KeywordMatcher[T any] struct { // contains filtered or unexported fields }
func NewKeywordMatcher ¶
func NewKeywordMatcher[T any]() *KeywordMatcher[T]
func (*KeywordMatcher[T]) Add ¶
func (m *KeywordMatcher[T]) Add(keyword string, v T) error
func (*KeywordMatcher[T]) Len ¶
func (m *KeywordMatcher[T]) Len() int
func (*KeywordMatcher[T]) Match ¶
func (m *KeywordMatcher[T]) Match(s string) (v T, ok bool)
type MixMatcher ¶
type MixMatcher[T any] struct { // contains filtered or unexported fields }
func NewDomainMixMatcher ¶
func NewDomainMixMatcher() *MixMatcher[struct{}]
func NewMixMatcher ¶
func NewMixMatcher[T any]() *MixMatcher[T]
func (*MixMatcher[T]) Add ¶
func (m *MixMatcher[T]) Add(s string, v T) error
func (*MixMatcher[T]) GetSubMatcher ¶
func (m *MixMatcher[T]) GetSubMatcher(typ string) WriteableMatcher[T]
func (*MixMatcher[T]) Len ¶
func (m *MixMatcher[T]) Len() int
func (*MixMatcher[T]) Match ¶
func (m *MixMatcher[T]) Match(s string) (v T, ok bool)
func (*MixMatcher[T]) SetDefaultMatcher ¶
func (m *MixMatcher[T]) SetDefaultMatcher(s string)
type ParseStringFunc ¶
ParseStringFunc parse data string to matcher pattern and additional attributions.
type RegexMatcher ¶
type RegexMatcher[T any] struct { // contains filtered or unexported fields }
RegexMatcher contains regexp rules. Note: the regexp rule is expect to match a lower-case non fqdn.
func NewRegexMatcher ¶
func NewRegexMatcher[T any]() *RegexMatcher[T]
func (*RegexMatcher[T]) Add ¶
func (m *RegexMatcher[T]) Add(expr string, v T) error
func (*RegexMatcher[T]) Len ¶
func (m *RegexMatcher[T]) Len() int
func (*RegexMatcher[T]) Match ¶
func (m *RegexMatcher[T]) Match(s string) (v T, ok bool)
type ReverseDomainScanner ¶
type ReverseDomainScanner struct {
// contains filtered or unexported fields
}
func NewReverseDomainScanner ¶
func NewReverseDomainScanner(s string) *ReverseDomainScanner
func (*ReverseDomainScanner) NextLabel ¶
func (s *ReverseDomainScanner) NextLabel() (label string)
func (*ReverseDomainScanner) NextLabelOffset ¶
func (s *ReverseDomainScanner) NextLabelOffset() int
func (*ReverseDomainScanner) Scan ¶
func (s *ReverseDomainScanner) Scan() bool
type SubDomainMatcher ¶
type SubDomainMatcher[T any] struct { // contains filtered or unexported fields }
func NewSubDomainMatcher ¶
func NewSubDomainMatcher[T any]() *SubDomainMatcher[T]
func (*SubDomainMatcher[T]) Add ¶
func (m *SubDomainMatcher[T]) Add(s string, v T) error
func (*SubDomainMatcher[T]) Len ¶
func (m *SubDomainMatcher[T]) Len() int
func (*SubDomainMatcher[T]) Match ¶
func (m *SubDomainMatcher[T]) Match(s string) (T, bool)
Click to show internal directories.
Click to hide internal directories.