forked from mirror/serenity
Add subscription.process.rewrite_multiplex
This commit is contained in:
parent
5a3996dad9
commit
7dffc3de5f
@ -12,7 +12,8 @@
|
||||
"filter_outbound_type": [],
|
||||
"exclude_outbound_type": [],
|
||||
"rename": {},
|
||||
"remove_emoji": false
|
||||
"remove_emoji": false,
|
||||
"rewrite_multiplex": {}
|
||||
}
|
||||
],
|
||||
"deduplication": false,
|
||||
@ -77,6 +78,10 @@ Regexp rename rules, matching outbounds will be renamed.
|
||||
|
||||
Remove emojis in outbound tags.
|
||||
|
||||
#### process.rewrite_multiplex
|
||||
|
||||
Rewrite [Multiplex](https://sing-box.sagernet.org/configuration/shared/multiplex) options.
|
||||
|
||||
#### deduplication
|
||||
|
||||
Remove outbounds with duplicate server destinations (Domain will be resolved to compare).
|
||||
|
@ -68,6 +68,7 @@ type OutboundProcessOptions struct {
|
||||
ExcludeOutboundType option.Listable[string] `json:"exclude_outbound_type,omitempty"`
|
||||
Rename *badjson.TypedMap[string, string] `json:"rename,omitempty"`
|
||||
RemoveEmoji bool `json:"remove_emoji,omitempty"`
|
||||
RewriteMultiplex *option.OutboundMultiplexOptions `json:"rewrite_multiplex,omitempty"`
|
||||
}
|
||||
|
||||
type Profile struct {
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/sagernet/serenity/option"
|
||||
C "github.com/sagernet/sing-box/constant"
|
||||
boxOption "github.com/sagernet/sing-box/option"
|
||||
"github.com/sagernet/sing/common"
|
||||
E "github.com/sagernet/sing/common/exceptions"
|
||||
@ -103,6 +104,18 @@ func (o *ProcessOptions) Process(outbounds []boxOption.Outbound) []boxOption.Out
|
||||
if originTag != outbound.Tag {
|
||||
renameResult[originTag] = outbound.Tag
|
||||
}
|
||||
if o.RewriteMultiplex != nil {
|
||||
switch outbound.Type {
|
||||
case C.TypeShadowsocks:
|
||||
outbound.ShadowsocksOptions.Multiplex = o.RewriteMultiplex
|
||||
case C.TypeTrojan:
|
||||
outbound.TrojanOptions.Multiplex = o.RewriteMultiplex
|
||||
case C.TypeVMess:
|
||||
outbound.VMessOptions.Multiplex = o.RewriteMultiplex
|
||||
case C.TypeVLESS:
|
||||
outbound.VLESSOptions.Multiplex = o.RewriteMultiplex
|
||||
}
|
||||
}
|
||||
newOutbounds = append(newOutbounds, outbound)
|
||||
}
|
||||
if len(renameResult) > 0 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user