Skip to content

Commit

Permalink
Fix rules
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai committed Jun 6, 2024
1 parent 3d81f1a commit 3d4147f
Showing 1 changed file with 22 additions and 28 deletions.
50 changes: 22 additions & 28 deletions template/render_route.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,34 +44,6 @@ func (t *Template) renderRoute(metadata M.Metadata, options *option.Options) err
},
},
}
if !t.DisableTrafficBypass && !t.DisableDefaultRules {
blockTag := t.BlockTag
if blockTag == "" {
blockTag = DefaultBlockTag
}
options.Route.Rules = append(options.Route.Rules, option.Rule{
Type: C.RuleTypeLogical,
LogicalOptions: option.LogicalRule{
Mode: C.LogicalTypeOr,
Rules: []option.Rule{
{
Type: C.RuleTypeDefault,
DefaultOptions: option.DefaultRule{
Network: []string{N.NetworkUDP},
Port: []uint16{443},
},
},
{
Type: C.RuleTypeDefault,
DefaultOptions: option.DefaultRule{
Protocol: []string{C.ProtocolSTUN},
},
},
},
Outbound: blockTag,
},
})
}
directTag := t.DirectTag
defaultTag := t.DefaultTag
if directTag == "" {
Expand Down Expand Up @@ -145,5 +117,27 @@ func (t *Template) renderRoute(metadata M.Metadata, options *option.Options) err
} else {
options.Route.Rules = append(options.Route.Rules, t.CustomRules...)
}
if !t.DisableTrafficBypass && !t.DisableDefaultRules {
blockTag := t.BlockTag
if blockTag == "" {
blockTag = DefaultBlockTag
}
options.Route.Rules = append(options.Route.Rules, option.Rule{
Type: C.RuleTypeLogical,
LogicalOptions: option.LogicalRule{
Mode: C.LogicalTypeOr,
Rules: []option.Rule{
{
Type: C.RuleTypeDefault,
DefaultOptions: option.DefaultRule{
Network: []string{N.NetworkUDP},
Port: []uint16{443},
},
},
},
Outbound: blockTag,
},
})
}
return nil
}

0 comments on commit 3d4147f

Please sign in to comment.