Skip to content

Commit

Permalink
Disable mux when using xhttp
Browse files Browse the repository at this point in the history
  • Loading branch information
2dust committed Dec 16, 2024
1 parent a4bbdb4 commit 1a33c59
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 23 deletions.
12 changes: 0 additions & 12 deletions v2rayN/ServiceLib/Models/V2rayConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -350,21 +350,9 @@ public class XhttpSettings4Ray
public string? path { get; set; }
public string? host { get; set; }
public string? mode { get; set; }
public object? scMaxEachPostBytes { get; set; }
public object? scMaxConcurrentPosts { get; set; }
public object? scMinPostsIntervalMs { get; set; }
//public Xmux4Ray? xmux { get; set; }
public object? extra { get; set; }
}

//public class Xmux4Ray
//{
// public object? maxConcurrency { get; set; }
// public object? maxConnections { get; set; }
// public object? cMaxReuseTimes { get; set; }
// public object? cMaxLifetimeMs { get; set; }
//}

public class HttpSettings4Ray
{
public string? path { get; set; }
Expand Down
18 changes: 7 additions & 11 deletions v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -700,8 +700,7 @@ private async Task<int> GenOutbound(ProfileItem node, Outbounds4Ray outbound)

await GenOutboundMux(node, outbound, _config.CoreBasicItem.MuxEnabled);

if (node.StreamSecurity == Global.StreamSecurityReality
|| node.StreamSecurity == Global.StreamSecurity)
if (node.StreamSecurity == Global.StreamSecurityReality || node.StreamSecurity == Global.StreamSecurity)
{
if (Utils.IsNotEmpty(node.Flow))
{
Expand Down Expand Up @@ -745,7 +744,7 @@ private async Task<int> GenOutbound(ProfileItem node, Outbounds4Ray outbound)
}

outbound.protocol = Global.ProtocolTypes[node.ConfigType];
await GenBoundStreamSettings(node, outbound.streamSettings);
await GenBoundStreamSettings(node, outbound);
}
catch (Exception ex)
{
Expand Down Expand Up @@ -778,10 +777,11 @@ private async Task<int> GenOutboundMux(ProfileItem node, Outbounds4Ray outbound,
return 0;
}

private async Task<int> GenBoundStreamSettings(ProfileItem node, StreamSettings4Ray streamSettings)
private async Task<int> GenBoundStreamSettings(ProfileItem node, Outbounds4Ray outbound)
{
try
{
var streamSettings = outbound.streamSettings;
streamSettings.network = node.GetNetwork();
var host = node.RequestHost.TrimEx();
var path = node.Path.TrimEx();
Expand Down Expand Up @@ -869,7 +869,7 @@ private async Task<int> GenBoundStreamSettings(ProfileItem node, StreamSettings4
case nameof(ETransport.ws):
WsSettings4Ray wsSettings = new();
wsSettings.headers = new Headers4Ray();

if (Utils.IsNotEmpty(host))
{
wsSettings.host = host;
Expand Down Expand Up @@ -904,12 +904,7 @@ private async Task<int> GenBoundStreamSettings(ProfileItem node, StreamSettings4
//xhttp
case nameof(ETransport.xhttp):
streamSettings.network = ETransport.xhttp.ToString();
XhttpSettings4Ray xhttpSettings = new()
{
scMaxEachPostBytes = "500000-1000000",
scMaxConcurrentPosts = "50-100",
scMinPostsIntervalMs = "30-50"
};
XhttpSettings4Ray xhttpSettings = new();

if (Utils.IsNotEmpty(path))
{
Expand All @@ -929,6 +924,7 @@ private async Task<int> GenBoundStreamSettings(ProfileItem node, StreamSettings4
}

streamSettings.xhttpSettings = xhttpSettings;
await GenOutboundMux(node, outbound, false);

break;
//h2
Expand Down

0 comments on commit 1a33c59

Please sign in to comment.