mirror of https://github.com/2dust/v2rayN
parent
ef30d389dc
commit
3a21596d95
|
@ -598,6 +598,7 @@ public class Global
|
||||||
{ "cloudflare-dns.com", new List<string> { "104.16.249.249", "104.16.248.249", "2606:4700::6810:f8f9", "2606:4700::6810:f9f9" } },
|
{ "cloudflare-dns.com", new List<string> { "104.16.249.249", "104.16.248.249", "2606:4700::6810:f8f9", "2606:4700::6810:f9f9" } },
|
||||||
{ "dns.cloudflare.com", new List<string> { "104.16.132.229", "104.16.133.229", "2606:4700::6810:84e5", "2606:4700::6810:85e5" } },
|
{ "dns.cloudflare.com", new List<string> { "104.16.132.229", "104.16.133.229", "2606:4700::6810:84e5", "2606:4700::6810:85e5" } },
|
||||||
{ "dot.pub", new List<string> { "1.12.12.12", "120.53.53.53" } },
|
{ "dot.pub", new List<string> { "1.12.12.12", "120.53.53.53" } },
|
||||||
|
{ "doh.pub", new List<string> { "1.12.12.12", "120.53.53.53" } },
|
||||||
{ "dns.quad9.net", new List<string> { "9.9.9.9", "149.112.112.112", "2620:fe::fe", "2620:fe::9" } },
|
{ "dns.quad9.net", new List<string> { "9.9.9.9", "149.112.112.112", "2620:fe::fe", "2620:fe::9" } },
|
||||||
{ "dns.yandex.net", new List<string> { "77.88.8.8", "77.88.8.1", "2a02:6b8::feed:0ff", "2a02:6b8:0:1::feed:0ff" } },
|
{ "dns.yandex.net", new List<string> { "77.88.8.8", "77.88.8.1", "2a02:6b8::feed:0ff", "2a02:6b8:0:1::feed:0ff" } },
|
||||||
{ "dns.sb", new List<string> { "185.222.222.222", "2a09::" } },
|
{ "dns.sb", new List<string> { "185.222.222.222", "2a09::" } },
|
||||||
|
|
|
@ -1214,11 +1214,11 @@ public static class ConfigHandler
|
||||||
CoreType = ECoreType.sing_box,
|
CoreType = ECoreType.sing_box,
|
||||||
ConfigType = EConfigType.SOCKS,
|
ConfigType = EConfigType.SOCKS,
|
||||||
Address = Global.Loopback,
|
Address = Global.Loopback,
|
||||||
Sni = node.Address, //Tun2SocksAddress
|
SpiderX = node.Address, // Tun2SocksAddress
|
||||||
Port = AppManager.Instance.GetLocalPort(EInboundProtocol.socks)
|
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;
|
var preCoreType = config.RunningCoreType = config.TunModeItem.EnableTun ? ECoreType.sing_box : ECoreType.Xray;
|
||||||
itemSocks = new ProfileItem()
|
itemSocks = new ProfileItem()
|
||||||
|
|
|
@ -43,16 +43,7 @@ public partial class CoreConfigSingboxService
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tun2SocksAddress
|
await GenOutboundDnsRule(node, singboxConfig, Global.SingboxOutboundResolverTag);
|
||||||
if (node != null && Utils.IsDomain(node.Address))
|
|
||||||
{
|
|
||||||
singboxConfig.dns.rules ??= new List<Rule4Sbox>();
|
|
||||||
singboxConfig.dns.rules.Insert(0, new Rule4Sbox
|
|
||||||
{
|
|
||||||
server = Global.SingboxOutboundResolverTag,
|
|
||||||
domain = [node.Address],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -346,16 +337,7 @@ public partial class CoreConfigSingboxService
|
||||||
await GenDnsDomainsLegacyCompatible(singboxConfig, item);
|
await GenDnsDomainsLegacyCompatible(singboxConfig, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tun2SocksAddress
|
await GenOutboundDnsRule(node, singboxConfig, Global.SingboxFinalResolverTag);
|
||||||
if (node != null && Utils.IsDomain(node.Address))
|
|
||||||
{
|
|
||||||
singboxConfig.dns.rules ??= new List<Rule4Sbox>();
|
|
||||||
singboxConfig.dns.rules.Insert(0, new Rule4Sbox
|
|
||||||
{
|
|
||||||
server = Global.SingboxFinalResolverTag,
|
|
||||||
domain = [node.Address],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -425,6 +407,37 @@ public partial class CoreConfigSingboxService
|
||||||
return await Task.FromResult(0);
|
return await Task.FromResult(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task<int> 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<Rule4Sbox>();
|
||||||
|
singboxConfig.dns.rules.Insert(0, new Rule4Sbox
|
||||||
|
{
|
||||||
|
server = server,
|
||||||
|
domain = [domain],
|
||||||
|
});
|
||||||
|
|
||||||
|
return await Task.FromResult(0);
|
||||||
|
}
|
||||||
|
|
||||||
private static Server4Sbox? ParseDnsAddress(string address)
|
private static Server4Sbox? ParseDnsAddress(string address)
|
||||||
{
|
{
|
||||||
var addressFirst = address?.Split(address.Contains(',') ? ',' : ';').FirstOrDefault()?.Trim();
|
var addressFirst = address?.Split(address.Contains(',') ? ',' : ';').FirstOrDefault()?.Trim();
|
||||||
|
|
|
@ -32,8 +32,8 @@ public class QRCodeUtils
|
||||||
{
|
{
|
||||||
GetDpi(window, out var dpiX, out var dpiY);
|
GetDpi(window, out var dpiX, out var dpiY);
|
||||||
|
|
||||||
var left = (int)(SystemParameters.WorkArea.Left);
|
var left = (int)SystemParameters.WorkArea.Left;
|
||||||
var top = (int)(SystemParameters.WorkArea.Top);
|
var top = (int)SystemParameters.WorkArea.Top;
|
||||||
var width = (int)(SystemParameters.WorkArea.Width / dpiX);
|
var width = (int)(SystemParameters.WorkArea.Width / dpiX);
|
||||||
var height = (int)(SystemParameters.WorkArea.Height / dpiY);
|
var height = (int)(SystemParameters.WorkArea.Height / dpiY);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue