1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-02-15 12:45:45 -05:00

extract full matcher group

This commit is contained in:
Darien Raymond
2018-08-20 09:57:06 +02:00
parent 899b1399ee
commit 44c759eeab
5 changed files with 91 additions and 9 deletions

View File

@@ -0,0 +1,25 @@
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]
}