From 736ba9e52cbeb6a9e9ddd81672a4964619e034a7 Mon Sep 17 00:00:00 2001 From: DHR60 Date: Sat, 12 Apr 2025 12:05:47 +0800 Subject: [PATCH] Fixes config generation --- .../ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs | 3 +++ .../ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs index 815ab873..899d412f 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs @@ -853,6 +853,7 @@ public class CoreConfigSingboxService }; endpoints.private_key = node.Id; endpoints.mtu = node.ShortId.IsNullOrEmpty() ? Global.TunMtus.First() : node.ShortId.ToInt(); + endpoints.peers = new() { peer }; break; } } @@ -1088,6 +1089,7 @@ public class CoreConfigSingboxService var nextEndpoint = JsonUtils.Deserialize(txtOutbound); await GenEndpoint(nextNode, nextEndpoint); nextEndpoint.tag = Global.ProxyTag; + singboxConfig.endpoints ??= new(); singboxConfig.endpoints.Insert(0, nextEndpoint); nextEndpoint.detour = tag; @@ -1097,6 +1099,7 @@ public class CoreConfigSingboxService var nextOutbound = JsonUtils.Deserialize(txtOutbound); await GenOutbound(nextNode, nextOutbound); nextOutbound.tag = Global.ProxyTag; + singboxConfig.outbounds ??= new(); singboxConfig.outbounds.Insert(0, nextOutbound); nextOutbound.detour = tag; diff --git a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs index 17621e4c..3dbfe219 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs @@ -1311,7 +1311,7 @@ public class CoreConfigV2rayService && nextNode.ConfigType != EConfigType.Custom && nextNode.ConfigType != EConfigType.Hysteria2 && nextNode.ConfigType != EConfigType.TUIC - && prevNode.ConfigType != EConfigType.Anytls) + && nextNode.ConfigType != EConfigType.Anytls) { var nextOutbound = JsonUtils.Deserialize(txtOutbound); await GenOutbound(nextNode, nextOutbound);