fix: routing problems

This commit is contained in:
mzz2017
2023-01-29 11:19:58 +08:00
parent c8d11cbecf
commit e4996ace25
12 changed files with 174 additions and 103 deletions

View File

@ -7,6 +7,7 @@ package routing
import (
"fmt"
"github.com/sirupsen/logrus"
"github.com/v2rayA/dae/common"
"github.com/v2rayA/dae/common/consts"
"github.com/v2rayA/dae/pkg/config_parser"
@ -60,6 +61,8 @@ func ParsePrefixes(values []string) (cidrs []netip.Prefix, err error) {
func ApplyMatcherBuilder(builder MatcherBuilder, rules []*config_parser.RoutingRule, finalOutbound string) (err error) {
for _, rule := range rules {
logrus.Debugln("[rule]", rule.String(true))
// rule is like: domain(domain:baidu.com) && port(443) -> proxy
for iFunc, f := range rule.AndFunctions {
// f is like: domain(domain:baidu.com)
@ -75,6 +78,15 @@ func ApplyMatcherBuilder(builder MatcherBuilder, rules []*config_parser.RoutingR
}
}
{
// Debug
symNot := ""
if f.Not {
symNot = "!"
}
logrus.Debugf("\t%v%v(%v) -> %v", symNot, f.Name, key, outbound)
}
builder.AddAnyBefore(f, key, paramValueGroup, outbound)
switch f.Name {
case consts.Function_Domain: