perf(router): adjust the order of rules to optimize performance (#5267)

This commit is contained in:
Meow
2025-11-21 13:30:16 +08:00
committed by GitHub
parent fcfb0a302a
commit 2185a730d2
2 changed files with 28 additions and 42 deletions
-14
View File
@@ -47,20 +47,6 @@ var matcherTypeMap = map[Domain_Type]strmatcher.Type{
Domain_Full: strmatcher.Full,
}
func domainToMatcher(domain *Domain) (strmatcher.Matcher, error) {
matcherType, f := matcherTypeMap[domain.Type]
if !f {
return nil, errors.New("unsupported domain type", domain.Type)
}
matcher, err := matcherType.New(domain.Value)
if err != nil {
return nil, errors.New("failed to create domain matcher").Base(err)
}
return matcher, nil
}
type DomainMatcher struct {
matchers strmatcher.IndexMatcher
}