forked from mirror/serenity
Fix rules
This commit is contained in:
parent
3d81f1ad61
commit
3d4147f776
@ -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 == "" {
|
||||
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user