Documentation
¶
Index ¶
- func BatchLoadMatcher(m Matcher, f []string, processAttr ProcessAttrFunc) error
- func Load(m Matcher, entry string, processAttr ProcessAttrFunc) error
- func LoadFromFile(m Matcher, file string, processAttr ProcessAttrFunc) 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 ¶
func BatchLoadMatcher(m Matcher, f []string, processAttr ProcessAttrFunc) error
BatchLoadMatcher loads multiple files using Load.
func Load ¶
func Load(m Matcher, entry string, processAttr ProcessAttrFunc) error
Load loads data from a entry. If entry begin with "ext:", Load loads the file by using LoadFromFile. Else it loads the entry as a text pattern by using LoadFromText.
func LoadFromFile ¶
func LoadFromFile(m Matcher, file string, processAttr ProcessAttrFunc) error
LoadFromFile 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.
func LoadFromText ¶
func LoadFromText(m Matcher, s string, processAttr ProcessAttrFunc) error
func LoadFromTextFile ¶
func LoadFromTextFile(m Matcher, file string, processAttr ProcessAttrFunc) error
func LoadFromTextReader ¶
func LoadFromTextReader(m Matcher, r io.Reader, processAttr ProcessAttrFunc) error
func LoadGeoSiteFromDAT ¶
func LoadGeoSiteList ¶
func LoadGeoSiteList(file string) (*v2data.GeoSiteList, error)
Types ¶
type Appendable ¶
type Appendable interface {
Append(v interface{})
}
type DomainMatcher ¶
type DomainMatcher struct {
// contains filtered or unexported fields
}
func NewDomainMatcher ¶
func NewDomainMatcher(mode DomainMatcherMode) *DomainMatcher
func (*DomainMatcher) Add ¶
func (m *DomainMatcher) Add(domain string, v interface{}) error
func (*DomainMatcher) Del ¶
func (m *DomainMatcher) Del(domain string)
func (*DomainMatcher) Len ¶
func (m *DomainMatcher) Len() int
func (*DomainMatcher) Match ¶
func (m *DomainMatcher) Match(fqdn string) (v interface{}, ok bool)
type DomainMatcherMode ¶
type DomainMatcherMode uint8
const ( DomainMatcherModeDomain DomainMatcherMode = iota DomainMatcherModeFull )
type KeywordMatcher ¶
type KeywordMatcher struct {
// contains filtered or unexported fields
}
func NewKeywordMatcher ¶
func NewKeywordMatcher() *KeywordMatcher
func (*KeywordMatcher) Add ¶
func (m *KeywordMatcher) Add(keyword string, v interface{}) error
func (*KeywordMatcher) Del ¶
func (m *KeywordMatcher) Del(keyword string)
func (*KeywordMatcher) Len ¶
func (m *KeywordMatcher) Len() int
func (*KeywordMatcher) Match ¶
func (m *KeywordMatcher) Match(fqdn string) (v interface{}, ok bool)
type MixMatcher ¶
type MixMatcher struct {
// contains filtered or unexported fields
}
func NewMixMatcher ¶
func NewMixMatcher() *MixMatcher
func (*MixMatcher) Add ¶
func (m *MixMatcher) Add(pattern string, v interface{}) error
func (*MixMatcher) AddElem ¶
func (m *MixMatcher) AddElem(typ MixMatcherPatternType, pattern string, v interface{}) error
func (*MixMatcher) Del ¶
func (m *MixMatcher) Del(pattern string)
func (*MixMatcher) Len ¶
func (m *MixMatcher) Len() int
func (*MixMatcher) LoadFromDAT ¶
func (m *MixMatcher) LoadFromDAT(file, countryCode string, processAttr ProcessAttrFunc) error
func (*MixMatcher) Match ¶
func (m *MixMatcher) Match(fqdn string) (v interface{}, ok bool)
func (*MixMatcher) SetPattenTypeMap ¶
func (m *MixMatcher) SetPattenTypeMap(typMap map[string]MixMatcherPatternType)
type MixMatcherPatternType ¶
type MixMatcherPatternType uint8
const ( MixMatcherPatternTypeDomain MixMatcherPatternType = iota MixMatcherPatternTypeFull MixMatcherPatternTypeKeyword MixMatcherPatternTypeRegexp )
type ProcessAttrFunc ¶
ProcessAttrFunc processes the additional attributions. The given []string could have a 0 length or is nil.
type RegexMatcher ¶
type RegexMatcher struct {
// contains filtered or unexported fields
}
func NewRegexMatcher ¶
func NewRegexMatcher() *RegexMatcher
func (*RegexMatcher) Add ¶
func (m *RegexMatcher) Add(expr string, v interface{}) error
func (*RegexMatcher) Del ¶
func (m *RegexMatcher) Del(expr string)
func (*RegexMatcher) Len ¶
func (m *RegexMatcher) Len() int
func (*RegexMatcher) Match ¶
func (m *RegexMatcher) Match(fqdn string) (v interface{}, ok bool)
Click to show internal directories.
Click to hide internal directories.