mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-05-08 14:13:22 +00:00
23 lines
555 B
Go
23 lines
555 B
Go
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
|
|
}
|