Disable mux when using xhttp

This commit is contained in:
2dust 2024-12-16 21:01:03 +08:00
parent a4bbdb49de
commit 1a33c598e8
2 changed files with 7 additions and 23 deletions

View file

@ -350,21 +350,9 @@ namespace ServiceLib.Models
public string? path { get; set; } public string? path { get; set; }
public string? host { get; set; } public string? host { get; set; }
public string? mode { 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 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 class HttpSettings4Ray
{ {
public string? path { get; set; } public string? path { get; set; }

View file

@ -700,8 +700,7 @@ namespace ServiceLib.Services.CoreConfig
await GenOutboundMux(node, outbound, _config.CoreBasicItem.MuxEnabled); await GenOutboundMux(node, outbound, _config.CoreBasicItem.MuxEnabled);
if (node.StreamSecurity == Global.StreamSecurityReality if (node.StreamSecurity == Global.StreamSecurityReality || node.StreamSecurity == Global.StreamSecurity)
|| node.StreamSecurity == Global.StreamSecurity)
{ {
if (Utils.IsNotEmpty(node.Flow)) if (Utils.IsNotEmpty(node.Flow))
{ {
@ -745,7 +744,7 @@ namespace ServiceLib.Services.CoreConfig
} }
outbound.protocol = Global.ProtocolTypes[node.ConfigType]; outbound.protocol = Global.ProtocolTypes[node.ConfigType];
await GenBoundStreamSettings(node, outbound.streamSettings); await GenBoundStreamSettings(node, outbound);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -778,10 +777,11 @@ namespace ServiceLib.Services.CoreConfig
return 0; return 0;
} }
private async Task<int> GenBoundStreamSettings(ProfileItem node, StreamSettings4Ray streamSettings) private async Task<int> GenBoundStreamSettings(ProfileItem node, Outbounds4Ray outbound)
{ {
try try
{ {
var streamSettings = outbound.streamSettings;
streamSettings.network = node.GetNetwork(); streamSettings.network = node.GetNetwork();
var host = node.RequestHost.TrimEx(); var host = node.RequestHost.TrimEx();
var path = node.Path.TrimEx(); var path = node.Path.TrimEx();
@ -904,12 +904,7 @@ namespace ServiceLib.Services.CoreConfig
//xhttp //xhttp
case nameof(ETransport.xhttp): case nameof(ETransport.xhttp):
streamSettings.network = ETransport.xhttp.ToString(); streamSettings.network = ETransport.xhttp.ToString();
XhttpSettings4Ray xhttpSettings = new() XhttpSettings4Ray xhttpSettings = new();
{
scMaxEachPostBytes = "500000-1000000",
scMaxConcurrentPosts = "50-100",
scMinPostsIntervalMs = "30-50"
};
if (Utils.IsNotEmpty(path)) if (Utils.IsNotEmpty(path))
{ {
@ -929,6 +924,7 @@ namespace ServiceLib.Services.CoreConfig
} }
streamSettings.xhttpSettings = xhttpSettings; streamSettings.xhttpSettings = xhttpSettings;
await GenOutboundMux(node, outbound, false);
break; break;
//h2 //h2