mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-07-03 02:08:45 +00:00
Geodata: Reduce memory usage again (#5975)
https://github.com/XTLS/Xray-core/pull/5975#issuecomment-4274779560
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package strmatcher
|
||||
|
||||
// SimpleMatcherSet is an implementation of MatcherSet.
|
||||
// It simply stores all matchers in an array and sequentially matches them.
|
||||
type SimpleMatcherSet struct {
|
||||
matchers []Matcher
|
||||
}
|
||||
|
||||
// AddMatcher implements MatcherSetForAll.AddMatcher.
|
||||
func (s *SimpleMatcherSet) AddMatcher(matcher Matcher) {
|
||||
s.matchers = append(s.matchers, matcher)
|
||||
}
|
||||
|
||||
// MatchAny implements MatcherSet.MatchAny.
|
||||
func (s *SimpleMatcherSet) MatchAny(input string) bool {
|
||||
for _, m := range s.matchers {
|
||||
if m.Match(input) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user