mirror of
https://github.com/2dust/v2rayN.git
synced 2025-10-13 11:59:13 +00:00
Adjust chained proxy, actual outbound is at the top
Based on actual network flow instead of data packets
This commit is contained in:
parent
dace865e6c
commit
71dcd8d1de
2 changed files with 10 additions and 6 deletions
|
@ -682,11 +682,13 @@ public partial class CoreConfigSingboxService
|
|||
|
||||
private async Task<int> GenChainOutboundsList(List<ProfileItem> nodes, SingboxConfig singboxConfig, string baseTagName = Global.ProxyTag)
|
||||
{
|
||||
// Based on actual network flow instead of data packets
|
||||
var nodesReverse = nodes.AsEnumerable().Reverse().ToList();
|
||||
var resultOutbounds = new List<Outbound4Sbox>();
|
||||
var resultEndpoints = new List<Endpoints4Sbox>(); // For endpoints
|
||||
for (var i = 0; i < nodes.Count; i++)
|
||||
for (var i = 0; i < nodesReverse.Count; i++)
|
||||
{
|
||||
var node = nodes[i];
|
||||
var node = nodesReverse[i];
|
||||
var server = await GenServer(node);
|
||||
|
||||
if (server is null)
|
||||
|
@ -703,7 +705,7 @@ public partial class CoreConfigSingboxService
|
|||
server.tag = baseTagName + i.ToString();
|
||||
}
|
||||
|
||||
if (i != nodes.Count - 1)
|
||||
if (i != nodesReverse.Count - 1)
|
||||
{
|
||||
server.detour = baseTagName + (i + 1).ToString();
|
||||
}
|
||||
|
|
|
@ -749,10 +749,12 @@ public partial class CoreConfigV2rayService
|
|||
|
||||
private async Task<int> GenChainOutboundsList(List<ProfileItem> nodes, V2rayConfig v2RayConfig, string baseTagName = Global.ProxyTag)
|
||||
{
|
||||
// Based on actual network flow instead of data packets
|
||||
var nodesReverse = nodes.AsEnumerable().Reverse().ToList();
|
||||
var resultOutbounds = new List<Outbounds4Ray>();
|
||||
for (var i = 0; i < nodes.Count; i++)
|
||||
for (var i = 0; i < nodesReverse.Count; i++)
|
||||
{
|
||||
var node = nodes[i];
|
||||
var node = nodesReverse[i];
|
||||
var txtOutbound = EmbedUtils.GetEmbedText(Global.V2raySampleOutbound);
|
||||
if (txtOutbound.IsNullOrEmpty())
|
||||
{
|
||||
|
@ -776,7 +778,7 @@ public partial class CoreConfigV2rayService
|
|||
outbound.tag = "chain-" + baseTagName + i.ToString();
|
||||
}
|
||||
|
||||
if (i != nodes.Count - 1)
|
||||
if (i != nodesReverse.Count - 1)
|
||||
{
|
||||
outbound.streamSettings.sockopt = new()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue