Add HappyEyeballs (#9772)

* Add HappyEyeballs

* Clean up the code

* Fix
This commit is contained in:
DHR60
2026-07-17 09:12:50 +08:00
committed by GitHub
parent d9dc2d7cf5
commit 4584ecc5c9
13 changed files with 164 additions and 45 deletions
@@ -4,20 +4,21 @@ public class DNSSettingViewModel : MyReactiveObject, ICloseable
{
public event EventHandler? RequestClose;
[Reactive] public bool? UseSystemHosts { get; set; }
[Reactive] public bool? AddCommonHosts { get; set; }
[Reactive] public bool? FakeIP { get; set; }
[Reactive] public bool? BlockBindingQuery { get; set; }
[Reactive] public string? DirectDNS { get; set; }
[Reactive] public string? RemoteDNS { get; set; }
[Reactive] public string? BootstrapDNS { get; set; }
[Reactive] public string? Strategy4Freedom { get; set; }
[Reactive] public string? Strategy4Proxy { get; set; }
[Reactive] public string? Strategy4ProxyDial { get; set; }
[Reactive] public string? Hosts { get; set; }
[Reactive] public string? DirectExpectedIPs { get; set; }
[Reactive] public bool? ParallelQuery { get; set; }
[Reactive] public bool? ServeStale { get; set; }
[Reactive] public bool UseSystemHosts { get; set; }
[Reactive] public bool AddCommonHosts { get; set; }
[Reactive] public bool FakeIP { get; set; }
[Reactive] public bool BlockBindingQuery { get; set; }
[Reactive] public string DirectDNS { get; set; }
[Reactive] public string RemoteDNS { get; set; }
[Reactive] public string BootstrapDNS { get; set; }
[Reactive] public string Strategy4Freedom { get; set; }
[Reactive] public string Strategy4Proxy { get; set; }
[Reactive] public string Strategy4ProxyDial { get; set; }
[Reactive] public string Hosts { get; set; }
[Reactive] public string DirectExpectedIPs { get; set; }
[Reactive] public bool ParallelQuery { get; set; }
[Reactive] public bool ServeStale { get; set; }
[Reactive] public bool EnableHappyEyeballs { get; set; }
[Reactive] public bool UseSystemHostsCompatible { get; set; }
[Reactive] public string DomainStrategy4FreedomCompatible { get; set; } = string.Empty;
@@ -68,21 +69,21 @@ public class DNSSettingViewModel : MyReactiveObject, ICloseable
{
_config = AppManager.Instance.Config;
var item = _config.SimpleDNSItem;
UseSystemHosts = item.UseSystemHosts;
AddCommonHosts = item.AddCommonHosts;
FakeIP = item.FakeIP;
BlockBindingQuery = item.BlockBindingQuery;
DirectDNS = item.DirectDNS;
RemoteDNS = item.RemoteDNS;
BootstrapDNS = item.BootstrapDNS;
Strategy4Freedom = item.Strategy4Freedom;
Strategy4Proxy = item.Strategy4Proxy;
Strategy4ProxyDial = item.Strategy4ProxyDial;
Hosts = item.Hosts;
DirectExpectedIPs = item.DirectExpectedIPs;
ParallelQuery = item.ParallelQuery;
ServeStale = item.ServeStale;
UseSystemHosts = item.UseSystemHosts ?? false;
AddCommonHosts = item.AddCommonHosts ?? false;
FakeIP = item.FakeIP ?? false;
BlockBindingQuery = item.BlockBindingQuery ?? false;
DirectDNS = item.DirectDNS ?? string.Empty;
RemoteDNS = item.RemoteDNS ?? string.Empty;
BootstrapDNS = item.BootstrapDNS ?? string.Empty;
Strategy4Freedom = item.Strategy4Freedom ?? string.Empty;
Strategy4Proxy = item.Strategy4Proxy ?? string.Empty;
Strategy4ProxyDial = item.Strategy4ProxyDial ?? string.Empty;
Hosts = item.Hosts ?? string.Empty;
DirectExpectedIPs = item.DirectExpectedIPs ?? string.Empty;
ParallelQuery = item.ParallelQuery ?? false;
ServeStale = item.ServeStale ?? false;
EnableHappyEyeballs = item.EnableHappyEyeballs ?? false;
var item1 = await AppManager.Instance.GetDNSItem(ECoreType.Xray);
RayCustomDNSEnableCompatible = item1.Enabled;
UseSystemHostsCompatible = item1.UseSystemHosts;
@@ -115,7 +116,7 @@ public class DNSSettingViewModel : MyReactiveObject, ICloseable
_config.SimpleDNSItem.DirectExpectedIPs = DirectExpectedIPs;
_config.SimpleDNSItem.ParallelQuery = ParallelQuery;
_config.SimpleDNSItem.ServeStale = ServeStale;
_config.SimpleDNSItem.EnableHappyEyeballs = EnableHappyEyeballs;
if (NormalDNSCompatible.IsNotEmpty())
{
var obj = JsonUtils.ParseJson(NormalDNSCompatible);