From c01f0cde4df0acd5e8ef48db8c82e7ff99a8d2ed Mon Sep 17 00:00:00 2001 From: DHR60 Date: Tue, 5 May 2026 13:29:49 +0800 Subject: [PATCH] Fix --- .github/workflows/test.yml | 2 +- v2rayN/ServiceLib/Handler/Builder/CoreConfigContextBuilder.cs | 1 + v2rayN/ServiceLib/Models/CoreConfigContext.cs | 1 + .../Services/CoreConfig/Singbox/SingboxInboundService.cs | 2 +- .../ServiceLib/Services/CoreConfig/V2ray/V2rayDnsService.cs | 4 ++-- .../Services/CoreConfig/V2ray/V2rayInboundService.cs | 2 +- 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index acca3260..9364283f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,4 +26,4 @@ jobs: - name: Test Code working-directory: ./v2rayN - run: dotnet test ./ServiceLib.Tests --logger GitHubActions + run: dotnet test ./ServiceLib.Tests diff --git a/v2rayN/ServiceLib/Handler/Builder/CoreConfigContextBuilder.cs b/v2rayN/ServiceLib/Handler/Builder/CoreConfigContextBuilder.cs index 1b681661..eb1af21b 100644 --- a/v2rayN/ServiceLib/Handler/Builder/CoreConfigContextBuilder.cs +++ b/v2rayN/ServiceLib/Handler/Builder/CoreConfigContextBuilder.cs @@ -48,6 +48,7 @@ public class CoreConfigContextBuilder RawDnsItem = await AppManager.Instance.GetDNSItem(coreType), RoutingItem = await ConfigHandler.GetDefaultRouting(config), IsWindows = Utils.IsWindows(), + IsMacOS = Utils.IsMacOS(), }; var validatorResult = NodeValidatorResult.Empty(); var (actNode, nodeValidatorResult) = await ResolveNodeAsync(context, node); diff --git a/v2rayN/ServiceLib/Models/CoreConfigContext.cs b/v2rayN/ServiceLib/Models/CoreConfigContext.cs index e85d5385..4b64efca 100644 --- a/v2rayN/ServiceLib/Models/CoreConfigContext.cs +++ b/v2rayN/ServiceLib/Models/CoreConfigContext.cs @@ -19,4 +19,5 @@ public record CoreConfigContext public HashSet ProtectDomainList { get; init; } = []; public bool IsWindows { get; init; } + public bool IsMacOS { get; init; } } diff --git a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxInboundService.cs b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxInboundService.cs index 13c4e40b..b1e24a74 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxInboundService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxInboundService.cs @@ -62,7 +62,7 @@ public partial class CoreConfigSingboxService } var tunInbound = JsonUtils.Deserialize(EmbedUtils.GetEmbedText(Global.TunSingboxInboundFileName)) ?? new Inbound4Sbox { }; - tunInbound.interface_name = Utils.IsMacOS() ? $"utun{new Random().Next(99)}" : "singbox_tun"; + tunInbound.interface_name = context.IsMacOS ? $"utun{new Random().Next(99)}" : "singbox_tun"; tunInbound.mtu = _config.TunModeItem.Mtu; tunInbound.auto_route = _config.TunModeItem.AutoRoute; tunInbound.strict_route = _config.TunModeItem.StrictRoute; diff --git a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayDnsService.cs b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayDnsService.cs index 1777d16a..abb3e134 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayDnsService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayDnsService.cs @@ -200,9 +200,9 @@ public partial class CoreConfigV2rayService if (normalizedDomain.StartsWith(Global.GeoSitePrefix) || normalizedDomain.StartsWith("ext:")) { var isExpectedDomain = !regionName.IsNullOrEmpty() - || normalizedDomain.EndsWith($"-{regionName}") + && (normalizedDomain.EndsWith($"-{regionName}") || normalizedDomain.EndsWith($"@{regionName}") - || normalizedDomain == Global.GeoSitePrefix + regionName; + || normalizedDomain == Global.GeoSitePrefix + regionName); var targetList = isExpectedDomain ? expectedDomainList : directGeositeList; targetList.Add(normalizedDomain); } diff --git a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayInboundService.cs b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayInboundService.cs index 9cb02e01..91c8c133 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayInboundService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayInboundService.cs @@ -54,7 +54,7 @@ public partial class CoreConfigV2rayService _config.TunModeItem.Mtu = Global.TunMtus.First(); } var tunInbound = JsonUtils.Deserialize(EmbedUtils.GetEmbedText(Global.V2raySampleTunInbound)) ?? new Inbounds4Ray { }; - tunInbound.settings.name = Utils.IsMacOS() ? $"utun{new Random().Next(99)}" : "xray_tun"; + tunInbound.settings.name = context.IsMacOS ? $"utun{new Random().Next(99)}" : "xray_tun"; tunInbound.settings.MTU = _config.TunModeItem.Mtu; if (_config.TunModeItem.EnableIPv6Address == false) {