mirror of
https://github.com/2dust/v2rayN.git
synced 2025-10-14 20:39:12 +00:00
Fix node domain resolve in TUN mode
This commit is contained in:
parent
403b0bcf12
commit
bc90eb7eba
1 changed files with 40 additions and 12 deletions
|
@ -44,14 +44,28 @@ public partial class CoreConfigSingboxService
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tun2SocksAddress
|
// Tun2SocksAddress
|
||||||
if (node != null && Utils.IsDomain(node.Address))
|
if (node != null)
|
||||||
{
|
{
|
||||||
singboxConfig.dns.rules ??= new List<Rule4Sbox>();
|
string? domainToAdd = null;
|
||||||
singboxConfig.dns.rules.Insert(0, new Rule4Sbox
|
|
||||||
|
if (Utils.IsDomain(node.Address))
|
||||||
{
|
{
|
||||||
server = Global.SingboxOutboundResolverTag,
|
domainToAdd = node.Address;
|
||||||
domain = [node.Address],
|
}
|
||||||
});
|
else if (node.Sni != null && Utils.IsDomain(node.Sni))
|
||||||
|
{
|
||||||
|
domainToAdd = node.Sni;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (domainToAdd != null)
|
||||||
|
{
|
||||||
|
singboxConfig.dns.rules ??= new List<Rule4Sbox>();
|
||||||
|
singboxConfig.dns.rules.Insert(0, new Rule4Sbox
|
||||||
|
{
|
||||||
|
server = Global.SingboxDirectDNSTag,
|
||||||
|
domain = [domainToAdd],
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -347,14 +361,28 @@ public partial class CoreConfigSingboxService
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tun2SocksAddress
|
// Tun2SocksAddress
|
||||||
if (node != null && Utils.IsDomain(node.Address))
|
if (node != null)
|
||||||
{
|
{
|
||||||
singboxConfig.dns.rules ??= new List<Rule4Sbox>();
|
string? domainToAdd = null;
|
||||||
singboxConfig.dns.rules.Insert(0, new Rule4Sbox
|
|
||||||
|
if (Utils.IsDomain(node.Address))
|
||||||
{
|
{
|
||||||
server = Global.SingboxFinalResolverTag,
|
domainToAdd = node.Address;
|
||||||
domain = [node.Address],
|
}
|
||||||
});
|
else if (node.Sni != null && Utils.IsDomain(node.Sni))
|
||||||
|
{
|
||||||
|
domainToAdd = node.Sni;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (domainToAdd != null)
|
||||||
|
{
|
||||||
|
singboxConfig.dns.rules ??= new List<Rule4Sbox>();
|
||||||
|
singboxConfig.dns.rules.Insert(0, new Rule4Sbox
|
||||||
|
{
|
||||||
|
server = Global.SingboxDirectDNSTag,
|
||||||
|
domain = [domainToAdd],
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
Loading…
Reference in a new issue