From 6d953669712d45ef6513ae01bb72eed5b3c090f8 Mon Sep 17 00:00:00 2001 From: DHR60 Date: Thu, 5 Feb 2026 17:44:41 +0800 Subject: [PATCH] Fix hy2 Brutal Bandwidth --- .../Services/CoreConfig/Singbox/SingboxOutboundService.cs | 4 ++-- .../Services/CoreConfig/V2ray/V2rayOutboundService.cs | 4 ++-- v2rayN/ServiceLib/ViewModels/AddServerViewModel.cs | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxOutboundService.cs b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxOutboundService.cs index 127b09a5..6ce5f6d2 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxOutboundService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxOutboundService.cs @@ -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(','))) { diff --git a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs index 47fc3767..bdb99699 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs @@ -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; diff --git a/v2rayN/ServiceLib/ViewModels/AddServerViewModel.cs b/v2rayN/ServiceLib/ViewModels/AddServerViewModel.cs index 4ba9c93f..73915544 100644 --- a/v2rayN/ServiceLib/ViewModels/AddServerViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/AddServerViewModel.cs @@ -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(),