From fe33c0e0e675fefc67e9a3d1db582d3abb9e8a01 Mon Sep 17 00:00:00 2001 From: DHR60 Date: Thu, 5 Feb 2026 18:02:17 +0800 Subject: [PATCH] Fix --- v2rayN/ServiceLib/Manager/AppManager.cs | 95 ++++++++++--------- .../Singbox/SingboxOutboundService.cs | 6 +- .../CoreConfig/V2ray/V2rayOutboundService.cs | 5 +- 3 files changed, 54 insertions(+), 52 deletions(-) diff --git a/v2rayN/ServiceLib/Manager/AppManager.cs b/v2rayN/ServiceLib/Manager/AppManager.cs index 9cd5a567..1b7ed58c 100644 --- a/v2rayN/ServiceLib/Manager/AppManager.cs +++ b/v2rayN/ServiceLib/Manager/AppManager.cs @@ -295,53 +295,56 @@ public sealed class AppManager MultipleLoad = groupItem.MultipleLoad, }; } + } - switch (item.ConfigType) - { - case EConfigType.Shadowsocks: - extra = extra with {SsMethod = item.Security.NullIfEmpty() }; - break; - case EConfigType.VMess: - extra = extra with - { - AlterId = item.AlterId.ToString(), - VmessSecurity = item.Security.NullIfEmpty(), - }; - break; - case EConfigType.VLESS: - extra = extra with - { - Flow = item.Flow.NullIfEmpty(), - }; - break; - case EConfigType.Hysteria2: - extra = extra with - { - SalamanderPass = item.Path.NullIfEmpty(), - Ports = item.Ports.NullIfEmpty(), - UpMbps = _config.HysteriaItem.UpMbps, - DownMbps = _config.HysteriaItem.DownMbps, - HopInterval = _config.HysteriaItem.HopInterval - }; - break; - case EConfigType.TUIC: - extra = extra with - { - Username = item.Id, - }; - item.Id = item.Security; - item.Password = item.Security; - break; - case EConfigType.WireGuard: - extra = extra with - { - WgPublicKey = item.PublicKey.NullIfEmpty(), - WgInterfaceAddress = item.RequestHost.NullIfEmpty(), - WgReserved = item.Path.NullIfEmpty(), - WgMtu = int.TryParse(item.ShortId, out var mtu) ? mtu : 1280 - }; - break; - } + switch (item.ConfigType) + { + case EConfigType.Shadowsocks: + extra = extra with { SsMethod = item.Security.NullIfEmpty() }; + break; + case EConfigType.VMess: + extra = extra with + { + AlterId = item.AlterId.ToString(), + VmessSecurity = item.Security.NullIfEmpty(), + }; + break; + case EConfigType.VLESS: + extra = extra with + { + Flow = item.Flow.NullIfEmpty(), + VlessEncryption = item.Security, + }; + break; + case EConfigType.Hysteria2: + extra = extra with + { + SalamanderPass = item.Path.NullIfEmpty(), + Ports = item.Ports.NullIfEmpty(), + UpMbps = _config.HysteriaItem.UpMbps, + DownMbps = _config.HysteriaItem.DownMbps, + HopInterval = _config.HysteriaItem.HopInterval + }; + break; + case EConfigType.TUIC: + extra = extra with + { + Username = item.Id, + }; + item.Id = item.Security; + item.Password = item.Security; + break; + case EConfigType.WireGuard: + extra = extra with + { + WgPublicKey = item.PublicKey.NullIfEmpty(), + WgInterfaceAddress = item.RequestHost.NullIfEmpty(), + WgReserved = item.Path.NullIfEmpty(), + WgMtu = int.TryParse(item.ShortId, out var mtu) ? mtu : 1280 + }; + break; + default: + break; } item.SetProtocolExtra(extra); diff --git a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxOutboundService.cs b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxOutboundService.cs index 6ce5f6d2..ef4bbaec 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxOutboundService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxOutboundService.cs @@ -114,13 +114,13 @@ public partial class CoreConfigSingboxService outbound.packet_encoding = "xudp"; - if (protocolExtra.Flow.IsNullOrEmpty()) + if (!protocolExtra.Flow.IsNullOrEmpty()) { - await GenOutboundMux(node, outbound); + outbound.flow = protocolExtra.Flow; } else { - outbound.flow = protocolExtra.Flow; + await GenOutboundMux(node, outbound); } await GenOutboundTransport(node, outbound); diff --git a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs index bdb99699..71d27ea1 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayOutboundService.cs @@ -144,13 +144,12 @@ public partial class CoreConfigV2rayService usersItem.email = Global.UserEMail; usersItem.encryption = protocolExtra.VlessEncryption; - if (protocolExtra.Flow.IsNullOrEmpty()) + if (!protocolExtra.Flow.IsNullOrEmpty()) { - await GenOutboundMux(node, outbound, muxEnabled, muxEnabled); + usersItem.flow = protocolExtra.Flow; } else { - usersItem.flow = protocolExtra.Flow; await GenOutboundMux(node, outbound, false, muxEnabled); } outbound.settings.servers = null;