Simplify http attrabute matching
In the past, we use Starlark script, it is over engineered and barely used. By switching to simple key value string contains logic we can reduce core size about 0.7MB
This commit is contained in:
1 parent
d11d72be6c
commit
bf4b1fab3c
8 files changed
+103
-157
No files matched your search
@@ -1,6 +1,8 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/xtls/xray-core/common/net"
|
||||
"github.com/xtls/xray-core/features/outbound"
|
||||
"github.com/xtls/xray-core/features/routing"
|
||||
@@ -143,11 +145,11 @@ func (rr *RoutingRule) BuildCondition() (Condition, error) {
|
||||
}
|
||||
|
||||
if len(rr.Attributes) > 0 {
|
||||
cond, err := NewAttributeMatcher(rr.Attributes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
configuredKeys := make(map[string]string)
|
||||
for key, value := range rr.Attributes {
|
||||
configuredKeys[strings.ToLower(key)] = strings.ToLower(value)
|
||||
}
|
||||
conds.Add(cond)
|
||||
conds.Add(&AttributeMatcher{configuredKeys})
|
||||
}
|
||||
|
||||
if conds.Len() == 0 {
|
||||
|
||||
Reference in new issue
Block a user