feat: merge default proxy groups of all subscription
This commit is contained in:
@ -25,12 +25,22 @@ func PrefixProxyNames(subscriptionName string, data map[string]interface{}) []Pr
|
||||
|
||||
refs := renameProxies(subscriptionName, data, rename)
|
||||
renameProxyGroups(subscriptionName, data, rename)
|
||||
rewriteGroupProxyReferences(data, rename)
|
||||
rewriteRuleTargets(data, rename)
|
||||
RewriteReferences(data, rename)
|
||||
|
||||
return refs
|
||||
}
|
||||
|
||||
// RewriteReferences rewrites every reference to a renamed proxy or
|
||||
// proxy-group — inside other groups' "proxies" lists and inside
|
||||
// data["rules"]' rule targets — to the new name. Exposed separately from
|
||||
// PrefixProxyNames so callers that rename groups after the fact (e.g.
|
||||
// collapsing several subscriptions' default selector group into one) can
|
||||
// reuse the same rewrite logic without re-running the proxy/group renaming.
|
||||
func RewriteReferences(data map[string]interface{}, rename map[string]string) {
|
||||
rewriteGroupProxyReferences(data, rename)
|
||||
rewriteRuleTargets(data, rename)
|
||||
}
|
||||
|
||||
func renameProxies(subscriptionName string, data map[string]interface{}, rename map[string]string) []ProxyRef {
|
||||
proxiesRaw, ok := data["proxies"].([]interface{})
|
||||
if !ok {
|
||||
|
||||
Reference in New Issue
Block a user