mirror of https://github.com/v2ray/v2ray-core
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
458 B
26 lines
458 B
6 years ago
|
package strmatcher
|
||
|
|
||
|
type FullMatcherGroup struct {
|
||
|
matchers map[string]uint32
|
||
|
}
|
||
|
|
||
|
func (g *FullMatcherGroup) Add(domain string, value uint32) {
|
||
|
if g.matchers == nil {
|
||
|
g.matchers = make(map[string]uint32)
|
||
|
}
|
||
|
|
||
|
g.matchers[domain] = value
|
||
|
}
|
||
|
|
||
|
func (g *FullMatcherGroup) addMatcher(m fullMatcher, value uint32) {
|
||
|
g.Add(string(m), value)
|
||
|
}
|
||
|
|
||
|
func (g *FullMatcherGroup) Match(str string) uint32 {
|
||
|
if g.matchers == nil {
|
||
|
return 0
|
||
|
}
|
||
|
|
||
|
return g.matchers[str]
|
||
|
}
|