mirror of
https://github.com/2dust/v2rayN.git
synced 2026-02-28 21:23:04 +00:00
Fix chain
This commit is contained in:
parent
a89471da92
commit
3768e0d989
2 changed files with 48 additions and 25 deletions
|
|
@ -604,21 +604,31 @@ public partial class CoreConfigSingboxService
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
{
|
{
|
||||||
var chainStartNodes = childProfiles.Where(n => n.tag.StartsWith(currentTag)).ToList();
|
var chainStartNodes = childProfiles.Where(n => n.tag.StartsWith(currentTag)).ToList();
|
||||||
var existedChainNodes = JsonUtils.DeepCopy(resultOutbounds);
|
if (chainStartNodes.Count == 1)
|
||||||
resultOutbounds.Clear();
|
|
||||||
foreach (var chainStartNode in chainStartNodes)
|
|
||||||
{
|
{
|
||||||
var existedChainNodesClone = JsonUtils.DeepCopy(existedChainNodes);
|
foreach (var existedChainEndNode in resultOutbounds.Where(n => n.detour == currentTag))
|
||||||
for (var j = 0; j < existedChainNodesClone.Count; j++)
|
|
||||||
{
|
{
|
||||||
var existedChainNode = existedChainNodesClone[j];
|
existedChainEndNode.detour = chainStartNodes.First().tag;
|
||||||
var cloneTag = $"{existedChainNode.tag}-clone-{j + 1}";
|
}
|
||||||
existedChainNode.tag = cloneTag;
|
}
|
||||||
var previousDialerProxyTag = existedChainNode.detour;
|
else if (chainStartNodes.Count > 1)
|
||||||
existedChainNode.detour = (previousDialerProxyTag == currentTag)
|
{
|
||||||
? chainStartNode.tag
|
var existedChainNodes = JsonUtils.DeepCopy(resultOutbounds);
|
||||||
: existedChainNodesClone[j + 1].tag;
|
resultOutbounds.Clear();
|
||||||
resultOutbounds.Add(existedChainNode);
|
foreach (var chainStartNode in chainStartNodes)
|
||||||
|
{
|
||||||
|
var existedChainNodesClone = JsonUtils.DeepCopy(existedChainNodes);
|
||||||
|
for (var j = 0; j < existedChainNodesClone.Count; j++)
|
||||||
|
{
|
||||||
|
var existedChainNode = existedChainNodesClone[j];
|
||||||
|
var cloneTag = $"{existedChainNode.tag}-clone-{j + 1}";
|
||||||
|
existedChainNode.tag = cloneTag;
|
||||||
|
var previousDialerProxyTag = existedChainNode.detour;
|
||||||
|
existedChainNode.detour = (previousDialerProxyTag == currentTag)
|
||||||
|
? chainStartNode.tag
|
||||||
|
: existedChainNodesClone[j + 1].tag;
|
||||||
|
resultOutbounds.Add(existedChainNode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -743,22 +743,35 @@ public partial class CoreConfigV2rayService
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
{
|
{
|
||||||
var chainStartNodes = childProfiles.Where(n => n.tag.StartsWith(currentTag)).ToList();
|
var chainStartNodes = childProfiles.Where(n => n.tag.StartsWith(currentTag)).ToList();
|
||||||
var existedChainNodes = JsonUtils.DeepCopy(resultOutbounds);
|
if (chainStartNodes.Count == 1)
|
||||||
resultOutbounds.Clear();
|
|
||||||
foreach (var chainStartNode in chainStartNodes)
|
|
||||||
{
|
{
|
||||||
var existedChainNodesClone = JsonUtils.DeepCopy(existedChainNodes);
|
foreach (var existedChainEndNode in resultOutbounds.Where(n => n.streamSettings?.sockopt?.dialerProxy == currentTag))
|
||||||
for (var j = 0; j < existedChainNodesClone.Count; j++)
|
|
||||||
{
|
{
|
||||||
var existedChainNode = existedChainNodesClone[j];
|
existedChainEndNode.streamSettings.sockopt = new()
|
||||||
var cloneTag = $"{existedChainNode.tag}-clone-{j + 1}";
|
|
||||||
existedChainNode.tag = cloneTag;
|
|
||||||
var previousDialerProxyTag = existedChainNode.streamSettings?.sockopt?.dialerProxy;
|
|
||||||
existedChainNode.streamSettings.sockopt = new()
|
|
||||||
{
|
{
|
||||||
dialerProxy = (previousDialerProxyTag == currentTag) ? chainStartNode.tag : existedChainNodesClone[j + 1].tag
|
dialerProxy = chainStartNodes.First().tag
|
||||||
};
|
};
|
||||||
resultOutbounds.Add(existedChainNode);
|
}
|
||||||
|
}
|
||||||
|
else if (chainStartNodes.Count > 1)
|
||||||
|
{
|
||||||
|
var existedChainNodes = JsonUtils.DeepCopy(resultOutbounds);
|
||||||
|
resultOutbounds.Clear();
|
||||||
|
foreach (var chainStartNode in chainStartNodes)
|
||||||
|
{
|
||||||
|
var existedChainNodesClone = JsonUtils.DeepCopy(existedChainNodes);
|
||||||
|
for (var j = 0; j < existedChainNodesClone.Count; j++)
|
||||||
|
{
|
||||||
|
var existedChainNode = existedChainNodesClone[j];
|
||||||
|
var cloneTag = $"{existedChainNode.tag}-clone-{j + 1}";
|
||||||
|
existedChainNode.tag = cloneTag;
|
||||||
|
var previousDialerProxyTag = existedChainNode.streamSettings?.sockopt?.dialerProxy;
|
||||||
|
existedChainNode.streamSettings.sockopt = new()
|
||||||
|
{
|
||||||
|
dialerProxy = (previousDialerProxyTag == currentTag) ? chainStartNode.tag : existedChainNodesClone[j + 1].tag
|
||||||
|
};
|
||||||
|
resultOutbounds.Add(existedChainNode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue