1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-29 10:45:22 +00:00
v2fly/common/strmatcher/full_matcher.go

26 lines
494 B
Go
Raw Normal View History

2018-08-20 07:57:06 +00:00
package strmatcher
type FullMatcherGroup struct {
matchers map[string][]uint32
2018-08-20 07:57:06 +00:00
}
func (g *FullMatcherGroup) Add(domain string, value uint32) {
if g.matchers == nil {
g.matchers = make(map[string][]uint32)
2018-08-20 07:57:06 +00:00
}
g.matchers[domain] = append(g.matchers[domain], value)
2018-08-20 07:57:06 +00:00
}
func (g *FullMatcherGroup) addMatcher(m fullMatcher, value uint32) {
g.Add(string(m), value)
}
func (g *FullMatcherGroup) Match(str string) []uint32 {
2018-08-20 07:57:06 +00:00
if g.matchers == nil {
return nil
2018-08-20 07:57:06 +00:00
}
return g.matchers[str]
}