Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai committed Nov 18, 2024
1 parent 0b83576 commit 7b7fa37
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions template/render_outbounds.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,6 @@ func (t *Template) renderOutbounds(metadata M.Metadata, options *boxOption.Optio
}
return true
})
if len(subscriptionTags) == 0 {
continue
}
var tagPerSubscription string
if len(outboundTags) == 0 && len(subscriptions) == 1 {
tagPerSubscription = extraGroup.Tag
Expand All @@ -186,11 +183,17 @@ func (t *Template) renderOutbounds(metadata M.Metadata, options *boxOption.Optio
case C.TypeSelector:
selectorOptions := common.PtrValueOrDefault(extraGroup.CustomSelector)
groupOutboundPerSubscription.Options = &selectorOptions
selectorOptions.Outbounds = append(selectorOptions.Outbounds, subscriptionTags...)
selectorOptions.Outbounds = common.Uniq(append(selectorOptions.Outbounds, subscriptionTags...))
if len(selectorOptions.Outbounds) == 0 {
continue
}
case C.TypeURLTest:
urltestOptions := common.PtrValueOrDefault(extraGroup.CustomURLTest)
groupOutboundPerSubscription.Options = &urltestOptions
urltestOptions.Outbounds = append(urltestOptions.Outbounds, subscriptionTags...)
urltestOptions.Outbounds = common.Uniq(append(urltestOptions.Outbounds, subscriptionTags...))
if len(urltestOptions.Outbounds) == 0 {
continue
}
}
subscriptionGroups[it.Name] = append(subscriptionGroups[it.Name], groupOutboundPerSubscription)
}
Expand Down Expand Up @@ -225,10 +228,6 @@ func (t *Template) renderOutbounds(metadata M.Metadata, options *boxOption.Optio
return true
})...)
}
extraTags = common.Uniq(extraTags)
if len(extraTags) == 0 {
continue
}
groupOutbound := boxOption.Outbound{
Tag: extraGroup.Tag,
Type: extraGroup.Type,
Expand All @@ -237,11 +236,17 @@ func (t *Template) renderOutbounds(metadata M.Metadata, options *boxOption.Optio
case C.TypeSelector:
selectorOptions := common.PtrValueOrDefault(extraGroup.CustomSelector)
groupOutbound.Options = &selectorOptions
selectorOptions.Outbounds = append(selectorOptions.Outbounds, extraTags...)
selectorOptions.Outbounds = common.Uniq(append(selectorOptions.Outbounds, extraTags...))
if len(selectorOptions.Outbounds) == 0 {
continue
}
case C.TypeURLTest:
urltestOptions := common.PtrValueOrDefault(extraGroup.CustomURLTest)
groupOutbound.Options = &urltestOptions
urltestOptions.Outbounds = append(urltestOptions.Outbounds, extraTags...)
urltestOptions.Outbounds = common.Uniq(append(urltestOptions.Outbounds, extraTags...))
if len(urltestOptions.Outbounds) == 0 {
continue
}
}
if extraGroup.Target == option.ExtraGroupTargetDefault {
defaultGroups = append(defaultGroups, groupOutbound)
Expand Down

0 comments on commit 7b7fa37

Please sign in to comment.