github.com/xtls/xray-core@v1.8.12-0.20240518155711-3168d27b0bdb/common/strmatcher/full_matcher.go (about)

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