vless reality mux can be used when the flow is empty

pull/3828/head
2dust 2023-05-07 09:01:50 +08:00
parent c8b01a5530
commit 83719dfe17
1 changed files with 32 additions and 14 deletions

View File

@ -330,9 +330,7 @@ namespace v2rayN.Handler
usersItem.security = Global.DefaultSecurity; usersItem.security = Global.DefaultSecurity;
} }
//Mux outboundMux(node, outbound, _config.coreBasicItem.muxEnabled);
outbound.mux.enabled = _config.coreBasicItem.muxEnabled;
outbound.mux.concurrency = _config.coreBasicItem.muxEnabled ? 8 : -1;
outbound.protocol = Global.vmessProtocolLite; outbound.protocol = Global.vmessProtocolLite;
outbound.settings.servers = null; outbound.settings.servers = null;
@ -357,8 +355,7 @@ namespace v2rayN.Handler
serversItem.ota = false; serversItem.ota = false;
serversItem.level = 1; serversItem.level = 1;
outbound.mux.enabled = false; outboundMux(node, outbound, false);
outbound.mux.concurrency = -1;
outbound.protocol = Global.ssProtocolLite; outbound.protocol = Global.ssProtocolLite;
outbound.settings.vnext = null; outbound.settings.vnext = null;
@ -393,8 +390,7 @@ namespace v2rayN.Handler
serversItem.users = new List<SocksUsersItem>() { socksUsersItem }; serversItem.users = new List<SocksUsersItem>() { socksUsersItem };
} }
outbound.mux.enabled = false; outboundMux(node, outbound, false);
outbound.mux.concurrency = -1;
outbound.protocol = Global.socksProtocolLite; outbound.protocol = Global.socksProtocolLite;
outbound.settings.vnext = null; outbound.settings.vnext = null;
@ -429,9 +425,7 @@ namespace v2rayN.Handler
usersItem.email = Global.userEMail; usersItem.email = Global.userEMail;
usersItem.encryption = node.security; usersItem.encryption = node.security;
//Mux outboundMux(node, outbound, _config.coreBasicItem.muxEnabled);
outbound.mux.enabled = _config.coreBasicItem.muxEnabled;
outbound.mux.concurrency = _config.coreBasicItem.muxEnabled ? 8 : -1;
if (node.streamSecurity == Global.StreamSecurityReality if (node.streamSecurity == Global.StreamSecurityReality
|| node.streamSecurity == Global.StreamSecurity) || node.streamSecurity == Global.StreamSecurity)
@ -440,10 +434,13 @@ namespace v2rayN.Handler
{ {
usersItem.flow = node.flow; usersItem.flow = node.flow;
outbound.mux.enabled = false; outboundMux(node, outbound, false);
outbound.mux.concurrency = -1;
} }
} }
if (node.streamSecurity == Global.StreamSecurityReality && Utils.IsNullOrEmpty(node.flow))
{
outboundMux(node, outbound, _config.coreBasicItem.muxEnabled);
}
outbound.protocol = Global.vlessProtocolLite; outbound.protocol = Global.vlessProtocolLite;
outbound.settings.servers = null; outbound.settings.servers = null;
@ -468,8 +465,7 @@ namespace v2rayN.Handler
serversItem.ota = false; serversItem.ota = false;
serversItem.level = 1; serversItem.level = 1;
outbound.mux.enabled = false; outboundMux(node, outbound, false);
outbound.mux.concurrency = -1;
outbound.protocol = Global.trojanProtocolLite; outbound.protocol = Global.trojanProtocolLite;
outbound.settings.vnext = null; outbound.settings.vnext = null;
@ -483,6 +479,28 @@ namespace v2rayN.Handler
return 0; return 0;
} }
private int outboundMux(ProfileItem node, Outbounds outbound, bool enabled)
{
try
{
if (_config.coreBasicItem.muxEnabled)
{
outbound.mux.enabled = true;
outbound.mux.concurrency = 8;
}
else
{
outbound.mux.enabled = false;
outbound.mux.concurrency = -1;
}
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
return 0;
}
private int boundStreamSettings(ProfileItem node, StreamSettings streamSettings) private int boundStreamSettings(ProfileItem node, StreamSettings streamSettings)
{ {
try try