diff --git a/v2rayN/ServiceLib/Global.cs b/v2rayN/ServiceLib/Global.cs index eb24d71e..b45a6eb3 100644 --- a/v2rayN/ServiceLib/Global.cs +++ b/v2rayN/ServiceLib/Global.cs @@ -598,6 +598,7 @@ public class Global { "cloudflare-dns.com", new List { "104.16.249.249", "104.16.248.249", "2606:4700::6810:f8f9", "2606:4700::6810:f9f9" } }, { "dns.cloudflare.com", new List { "104.16.132.229", "104.16.133.229", "2606:4700::6810:84e5", "2606:4700::6810:85e5" } }, { "dot.pub", new List { "1.12.12.12", "120.53.53.53" } }, + { "doh.pub", new List { "1.12.12.12", "120.53.53.53" } }, { "dns.quad9.net", new List { "9.9.9.9", "149.112.112.112", "2620:fe::fe", "2620:fe::9" } }, { "dns.yandex.net", new List { "77.88.8.8", "77.88.8.1", "2a02:6b8::feed:0ff", "2a02:6b8:0:1::feed:0ff" } }, { "dns.sb", new List { "185.222.222.222", "2a09::" } }, diff --git a/v2rayN/ServiceLib/Handler/ConfigHandler.cs b/v2rayN/ServiceLib/Handler/ConfigHandler.cs index 786f3aff..65f2ee53 100644 --- a/v2rayN/ServiceLib/Handler/ConfigHandler.cs +++ b/v2rayN/ServiceLib/Handler/ConfigHandler.cs @@ -1214,11 +1214,11 @@ public static class ConfigHandler CoreType = ECoreType.sing_box, ConfigType = EConfigType.SOCKS, Address = Global.Loopback, - Sni = node.Address, //Tun2SocksAddress + SpiderX = node.Address, // Tun2SocksAddress Port = AppManager.Instance.GetLocalPort(EInboundProtocol.socks) }; } - else if ((node.ConfigType == EConfigType.Custom && node.PreSocksPort > 0)) + else if (node.ConfigType == EConfigType.Custom && node.PreSocksPort > 0) { var preCoreType = config.RunningCoreType = config.TunModeItem.EnableTun ? ECoreType.sing_box : ECoreType.Xray; itemSocks = new ProfileItem() diff --git a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxDnsService.cs b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxDnsService.cs index 00bb14d9..9bd2502d 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxDnsService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/Singbox/SingboxDnsService.cs @@ -43,16 +43,7 @@ public partial class CoreConfigSingboxService }); } - // Tun2SocksAddress - if (node != null && Utils.IsDomain(node.Address)) - { - singboxConfig.dns.rules ??= new List(); - singboxConfig.dns.rules.Insert(0, new Rule4Sbox - { - server = Global.SingboxOutboundResolverTag, - domain = [node.Address], - }); - } + await GenOutboundDnsRule(node, singboxConfig, Global.SingboxOutboundResolverTag); } catch (Exception ex) { @@ -346,16 +337,7 @@ public partial class CoreConfigSingboxService await GenDnsDomainsLegacyCompatible(singboxConfig, item); } - // Tun2SocksAddress - if (node != null && Utils.IsDomain(node.Address)) - { - singboxConfig.dns.rules ??= new List(); - singboxConfig.dns.rules.Insert(0, new Rule4Sbox - { - server = Global.SingboxFinalResolverTag, - domain = [node.Address], - }); - } + await GenOutboundDnsRule(node, singboxConfig, Global.SingboxFinalResolverTag); } catch (Exception ex) { @@ -425,6 +407,37 @@ public partial class CoreConfigSingboxService return await Task.FromResult(0); } + private async Task GenOutboundDnsRule(ProfileItem? node, SingboxConfig singboxConfig, string? server) + { + if (node == null) + { + return 0; + } + + var domain = string.Empty; + if (Utils.IsDomain(node.Address)) // normal outbound + { + domain = node.Address; + } + else if (node.Address == Global.Loopback && node.SpiderX.IsNotEmpty() && Utils.IsDomain(node.SpiderX)) // Tun2SocksAddress + { + domain = node.SpiderX; + } + if (domain.IsNullOrEmpty()) + { + return 0; + } + + singboxConfig.dns.rules ??= new List(); + singboxConfig.dns.rules.Insert(0, new Rule4Sbox + { + server = server, + domain = [domain], + }); + + return await Task.FromResult(0); + } + private static Server4Sbox? ParseDnsAddress(string address) { var addressFirst = address?.Split(address.Contains(',') ? ',' : ';').FirstOrDefault()?.Trim(); diff --git a/v2rayN/v2rayN/Common/QRCodeUtils.cs b/v2rayN/v2rayN/Common/QRCodeUtils.cs index 3013e45f..ef98aca8 100644 --- a/v2rayN/v2rayN/Common/QRCodeUtils.cs +++ b/v2rayN/v2rayN/Common/QRCodeUtils.cs @@ -32,8 +32,8 @@ public class QRCodeUtils { GetDpi(window, out var dpiX, out var dpiY); - var left = (int)(SystemParameters.WorkArea.Left); - var top = (int)(SystemParameters.WorkArea.Top); + var left = (int)SystemParameters.WorkArea.Left; + var top = (int)SystemParameters.WorkArea.Top; var width = (int)(SystemParameters.WorkArea.Width / dpiX); var height = (int)(SystemParameters.WorkArea.Height / dpiY);