mirror of
https://github.com/2dust/v2rayN.git
synced 2025-08-23 11:26:54 +00:00
Fix dns
This commit is contained in:
parent
e104f9f9b2
commit
7caddc573c
1 changed files with 21 additions and 20 deletions
|
@ -67,6 +67,9 @@ public partial class CoreConfigSingboxService
|
||||||
{
|
{
|
||||||
hostsDns.predefined = Global.PredefinedHosts;
|
hostsDns.predefined = Global.PredefinedHosts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!simpleDNSItem.Hosts.IsNullOrEmpty())
|
||||||
|
{
|
||||||
var userHostsMap = simpleDNSItem.Hosts?
|
var userHostsMap = simpleDNSItem.Hosts?
|
||||||
.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries)
|
.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries)
|
||||||
.Where(line => !string.IsNullOrWhiteSpace(line))
|
.Where(line => !string.IsNullOrWhiteSpace(line))
|
||||||
|
@ -83,10 +86,8 @@ public partial class CoreConfigSingboxService
|
||||||
var values = parts.Skip(1).ToList();
|
var values = parts.Skip(1).ToList();
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
);
|
) ?? new Dictionary<string, List<string>>();
|
||||||
|
|
||||||
if (userHostsMap != null)
|
|
||||||
{
|
|
||||||
foreach (var kvp in userHostsMap)
|
foreach (var kvp in userHostsMap)
|
||||||
{
|
{
|
||||||
hostsDns.predefined[kvp.Key] = kvp.Value;
|
hostsDns.predefined[kvp.Key] = kvp.Value;
|
||||||
|
@ -100,11 +101,11 @@ public partial class CoreConfigSingboxService
|
||||||
{
|
{
|
||||||
foreach (var host in systemHosts)
|
foreach (var host in systemHosts)
|
||||||
{
|
{
|
||||||
if (userHostsMap[host.Key] != null)
|
if (hostsDns.predefined[host.Key] != null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
userHostsMap[host.Key] = new List<string> { host.Value };
|
hostsDns.predefined[host.Key] = new List<string> { host.Value };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue