From 137f49866812900abbfea3bb4fe2c6274f493369 Mon Sep 17 00:00:00 2001 From: DHR60 Date: Fri, 10 Oct 2025 20:38:33 +0800 Subject: [PATCH] Remove unnecessary settings --- v2rayN/ServiceLib/Global.cs | 3 +- v2rayN/ServiceLib/Handler/ConfigHandler.cs | 2 - v2rayN/ServiceLib/Models/ConfigItems.cs | 2 - v2rayN/ServiceLib/Resx/ResUI.Designer.cs | 87 +++++++------------ v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx | 25 ++---- v2rayN/ServiceLib/Resx/ResUI.hu.resx | 25 ++---- v2rayN/ServiceLib/Resx/ResUI.resx | 25 ++---- v2rayN/ServiceLib/Resx/ResUI.ru.resx | 25 ++---- v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx | 25 ++---- v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx | 25 ++---- .../Singbox/CoreConfigSingboxService.cs | 4 +- .../CoreConfig/Singbox/SingboxDnsService.cs | 57 +++++------- .../Singbox/SingboxRoutingService.cs | 4 +- .../CoreConfig/V2ray/V2rayDnsService.cs | 4 +- .../ViewModels/DNSSettingViewModel.cs | 6 -- .../Views/DNSSettingWindow.axaml | 61 +++---------- .../Views/DNSSettingWindow.axaml.cs | 4 - v2rayN/v2rayN/Views/DNSSettingWindow.xaml | 66 +++----------- v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs | 4 - 19 files changed, 133 insertions(+), 321 deletions(-) diff --git a/v2rayN/ServiceLib/Global.cs b/v2rayN/ServiceLib/Global.cs index 16741fc1..6e3c541c 100644 --- a/v2rayN/ServiceLib/Global.cs +++ b/v2rayN/ServiceLib/Global.cs @@ -84,8 +84,7 @@ public class Global public const string SingboxDirectDNSTag = "direct_dns"; public const string SingboxRemoteDNSTag = "remote_dns"; - public const string SingboxOutboundResolverTag = "outbound_resolver"; - public const string SingboxFinalResolverTag = "final_resolver"; + public const string SingboxLocalDNSTag = "local_local"; public const string SingboxHostsDNSTag = "hosts_dns"; public const string SingboxFakeDNSTag = "fake_dns"; diff --git a/v2rayN/ServiceLib/Handler/ConfigHandler.cs b/v2rayN/ServiceLib/Handler/ConfigHandler.cs index 238a3cc7..c3dc716b 100644 --- a/v2rayN/ServiceLib/Handler/ConfigHandler.cs +++ b/v2rayN/ServiceLib/Handler/ConfigHandler.cs @@ -2274,8 +2274,6 @@ public static class ConfigHandler BlockBindingQuery = true, DirectDNS = Global.DomainDirectDNSAddress.FirstOrDefault(), RemoteDNS = Global.DomainRemoteDNSAddress.FirstOrDefault(), - SingboxOutboundsResolveDNS = Global.DomainDirectDNSAddress.FirstOrDefault(), - SingboxFinalResolveDNS = Global.DomainPureIPDNSAddress.FirstOrDefault() }; } diff --git a/v2rayN/ServiceLib/Models/ConfigItems.cs b/v2rayN/ServiceLib/Models/ConfigItems.cs index b9b305bb..3a7a7b97 100644 --- a/v2rayN/ServiceLib/Models/ConfigItems.cs +++ b/v2rayN/ServiceLib/Models/ConfigItems.cs @@ -264,8 +264,6 @@ public class SimpleDNSItem public bool? BlockBindingQuery { get; set; } public string? DirectDNS { get; set; } public string? RemoteDNS { get; set; } - public string? SingboxOutboundsResolveDNS { get; set; } - public string? SingboxFinalResolveDNS { get; set; } public string? RayStrategy4Freedom { get; set; } public string? SingboxStrategy4Direct { get; set; } public string? SingboxStrategy4Proxy { get; set; } diff --git a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs index fa04e98c..ba04de44 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs +++ b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs @@ -2509,7 +2509,7 @@ namespace ServiceLib.Resx { } /// - /// 查找类似 Prevent domain-based routing rules from failing 的本地化字符串。 + /// 查找类似 Block ECH and HTTP/3 availability checks when enabled 的本地化字符串。 /// public static string TbBlockSVCBHTTPSQueriesTips { get { @@ -2607,6 +2607,24 @@ namespace ServiceLib.Resx { } } + /// + /// 查找类似 V2ray Custom DNS 的本地化字符串。 + /// + public static string TbCustomDnsRay { + get { + return ResourceManager.GetString("TbCustomDnsRay", resourceCulture); + } + } + + /// + /// 查找类似 sing-box Custom DNS 的本地化字符串。 + /// + public static string TbCustomDnsSingbox { + get { + return ResourceManager.GetString("TbCustomDnsSingbox", resourceCulture); + } + } + /// /// 查找类似 Display GUI 的本地化字符串。 /// @@ -3039,6 +3057,15 @@ namespace ServiceLib.Resx { } } + /// + /// 查找类似 Via proxy — please ensure remote availability 的本地化字符串。 + /// + public static string TbRemoteDNSTips { + get { + return ResourceManager.GetString("TbRemoteDNSTips", resourceCulture); + } + } + /// /// 查找类似 Camouflage domain(host) 的本地化字符串。 /// @@ -3174,15 +3201,6 @@ namespace ServiceLib.Resx { } } - /// - /// 查找类似 Bootstrap DNS (sing-box) 的本地化字符串。 - /// - public static string TbSBBootstrapDNS { - get { - return ResourceManager.GetString("TbSBBootstrapDNS", resourceCulture); - } - } - /// /// 查找类似 sing-box Direct Resolution Strategy 的本地化字符串。 /// @@ -3192,15 +3210,6 @@ namespace ServiceLib.Resx { } } - /// - /// 查找类似 Resolve DNS server domains, requires IP 的本地化字符串。 - /// - public static string TbSBFallbackDNSResolve { - get { - return ResourceManager.GetString("TbSBFallbackDNSResolve", resourceCulture); - } - } - /// /// 查找类似 sing-box Full Config Template 的本地化字符串。 /// @@ -3219,24 +3228,6 @@ namespace ServiceLib.Resx { } } - /// - /// 查找类似 Resolve Outbound Domains 的本地化字符串。 - /// - public static string TbSBOutboundDomainResolve { - get { - return ResourceManager.GetString("TbSBOutboundDomainResolve", resourceCulture); - } - } - - /// - /// 查找类似 Outbound DNS Resolution (sing-box) 的本地化字符串。 - /// - public static string TbSBOutboundsResolverDNS { - get { - return ResourceManager.GetString("TbSBOutboundsResolverDNS", resourceCulture); - } - } - /// /// 查找类似 sing-box Remote Resolution Strategy 的本地化字符串。 /// @@ -3372,24 +3363,6 @@ namespace ServiceLib.Resx { } } - /// - /// 查找类似 V2ray DNS settings 的本地化字符串。 - /// - public static string TbSettingsCoreDns { - get { - return ResourceManager.GetString("TbSettingsCoreDns", resourceCulture); - } - } - - /// - /// 查找类似 sing-box DNS settings 的本地化字符串。 - /// - public static string TbSettingsCoreDnsSingbox { - get { - return ResourceManager.GetString("TbSettingsCoreDnsSingbox", resourceCulture); - } - } - /// /// 查找类似 Core: KCP settings 的本地化字符串。 /// @@ -4275,9 +4248,9 @@ namespace ServiceLib.Resx { /// /// 查找类似 xray Freedom Resolution Strategy 的本地化字符串。 /// - public static string TbXrayFreedomResolveStrategy { + public static string TbXrayFreedomStrategy { get { - return ResourceManager.GetString("TbXrayFreedomResolveStrategy", resourceCulture); + return ResourceManager.GetString("TbXrayFreedomStrategy", resourceCulture); } } diff --git a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx index 9fda034c..65264f74 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx @@ -675,8 +675,8 @@ هسته: تنظیمات اولیه - - تنظیمات V2ray DNS + + V2ray Custom DNS هسته: تنظیمات KCP @@ -1011,8 +1011,8 @@ تنظیمات DNS - - تنظیمات DNS sing-box + + sing-box Custom DNS لطفا ساختار DNS را پر کنید، برای مشاهده سند کلیک کنید @@ -1419,19 +1419,10 @@ Domestic DNS - - Outbound DNS Resolution (sing-box) + + Via proxy — please ensure remote availability - - Resolve Outbound Domains - - - Bootstrap DNS (sing-box) - - - Resolve DNS server domains, requires IP - - + xray Freedom Resolution Strategy @@ -1471,7 +1462,7 @@ Custom DNS Enabled, This Page's Settings Invalid - Prevent domain-based routing rules from failing + Block ECH and HTTP/3 availability checks when enabled Please fill in the correct config template diff --git a/v2rayN/ServiceLib/Resx/ResUI.hu.resx b/v2rayN/ServiceLib/Resx/ResUI.hu.resx index 49e7e8c4..0cee0ded 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.hu.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.hu.resx @@ -675,8 +675,8 @@ Core: alapbeállítások - - V2ray DNS beállítások + + V2ray Custom DNS Core: KCP beállítások @@ -1011,8 +1011,8 @@ DNS beállítások - - sing-box DNS beállítások + + sing-box Custom DNS Kérjük, töltse ki a DNS struktúrát, kattintson a dokumentum megtekintéséhez @@ -1419,19 +1419,10 @@ Domestic DNS - - Outbound DNS Resolution (sing-box) + + Via proxy — please ensure remote availability - - Resolve Outbound Domains - - - Bootstrap DNS (sing-box) - - - Resolve DNS server domains, requires IP - - + xray Freedom Resolution Strategy @@ -1471,7 +1462,7 @@ Custom DNS Enabled, This Page's Settings Invalid - Prevent domain-based routing rules from failing + Block ECH and HTTP/3 availability checks when enabled Please fill in the correct config template diff --git a/v2rayN/ServiceLib/Resx/ResUI.resx b/v2rayN/ServiceLib/Resx/ResUI.resx index 4836f005..27dd9e3c 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.resx @@ -675,8 +675,8 @@ Core: basic settings - - V2ray DNS settings + + V2ray Custom DNS Core: KCP settings @@ -1011,8 +1011,8 @@ DNS Settings - - sing-box DNS settings + + sing-box Custom DNS Please fill in DNS Structure, Click to view the document @@ -1419,19 +1419,10 @@ Domestic DNS - - Outbound DNS Resolution (sing-box) + + Via proxy — please ensure remote availability - - Resolve Outbound Domains - - - Bootstrap DNS (sing-box) - - - Resolve DNS server domains, requires IP - - + xray Freedom Resolution Strategy @@ -1471,7 +1462,7 @@ Custom DNS Enabled, This Page's Settings Invalid - Prevent domain-based routing rules from failing + Block ECH and HTTP/3 availability checks when enabled Please fill in the correct config template diff --git a/v2rayN/ServiceLib/Resx/ResUI.ru.resx b/v2rayN/ServiceLib/Resx/ResUI.ru.resx index 5fd8640f..197afb51 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.ru.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.ru.resx @@ -675,8 +675,8 @@ Ядро: базовые настройки - - Настройки DNS V2ray + + V2ray Custom DNS Ядро: настройки KCP @@ -1011,8 +1011,8 @@ Настройки DNS - - Настройки DNS sing-box + + sing-box Custom DNS Заполните структуру DNS, нажмите, чтобы открыть документ @@ -1419,19 +1419,10 @@ Внутренний DNS - - Резолвер DNS для исходящих (sing-box) + + Via proxy — please ensure remote availability - - Разрешать домены для исходящих соединений - - - Bootstrap DNS (sing-box) - - - Resolve DNS server domains, requires IP - - + Стратегия резолвинга Freedom (Xray) @@ -1471,7 +1462,7 @@ Включён пользовательский DNS — настройки на этой странице не применяются - Предотвращает сбои доменных правил маршрутизации + Block ECH and HTTP/3 availability checks when enabled Пожалуйста, заполните корректный шаблон конфигурации diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx index eaf55173..a755e808 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx @@ -675,8 +675,8 @@ Core: 基础设置 - - v2ray DNS 设置 + + v2ray 自定义 DNS Core: KCP 设置 @@ -1008,8 +1008,8 @@ DNS 设置 - - sing-box DNS 设置 + + sing-box 自定义 DNS 请填写 DNS JSON 结构,点击查看文档 @@ -1416,19 +1416,10 @@ 直连 DNS - - 出站 DNS 解析(sing-box) + + 通过代理,请确保远程可用 - - 解析出站域名 - - - Bootstrap DNS (sing-box) - - - 解析 DNS 服务器域名,需指定为 IP - - + xray freedom 解析策略 @@ -1468,7 +1459,7 @@ 自定义 DNS 已启用,此页面配置将无效 - 避免域名分流规则失效 + 开启后将阻止 ECH 和 HTTP/3 可用性查询 请填写正确的配置模板 diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx index 0ee39e31..4773bd85 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx @@ -675,8 +675,8 @@ Core: 基礎設定 - - V2ray DNS 設定 + + V2ray Custom DNS Core: KCP 設定 @@ -1008,8 +1008,8 @@ DNS 設定 - - sing-box DNS 設定 + + sing-box Custom DNS 請填寫 DNS JSON 結構,點擊查看檔案 @@ -1416,19 +1416,10 @@ Domestic DNS - - Outbound DNS Resolution (sing-box) + + Via proxy — please ensure remote availability - - Resolve Outbound Domains - - - Bootstrap DNS (sing-box) - - - Resolve DNS server domains, requires IP - - + xray Freedom Resolution Strategy @@ -1468,7 +1459,7 @@ Custom DNS Enabled, This Page's Settings Invalid - Prevent domain-based routing rules from failing + Block ECH and HTTP/3 availability checks when enabled Please fill in the correct config template diff --git a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/CoreConfigSingboxService.cs b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/CoreConfigSingboxService.cs index e7644a3d..191c7efa 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/CoreConfigSingboxService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/CoreConfigSingboxService.cs @@ -235,7 +235,7 @@ public partial class CoreConfigSingboxService(Config config) } singboxConfig.route.default_domain_resolver = new() { - server = Global.SingboxFinalResolverTag + server = Global.SingboxLocalDNSTag, }; ret.Success = true; @@ -308,7 +308,7 @@ public partial class CoreConfigSingboxService(Config config) } singboxConfig.route.default_domain_resolver = new() { - server = Global.SingboxFinalResolverTag + server = Global.SingboxLocalDNSTag, }; singboxConfig.route.rules.Clear(); diff --git a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxDnsService.cs b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxDnsService.cs index ce4d2619..b1698ab4 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxDnsService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxDnsService.cs @@ -43,17 +43,7 @@ public partial class CoreConfigSingboxService }); } - //Outbound Freedom Resolver - var freedomOutbound = singboxConfig.outbounds?.FirstOrDefault(t => t is { type: "direct", tag: Global.DirectTag }); - if (freedomOutbound != null) - { - freedomOutbound.domain_resolver = new() - { - server = Global.SingboxDirectDNSTag, - }; - } - - await GenOutboundDnsRule(node, singboxConfig, Global.SingboxOutboundResolverTag); + await GenOutboundDnsRule(node, singboxConfig); } catch (Exception ex) { @@ -68,16 +58,12 @@ public partial class CoreConfigSingboxService var directDns = ParseDnsAddress(simpleDNSItem.DirectDNS); directDns.tag = Global.SingboxDirectDNSTag; - directDns.domain_resolver = Global.SingboxFinalResolverTag; + directDns.domain_resolver = Global.SingboxLocalDNSTag; var remoteDns = ParseDnsAddress(simpleDNSItem.RemoteDNS); remoteDns.tag = Global.SingboxRemoteDNSTag; remoteDns.detour = Global.ProxyTag; - remoteDns.domain_resolver = Global.SingboxFinalResolverTag; - - var resolverDns = ParseDnsAddress(simpleDNSItem.SingboxOutboundsResolveDNS); - resolverDns.tag = Global.SingboxOutboundResolverTag; - resolverDns.domain_resolver = Global.SingboxFinalResolverTag; + remoteDns.domain_resolver = Global.SingboxLocalDNSTag; var hostsDns = new Server4Sbox { @@ -122,10 +108,6 @@ public partial class CoreConfigSingboxService { remoteDns.domain_resolver = Global.SingboxHostsDNSTag; } - if (resolverDns.server == host.Key) - { - resolverDns.domain_resolver = Global.SingboxHostsDNSTag; - } if (directDns.server == host.Key) { directDns.domain_resolver = Global.SingboxHostsDNSTag; @@ -136,7 +118,6 @@ public partial class CoreConfigSingboxService singboxConfig.dns.servers ??= new List(); singboxConfig.dns.servers.Add(remoteDns); singboxConfig.dns.servers.Add(directDns); - singboxConfig.dns.servers.Add(resolverDns); singboxConfig.dns.servers.Add(hostsDns); // fake ip @@ -157,8 +138,13 @@ public partial class CoreConfigSingboxService private async Task GenDnsDomains(SingboxConfig singboxConfig, SimpleDNSItem? simpleDNSItem) { - var finalDns = ParseDnsAddress(simpleDNSItem.SingboxFinalResolveDNS); - finalDns.tag = Global.SingboxFinalResolverTag; + var finalDnsAddress = "local"; + if (_config.TunModeItem.EnableTun) + { + finalDnsAddress = "dhcp://auto"; + } + var finalDns = ParseDnsAddress(finalDnsAddress); + finalDns.tag = Global.SingboxLocalDNSTag; singboxConfig.dns ??= new Dns4Sbox(); singboxConfig.dns.servers ??= new List(); singboxConfig.dns.servers.Add(finalDns); @@ -352,7 +338,7 @@ public partial class CoreConfigSingboxService await GenDnsDomainsLegacyCompatible(singboxConfig, item); } - await GenOutboundDnsRule(node, singboxConfig, Global.SingboxFinalResolverTag); + await GenOutboundDnsRule(node, singboxConfig); } catch (Exception ex) { @@ -361,16 +347,17 @@ public partial class CoreConfigSingboxService return 0; } - private async Task GenDnsDomainsCompatible(SingboxConfig singboxConfig, DNSItem? dNSItem) + private async Task GenDnsDomainsCompatible(SingboxConfig singboxConfig, DNSItem? dnsItem) { var dns4Sbox = singboxConfig.dns ?? new(); dns4Sbox.servers ??= []; dns4Sbox.rules ??= []; - var tag = Global.SingboxFinalResolverTag; - var localDnsAddress = string.IsNullOrEmpty(dNSItem?.DomainDNSAddress) ? Global.DomainPureIPDNSAddress.FirstOrDefault() : dNSItem?.DomainDNSAddress; + var tag = Global.SingboxLocalDNSTag; - var localDnsServer = ParseDnsAddress(localDnsAddress); + var finalDnsAddress = string.IsNullOrEmpty(dnsItem?.DomainDNSAddress) ? Global.DomainPureIPDNSAddress.FirstOrDefault() : dnsItem?.DomainDNSAddress; + + var localDnsServer = ParseDnsAddress(finalDnsAddress); localDnsServer.tag = tag; dns4Sbox.servers.Add(localDnsServer); @@ -379,19 +366,19 @@ public partial class CoreConfigSingboxService return await Task.FromResult(0); } - private async Task GenDnsDomainsLegacyCompatible(SingboxConfig singboxConfig, DNSItem? dNSItem) + private async Task GenDnsDomainsLegacyCompatible(SingboxConfig singboxConfig, DNSItem? dnsItem) { var dns4Sbox = singboxConfig.dns ?? new(); dns4Sbox.servers ??= []; dns4Sbox.rules ??= []; - var tag = Global.SingboxFinalResolverTag; + var tag = Global.SingboxLocalDNSTag; dns4Sbox.servers.Add(new() { tag = tag, - address = string.IsNullOrEmpty(dNSItem?.DomainDNSAddress) ? Global.DomainPureIPDNSAddress.FirstOrDefault() : dNSItem?.DomainDNSAddress, + address = string.IsNullOrEmpty(dnsItem?.DomainDNSAddress) ? Global.DomainPureIPDNSAddress.FirstOrDefault() : dnsItem?.DomainDNSAddress, detour = Global.DirectTag, - strategy = string.IsNullOrEmpty(dNSItem?.DomainStrategy4Freedom) ? null : dNSItem?.DomainStrategy4Freedom, + strategy = string.IsNullOrEmpty(dnsItem?.DomainStrategy4Freedom) ? null : dnsItem?.DomainStrategy4Freedom, }); dns4Sbox.rules.Insert(0, new() { @@ -422,7 +409,7 @@ public partial class CoreConfigSingboxService return await Task.FromResult(0); } - private async Task GenOutboundDnsRule(ProfileItem? node, SingboxConfig singboxConfig, string? server) + private async Task GenOutboundDnsRule(ProfileItem? node, SingboxConfig singboxConfig) { if (node == null) { @@ -449,7 +436,7 @@ public partial class CoreConfigSingboxService singboxConfig.dns.rules ??= new List(); singboxConfig.dns.rules.Insert(0, new Rule4Sbox { - server = server, + server = Global.SingboxLocalDNSTag, domain = domain, }); diff --git a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxRoutingService.cs b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxRoutingService.cs index 4855c7d6..9cd02204 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxRoutingService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxRoutingService.cs @@ -9,13 +9,13 @@ public partial class CoreConfigSingboxService singboxConfig.route.final = Global.ProxyTag; var item = _config.SimpleDNSItem; - var defaultDomainResolverTag = Global.SingboxOutboundResolverTag; + var defaultDomainResolverTag = Global.SingboxDirectDNSTag; var directDNSStrategy = item.SingboxStrategy4Direct.IsNullOrEmpty() ? Global.SingboxDomainStrategy4Out.FirstOrDefault() : item.SingboxStrategy4Direct; var rawDNSItem = await AppManager.Instance.GetDNSItem(ECoreType.sing_box); if (rawDNSItem != null && rawDNSItem.Enabled == true) { - defaultDomainResolverTag = Global.SingboxFinalResolverTag; + defaultDomainResolverTag = Global.SingboxLocalDNSTag; directDNSStrategy = rawDNSItem.DomainStrategy4Freedom.IsNullOrEmpty() ? Global.SingboxDomainStrategy4Out.FirstOrDefault() : rawDNSItem.DomainStrategy4Freedom; } singboxConfig.route.default_domain_resolver = new() diff --git a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayDnsService.cs b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayDnsService.cs index 59525135..99cda5b7 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayDnsService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayDnsService.cs @@ -354,7 +354,7 @@ public partial class CoreConfigV2rayService return 0; } - private async Task GenDnsDomainsCompatible(ProfileItem? node, JsonNode dns, DNSItem? dNSItem) + private async Task GenDnsDomainsCompatible(ProfileItem? node, JsonNode dns, DNSItem? dnsItem) { if (node == null) { @@ -393,7 +393,7 @@ public partial class CoreConfigV2rayService { var dnsServer = new DnsServer4Ray() { - address = string.IsNullOrEmpty(dNSItem?.DomainDNSAddress) ? Global.DomainPureIPDNSAddress.FirstOrDefault() : dNSItem?.DomainDNSAddress, + address = string.IsNullOrEmpty(dnsItem?.DomainDNSAddress) ? Global.DomainPureIPDNSAddress.FirstOrDefault() : dnsItem?.DomainDNSAddress, skipFallback = true, domains = domainList }; diff --git a/v2rayN/ServiceLib/ViewModels/DNSSettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/DNSSettingViewModel.cs index 4f996918..da21ab35 100644 --- a/v2rayN/ServiceLib/ViewModels/DNSSettingViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/DNSSettingViewModel.cs @@ -13,8 +13,6 @@ public class DNSSettingViewModel : MyReactiveObject [Reactive] public bool? BlockBindingQuery { get; set; } [Reactive] public string? DirectDNS { get; set; } [Reactive] public string? RemoteDNS { get; set; } - [Reactive] public string? SingboxOutboundsResolveDNS { get; set; } - [Reactive] public string? SingboxFinalResolveDNS { get; set; } [Reactive] public string? RayStrategy4Freedom { get; set; } [Reactive] public string? SingboxStrategy4Direct { get; set; } [Reactive] public string? SingboxStrategy4Proxy { get; set; } @@ -76,8 +74,6 @@ public class DNSSettingViewModel : MyReactiveObject DirectDNS = item.DirectDNS; RemoteDNS = item.RemoteDNS; RayStrategy4Freedom = item.RayStrategy4Freedom; - SingboxOutboundsResolveDNS = item.SingboxOutboundsResolveDNS; - SingboxFinalResolveDNS = item.SingboxFinalResolveDNS; SingboxStrategy4Direct = item.SingboxStrategy4Direct; SingboxStrategy4Proxy = item.SingboxStrategy4Proxy; Hosts = item.Hosts; @@ -107,8 +103,6 @@ public class DNSSettingViewModel : MyReactiveObject _config.SimpleDNSItem.DirectDNS = DirectDNS; _config.SimpleDNSItem.RemoteDNS = RemoteDNS; _config.SimpleDNSItem.RayStrategy4Freedom = RayStrategy4Freedom; - _config.SimpleDNSItem.SingboxOutboundsResolveDNS = SingboxOutboundsResolveDNS; - _config.SimpleDNSItem.SingboxFinalResolveDNS = SingboxFinalResolveDNS; _config.SimpleDNSItem.SingboxStrategy4Direct = SingboxStrategy4Direct; _config.SimpleDNSItem.SingboxStrategy4Proxy = SingboxStrategy4Proxy; _config.SimpleDNSItem.Hosts = Hosts; diff --git a/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml b/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml index adaaedb0..d15929eb 100644 --- a/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml +++ b/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml @@ -76,100 +76,65 @@ Width="300" Margin="{StaticResource Margin4}" IsEditable="True" /> - - - - - - - + Text="{x:Static resx:ResUI.TbXrayFreedomStrategy}" /> @@ -290,7 +255,7 @@ - + @@ -378,7 +343,7 @@ - + diff --git a/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml.cs index ec3ad883..2a472e30 100644 --- a/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/DNSSettingWindow.axaml.cs @@ -24,9 +24,7 @@ public partial class DNSSettingWindow : WindowBase cmbSBDirectDNSStrategy.ItemsSource = Global.SingboxDomainStrategy4Out; cmbSBRemoteDNSStrategy.ItemsSource = Global.SingboxDomainStrategy4Out; cmbDirectDNS.ItemsSource = Global.DomainDirectDNSAddress; - cmbSBResolverDNS.ItemsSource = Global.DomainDirectDNSAddress.Concat(new[] { "dhcp://auto,localhost" }); cmbRemoteDNS.ItemsSource = Global.DomainRemoteDNSAddress; - cmbSBFinalResolverDNS.ItemsSource = Global.DomainPureIPDNSAddress.Concat(new[] { "dhcp://auto,localhost" }); cmbDirectExpectedIPs.ItemsSource = Global.ExpectedIPs; cmbdomainStrategy4FreedomCompatible.ItemsSource = Global.DomainStrategy4Freedoms; @@ -42,8 +40,6 @@ public partial class DNSSettingWindow : WindowBase this.Bind(ViewModel, vm => vm.BlockBindingQuery, v => v.togBlockBindingQuery.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.DirectDNS, v => v.cmbDirectDNS.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.RemoteDNS, v => v.cmbRemoteDNS.Text).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.SingboxOutboundsResolveDNS, v => v.cmbSBResolverDNS.Text).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.SingboxFinalResolveDNS, v => v.cmbSBFinalResolverDNS.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.RayStrategy4Freedom, v => v.cmbRayFreedomDNSStrategy.SelectedItem).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SingboxStrategy4Direct, v => v.cmbSBDirectDNSStrategy.SelectedItem).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SingboxStrategy4Proxy, v => v.cmbSBRemoteDNSStrategy.SelectedItem).DisposeWith(disposables); diff --git a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml index cb719494..733f5a97 100644 --- a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml +++ b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml @@ -100,65 +100,25 @@ Margin="{StaticResource Margin8}" IsEditable="True" Style="{StaticResource DefComboBox}" /> - - - - - - - + Text="{x:Static resx:ResUI.TbXrayFreedomStrategy}" /> @@ -348,7 +308,7 @@ - + @@ -445,7 +405,7 @@ - + diff --git a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs index d72e98bb..00c7d0fb 100644 --- a/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/DNSSettingWindow.xaml.cs @@ -22,9 +22,7 @@ public partial class DNSSettingWindow cmbSBDirectDNSStrategy.ItemsSource = Global.SingboxDomainStrategy4Out; cmbSBRemoteDNSStrategy.ItemsSource = Global.SingboxDomainStrategy4Out; cmbDirectDNS.ItemsSource = Global.DomainDirectDNSAddress; - cmbSBResolverDNS.ItemsSource = Global.DomainDirectDNSAddress.Concat(new[] { "dhcp://auto,localhost" }); cmbRemoteDNS.ItemsSource = Global.DomainRemoteDNSAddress; - cmbSBFinalResolverDNS.ItemsSource = Global.DomainPureIPDNSAddress.Concat(new[] { "dhcp://auto,localhost" }); cmbDirectExpectedIPs.ItemsSource = Global.ExpectedIPs; cmbdomainStrategy4FreedomCompatible.ItemsSource = Global.DomainStrategy4Freedoms; @@ -40,8 +38,6 @@ public partial class DNSSettingWindow this.Bind(ViewModel, vm => vm.BlockBindingQuery, v => v.togBlockBindingQuery.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.DirectDNS, v => v.cmbDirectDNS.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.RemoteDNS, v => v.cmbRemoteDNS.Text).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.SingboxOutboundsResolveDNS, v => v.cmbSBResolverDNS.Text).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.SingboxFinalResolveDNS, v => v.cmbSBFinalResolverDNS.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.RayStrategy4Freedom, v => v.cmbRayFreedomDNSStrategy.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SingboxStrategy4Direct, v => v.cmbSBDirectDNSStrategy.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SingboxStrategy4Proxy, v => v.cmbSBRemoteDNSStrategy.Text).DisposeWith(disposables);