domain

package
v0.22.1 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2020 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DomainMatcher added in v0.18.0

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

func NewDomainMatcher added in v0.19.1

func NewDomainMatcher(mode MatchMode) *DomainMatcher

func (*DomainMatcher) Add added in v0.18.0

func (m *DomainMatcher) Add(domain string, v interface{})

func (*DomainMatcher) Len added in v0.18.0

func (m *DomainMatcher) Len() int

func (*DomainMatcher) Match added in v0.18.0

func (m *DomainMatcher) Match(fqdn string) (v interface{}, ok bool)

type FilterRecordFunc added in v0.22.0

type FilterRecordFunc func([]string) (accept bool, err error)

FilterRecordFunc determines whether a record is acceptable. The given []string could have a 0 length or is nil.

type KeywordMatcher added in v0.19.1

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

func NewKeywordMatcher added in v0.19.1

func NewKeywordMatcher() *KeywordMatcher

func (*KeywordMatcher) Add added in v0.19.1

func (m *KeywordMatcher) Add(keyword string, v interface{})

func (*KeywordMatcher) Match added in v0.19.1

func (m *KeywordMatcher) Match(fqdn string) (v interface{}, ok bool)

type MatchMode added in v0.19.1

type MatchMode uint8
const (
	MatchModeDomain MatchMode = iota
	MatchModeFull
)

type Matcher

type Matcher interface {
	Match(fqdn string) (v interface{}, ok bool)
}

func BatchLoadMixMatcher added in v0.22.0

func BatchLoadMixMatcher(f []string, filterRecord FilterRecordFunc, parseValue ParseValueFunc) (Matcher, error)

BatchLoadMixMatcher loads multiple files using MixMatcher.LoadFormFile

func BatchLoadMixMatcherV2Matcher added in v0.22.0

func BatchLoadMixMatcherV2Matcher(f []string) (Matcher, error)

BatchLoadMixMatcherV2Matcher loads multiple files using MixMatcher.LoadFormFileAsV2Matcher

func NewV2MatcherFromFile

func NewV2MatcherFromFile(file, countryCode string) (Matcher, error)

type MatcherGroup

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

func NewMatcherGroup

func NewMatcherGroup(m []Matcher) *MatcherGroup

func (*MatcherGroup) Match

func (mg *MatcherGroup) Match(fqdn string) (v interface{}, ok bool)

type MixMatcher added in v0.19.1

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

func NewMixMatcher added in v0.19.1

func NewMixMatcher() *MixMatcher

func (*MixMatcher) AddElem added in v0.19.1

func (m *MixMatcher) AddElem(typ router.Domain_Type, s string, v interface{}) error

func (*MixMatcher) LoadFormDAT added in v0.21.0

func (m *MixMatcher) LoadFormDAT(file, countryCode string, filterRecord FilterRecordFunc, parseValue ParseValueFunc) error

func (*MixMatcher) LoadFormFile added in v0.21.0

func (m *MixMatcher) LoadFormFile(file string, filterRecord FilterRecordFunc, parseValue ParseValueFunc) error

LoadFormFile loads data from file.

func (*MixMatcher) LoadFormFileAsV2Matcher added in v0.22.0

func (m *MixMatcher) LoadFormFileAsV2Matcher(file string) error

LoadFormFileAsV2Matcher loads data from file. File can be a text file or a v2ray data file. v2ray data file needs to specify the data category by using ':', e.g. 'geosite:cn' v2ray data file can also have multiple @attr. e.g. 'geosite:cn@attr1@attr2'. Only the domain with all of the @attr will be used.

func (*MixMatcher) LoadFormText added in v0.21.0

func (m *MixMatcher) LoadFormText(s string, filterRecord FilterRecordFunc, parseValue ParseValueFunc) error

func (*MixMatcher) LoadFormTextFile added in v0.21.0

func (m *MixMatcher) LoadFormTextFile(file string, filterRecord FilterRecordFunc, parseValue ParseValueFunc) error

func (*MixMatcher) LoadFormTextReader added in v0.21.0

func (m *MixMatcher) LoadFormTextReader(r io.Reader, filterRecord FilterRecordFunc, parseValue ParseValueFunc) error

func (*MixMatcher) Match added in v0.19.1

func (m *MixMatcher) Match(fqdn string) (v interface{}, ok bool)

type ParseValueFunc added in v0.21.0

type ParseValueFunc func([]string) (interface{}, error)

ParseValueFunc parses additional `attr` to an interface. The given []string could have a 0 length or is nil.

type RegexMatcher added in v0.19.1

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

func NewRegexMatcher added in v0.19.1

func NewRegexMatcher() *RegexMatcher

func (*RegexMatcher) Add added in v0.19.1

func (m *RegexMatcher) Add(expr string, v interface{}) error

func (*RegexMatcher) Match added in v0.19.1

func (m *RegexMatcher) Match(fqdn string) (v interface{}, ok bool)

type V2Matcher

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

func NewV2Matcher

func NewV2Matcher(domains []*router.Domain) (*V2Matcher, error)

func (*V2Matcher) Match

func (m *V2Matcher) Match(fqdn string) (v interface{}, ok bool)

Jump to

Keyboard shortcuts

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