Documentation ¶
Index ¶
- func BatchLoadMatcher(m Matcher, f []string, processAttr ProcessAttrFunc) error
- func BatchLoadMixMatcherV2Matcher(m Matcher, f []string) error
- func LoadFromFile(m Matcher, file string, processAttr ProcessAttrFunc) error
- func LoadFromFileAsV2Matcher(m Matcher, file string) error
- func LoadFromText(m Matcher, s string, processAttr ProcessAttrFunc) error
- func LoadFromTextFile(m Matcher, file string, processAttr ProcessAttrFunc) error
- func LoadFromTextReader(m Matcher, r io.Reader, processAttr ProcessAttrFunc) error
- func LoadGeoSiteFromDAT(file, countryCode string) (*v2data.GeoSite, error)
- func LoadGeoSiteList(file string) (*v2data.GeoSiteList, error)
- type Appendable
- type DomainMatcher
- type DomainMatcherMode
- type KeywordMatcher
- type Matcher
- type MixMatcher
- func (m *MixMatcher) Add(pattern string, v interface{}) error
- func (m *MixMatcher) AddElem(typ MixMatcherPatternType, pattern string, v interface{}) error
- func (m *MixMatcher) Del(pattern string)
- func (m *MixMatcher) Len() int
- func (m *MixMatcher) LoadFromDAT(file, countryCode string, processAttr ProcessAttrFunc) error
- func (m *MixMatcher) Match(fqdn string) (v interface{}, ok bool)
- func (m *MixMatcher) SetPattenTypeMap(typMap map[string]MixMatcherPatternType)
- type MixMatcherPatternType
- type ProcessAttrFunc
- type RegexMatcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BatchLoadMatcher ¶ added in v1.2.0
func BatchLoadMatcher(m Matcher, f []string, processAttr ProcessAttrFunc) error
BatchLoadMatcher loads multiple files using LoadFromFile
func BatchLoadMixMatcherV2Matcher ¶ added in v0.22.0
BatchLoadMixMatcherV2Matcher loads multiple files using LoadFromFileAsV2Matcher
func LoadFromFile ¶ added in v1.2.0
func LoadFromFile(m Matcher, file string, processAttr ProcessAttrFunc) error
LoadFromFile loads data from the file. File can be a text file or a v2ray data file. Only MixMatcher can load v2ray data file. v2ray data file needs to specify the data category by using ':', e.g. 'geosite.dat:cn'
func LoadFromFileAsV2Matcher ¶ added in v1.2.0
LoadFromFileAsV2Matcher loads data from a file. v2ray data file can also have multiple @attr. e.g. 'geosite.dat:cn@attr1@attr2'. Only the record with all of the @attr will be loaded. Also see LoadFromFile.
func LoadFromText ¶ added in v1.2.0
func LoadFromText(m Matcher, s string, processAttr ProcessAttrFunc) error
func LoadFromTextFile ¶ added in v1.2.0
func LoadFromTextFile(m Matcher, file string, processAttr ProcessAttrFunc) error
func LoadFromTextReader ¶ added in v1.2.0
func LoadFromTextReader(m Matcher, r io.Reader, processAttr ProcessAttrFunc) error
func LoadGeoSiteFromDAT ¶ added in v0.24.0
func LoadGeoSiteList ¶ added in v0.24.0
func LoadGeoSiteList(file string) (*v2data.GeoSiteList, error)
Types ¶
type Appendable ¶ added in v1.1.1
type Appendable interface {
Append(v interface{})
}
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 DomainMatcherMode) *DomainMatcher
func (*DomainMatcher) Add ¶ added in v0.18.0
func (m *DomainMatcher) Add(domain string, v interface{}) error
func (*DomainMatcher) Del ¶ added in v1.2.0
func (m *DomainMatcher) Del(domain string)
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 DomainMatcherMode ¶ added in v1.2.0
type DomainMatcherMode uint8
const ( DomainMatcherModeDomain DomainMatcherMode = iota DomainMatcherModeFull )
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{}) error
func (*KeywordMatcher) Del ¶ added in v1.2.0
func (m *KeywordMatcher) Del(keyword string)
func (*KeywordMatcher) Len ¶ added in v1.1.1
func (m *KeywordMatcher) Len() int
func (*KeywordMatcher) Match ¶ added in v0.19.1
func (m *KeywordMatcher) 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) Add ¶ added in v1.2.0
func (m *MixMatcher) Add(pattern string, v interface{}) error
func (*MixMatcher) AddElem ¶ added in v0.19.1
func (m *MixMatcher) AddElem(typ MixMatcherPatternType, pattern string, v interface{}) error
func (*MixMatcher) Del ¶ added in v1.2.0
func (m *MixMatcher) Del(pattern string)
func (*MixMatcher) Len ¶ added in v1.1.1
func (m *MixMatcher) Len() int
func (*MixMatcher) LoadFromDAT ¶ added in v1.2.0
func (m *MixMatcher) LoadFromDAT(file, countryCode string, processAttr ProcessAttrFunc) error
func (*MixMatcher) Match ¶ added in v0.19.1
func (m *MixMatcher) Match(fqdn string) (v interface{}, ok bool)
func (*MixMatcher) SetPattenTypeMap ¶ added in v1.2.0
func (m *MixMatcher) SetPattenTypeMap(typMap map[string]MixMatcherPatternType)
type MixMatcherPatternType ¶ added in v1.2.0
type MixMatcherPatternType uint8
const ( MixMatcherPatternTypeDomain MixMatcherPatternType = iota MixMatcherPatternTypeFull MixMatcherPatternTypeKeyword MixMatcherPatternTypeRegexp )
type ProcessAttrFunc ¶ added in v1.2.0
ProcessAttrFunc processes the additional attributions. 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) Del ¶ added in v1.2.0
func (m *RegexMatcher) Del(expr string)
func (*RegexMatcher) Len ¶ added in v1.1.1
func (m *RegexMatcher) Len() int
func (*RegexMatcher) Match ¶ added in v0.19.1
func (m *RegexMatcher) Match(fqdn string) (v interface{}, ok bool)