full_matcher.go 494 B

12345678910111213141516171819202122232425
  1. package strmatcher
  2. type FullMatcherGroup struct {
  3. matchers map[string][]uint32
  4. }
  5. func (g *FullMatcherGroup) Add(domain string, value uint32) {
  6. if g.matchers == nil {
  7. g.matchers = make(map[string][]uint32)
  8. }
  9. g.matchers[domain] = append(g.matchers[domain], value)
  10. }
  11. func (g *FullMatcherGroup) addMatcher(m fullMatcher, value uint32) {
  12. g.Add(string(m), value)
  13. }
  14. func (g *FullMatcherGroup) Match(str string) []uint32 {
  15. if g.matchers == nil {
  16. return nil
  17. }
  18. return g.matchers[str]
  19. }