Fix hy2 bbr

This commit is contained in:
DHR60 2026-01-21 12:11:06 +08:00
parent 82443a64cd
commit 7bfd2f504d
3 changed files with 20 additions and 4 deletions

View file

@ -713,6 +713,8 @@ public static class ConfigHandler
profileItem.ConfigType = EConfigType.Hysteria2;
//profileItem.CoreType = ECoreType.sing_box;
var protocolExtra = profileItem.GetProtocolExtra();
profileItem.Address = profileItem.Address.TrimEx();
profileItem.Password = profileItem.Password.TrimEx();
profileItem.Path = profileItem.Path.TrimEx();
@ -726,6 +728,20 @@ public static class ConfigHandler
{
return -1;
}
if (protocolExtra.UpMbps is null or < 0)
{
protocolExtra.UpMbps = config.HysteriaItem.UpMbps;
}
if (protocolExtra.DownMbps is null or < 0)
{
protocolExtra.DownMbps = config.HysteriaItem.DownMbps;
}
if (protocolExtra.HopInterval is null or <= 5)
{
protocolExtra.HopInterval = Global.Hysteria2DefaultHopInt;
}
profileItem.SetProtocolExtra(protocolExtra);
await AddServerCommon(config, profileItem, toFile);

View file

@ -149,10 +149,10 @@ public partial class CoreConfigSingboxService
outbound.up_mbps = protocolExtra?.UpMbps is { } su and >= 0
? su
: _config.HysteriaItem.UpMbps > 0 ? _config.HysteriaItem.UpMbps : null;
: 0;
outbound.down_mbps = protocolExtra?.DownMbps is { } sd and >= 0
? sd
: _config.HysteriaItem.DownMbps > 0 ? _config.HysteriaItem.DownMbps : null;
: 0;
var ports = protocolExtra?.Ports?.IsNullOrEmpty() == false ? protocolExtra.Ports : null;
if ((!ports.IsNullOrEmpty()) && (ports.Contains(':') || ports.Contains('-') || ports.Contains(',')))
{

View file

@ -515,10 +515,10 @@ public partial class CoreConfigV2rayService
var ports = protocolExtra?.Ports;
int? upMbps = protocolExtra?.UpMbps is { } su and >= 0
? su
: _config.HysteriaItem.UpMbps > 0 ? _config.HysteriaItem.UpMbps : null;
: 0;
int? downMbps = protocolExtra?.DownMbps is { } sd and >= 0
? sd
: _config.HysteriaItem.DownMbps > 0 ? _config.HysteriaItem.DownMbps : null;
: 0;
var hopInterval = protocolExtra?.HopInterval is { } hi and >= 5
? hi
: _config.HysteriaItem.HopInterval >= 5 ? _config.HysteriaItem.HopInterval : Global.Hysteria2DefaultHopInt;