Fix hy2 Brutal Bandwidth

This commit is contained in:
DHR60 2026-02-05 17:44:41 +08:00
parent ad685fcc03
commit 6d95366971
3 changed files with 8 additions and 8 deletions

View file

@ -149,10 +149,10 @@ public partial class CoreConfigSingboxService
outbound.up_mbps = protocolExtra?.UpMbps is { } su and >= 0
? su
: 0;
: _config.HysteriaItem.UpMbps;
outbound.down_mbps = protocolExtra?.DownMbps is { } sd and >= 0
? sd
: 0;
: _config.HysteriaItem.DownMbps;
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
: 0;
: _config.HysteriaItem.UpMbps;
int? downMbps = protocolExtra?.DownMbps is { } sd and >= 0
? sd
: 0;
: _config.HysteriaItem.UpMbps;
var hopInterval = protocolExtra?.HopInterval is { } hi and >= 5
? hi
: _config.HysteriaItem.HopInterval >= 5 ? _config.HysteriaItem.HopInterval : Global.Hysteria2DefaultHopInt;

View file

@ -113,8 +113,8 @@ public class AddServerViewModel : MyReactiveObject
AlterId = int.TryParse(protocolExtra?.AlterId, out var result) ? result : 0;
Flow = protocolExtra?.Flow ?? string.Empty;
SalamanderPass = protocolExtra?.SalamanderPass ?? string.Empty;
UpMbps = protocolExtra?.UpMbps ?? 0;
DownMbps = protocolExtra?.DownMbps ?? 0;
UpMbps = protocolExtra?.UpMbps ?? _config.HysteriaItem.UpMbps;
DownMbps = protocolExtra?.DownMbps ?? _config.HysteriaItem.DownMbps;
HopInterval = protocolExtra?.HopInterval ?? Global.Hysteria2DefaultHopInt;
VmessSecurity = protocolExtra?.VmessSecurity?.IsNullOrEmpty() == false ? protocolExtra.VmessSecurity : Global.DefaultSecurity;
VlessEncryption = protocolExtra?.VlessEncryption.IsNullOrEmpty() == false ? protocolExtra.VlessEncryption : Global.None;
@ -176,8 +176,8 @@ public class AddServerViewModel : MyReactiveObject
AlterId = AlterId > 0 ? AlterId.ToString() : null,
Flow = Flow.NullIfEmpty(),
SalamanderPass = SalamanderPass.NullIfEmpty(),
UpMbps = UpMbps > 0 ? UpMbps : null,
DownMbps = DownMbps > 0 ? DownMbps : null,
UpMbps = UpMbps >= 0 ? UpMbps : null,
DownMbps = DownMbps >= 0 ? DownMbps : null,
HopInterval = HopInterval >= 5 ? HopInterval : null,
VmessSecurity = VmessSecurity.NullIfEmpty(),
VlessEncryption = VlessEncryption.NullIfEmpty(),