Fix cn route

This commit is contained in:
世界 2024-11-29 10:38:26 +08:00
parent bfac628bbe
commit c5eab36093
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
2 changed files with 36 additions and 4 deletions

View File

@ -171,7 +171,6 @@ func (t *Template) renderDNS(metadata M.Metadata, options *option.Options) error
options.DNS.Rules = append(options.DNS.Rules, t.PreDNSRules...)
if len(t.CustomDNSRules) == 0 {
if !t.DisableTrafficBypass {
options.DNS.Rules = append(options.DNS.Rules, option.DNSRule{
Type: C.RuleTypeDefault,
DefaultOptions: option.DefaultDNSRule{
@ -210,7 +209,7 @@ func (t *Template) renderDNS(metadata M.Metadata, options *option.Options) error
Type: C.RuleTypeDefault,
DefaultOptions: option.DefaultDNSRule{
RawDefaultDNSRule: option.RawDefaultDNSRule{
RuleSet: []string{"geosite-geolocation-!cn"},
RuleSet: []string{"geoip-cn"},
},
},
},
@ -218,7 +217,8 @@ func (t *Template) renderDNS(metadata M.Metadata, options *option.Options) error
Type: C.RuleTypeDefault,
DefaultOptions: option.DefaultDNSRule{
RawDefaultDNSRule: option.RawDefaultDNSRule{
RuleSet: []string{"geoip-cn"},
RuleSet: []string{"geosite-geolocation-!cn"},
Invert: true,
},
},
},

View File

@ -172,7 +172,39 @@ func (t *Template) renderRoute(metadata M.Metadata, options *option.Options) err
Type: C.RuleTypeDefault,
DefaultOptions: option.DefaultRule{
RawDefaultRule: option.RawDefaultRule{
RuleSet: []string{"geoip-cn", "geosite-geolocation-cn"},
RuleSet: []string{"geosite-geolocation-cn"},
},
RuleAction: option.RuleAction{
Action: C.RuleActionTypeRoute,
RouteOptions: option.RouteActionOptions{
Outbound: directTag,
},
},
},
}, option.Rule{
Type: C.RuleTypeLogical,
LogicalOptions: option.LogicalRule{
RawLogicalRule: option.RawLogicalRule{
Mode: C.LogicalTypeAnd,
Rules: []option.Rule{
{
Type: C.RuleTypeDefault,
DefaultOptions: option.DefaultRule{
RawDefaultRule: option.RawDefaultRule{
RuleSet: []string{"geoip-cn"},
},
},
},
{
Type: C.RuleTypeDefault,
DefaultOptions: option.DefaultRule{
RawDefaultRule: option.RawDefaultRule{
RuleSet: []string{"geosite-geolocation-!cn"},
Invert: true,
},
},
},
},
},
RuleAction: option.RuleAction{
Action: C.RuleActionTypeRoute,