Skip to content

Commit 5348059

Browse files
committed
Update
1 parent 3f33a11 commit 5348059

20 files changed

+137
-328
lines changed

XboxDownload/Models/AppSettings.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ public class AppSettings
1717
public string NsIp { get; set; } = string.Empty;
1818
public string EaIp { get; set; } = string.Empty;
1919
public string BattleIp { get; set; } = string.Empty;
20-
public string EpicIp { get; set; } = string.Empty;
2120
public bool IsXboxGameDownloadLinksShown { get; set; } = true;
2221
public bool IsLocalUploadEnabled { get; set; }
2322
public string LocalUploadPath { get; set; } = string.Empty;

XboxDownload/Resources/Akamai.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@ s7mbrstream.scene7.com # Game trailers
1111
*.hac.lp1.d4c.nintendo.net # System updates, Content Servers (Switch 1)
1212

1313
####################### Epic #######################
14-
*.ak.epicgames.com
14+
epicgames-download1.akamaized.net
1515
cdn1.epicgames.com
1616
cdn2.epicgames.com
17-
shared-static-prod.epicgames.com
1817

1918
################## Ubisoft Connect ##################
2019
*.cdn.ubi.com

XboxDownload/Resources/Languages/en-US.axaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
<x:String x:Key="Service.Settings.NsDlIp">NS DL IP</x:String>
7272
<x:String x:Key="Service.Settings.EaDlIp">EA DL IP</x:String>
7373
<x:String x:Key="Service.Settings.BattleDlIp">Battle.net DL IP</x:String>
74-
<x:String x:Key="Service.Settings.EpicDlIp">Epic DL IP</x:String>
7574
<x:String x:Key="Service.Settings.LocalUpload">Local Upload</x:String>
7675
<x:String x:Key="Service.Settings.Browse">Browse</x:String>
7776
<x:String x:Key="Service.Settings.SelectFolder">Select Folder</x:String>
@@ -124,7 +123,6 @@
124123
<x:String x:Key="Service.Service.InvalidNsIpMessage">Please enter a valid IP address for the NS download server.</x:String>
125124
<x:String x:Key="Service.Service.InvalidEaIpMessage">Please enter a valid IP address for the EA download server.</x:String>
126125
<x:String x:Key="Service.Service.InvalidBattleIpMessage">Please enter a valid IP address for the Battle.net download server.</x:String>
127-
<x:String x:Key="Service.Service.InvalidEpicIpMessage">Please enter a valid IP address for the Epic download server.</x:String>
128126
<x:String x:Key="Service.Service.PortConflict">Port Conflict</x:String>
129127
<x:String x:Key="Service.Service.PortConflictMessage">The following ports are currently in use:&#x0a;{0}&#x0a;Do you want to try forcibly terminating the occupying processes?</x:String>
130128
<x:String x:Key="Service.Service.ServiceEnableFailedDialogTitle">Failed to Enable the Service</x:String>
@@ -223,7 +221,6 @@
223221
<x:String x:Key="SpeedTest.MenuItem.CustomIpForNs">Custom IP for Nintendo Switch</x:String>
224222
<x:String x:Key="SpeedTest.MenuItem.CustomIpForEa">Custom IP for EA</x:String>
225223
<x:String x:Key="SpeedTest.MenuItem.CustomIpForBattle">Custom IP for Battle.net</x:String>
226-
<x:String x:Key="SpeedTest.MenuItem.CustomIpForEpic">Custom IP for Epic Games</x:String>
227224
<x:String x:Key="SpeedTest.MenuItem.CustomIpForAkamaiCdn">Custom IP for Akamai CDN</x:String>
228225
<x:String x:Key="SpeedTest.MenuItem.WriteToSystemHostsFile">Write to System hosts file (not for beginners)</x:String>
229226
<x:String x:Key="SpeedTest.MenuItem.WriteToSystemHostsFileSuccessful">Write Successful</x:String>

XboxDownload/Resources/Languages/zh-Hans.axaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
<x:String x:Key="Service.Settings.NsDlIp">NS 下载 IP</x:String>
7272
<x:String x:Key="Service.Settings.EaDlIp">EA 下载 IP</x:String>
7373
<x:String x:Key="Service.Settings.BattleDlIp">战网 下载 IP</x:String>
74-
<x:String x:Key="Service.Settings.EpicDlIp">Epic 下载 IP</x:String>
7574
<x:String x:Key="Service.Settings.LocalUpload">本地上传</x:String>
7675
<x:String x:Key="Service.Settings.Browse">浏览</x:String>
7776
<x:String x:Key="Service.Settings.SelectFolder">选择文件夹</x:String>
@@ -124,7 +123,6 @@
124123
<x:String x:Key="Service.Service.InvalidNsIpMessage">输入的 NS 下载 IP 地址不合法。</x:String>
125124
<x:String x:Key="Service.Service.InvalidEaIpMessage">输入的 EA 下载 IP 地址不合法。</x:String>
126125
<x:String x:Key="Service.Service.InvalidBattleIpMessage">输入的 战网 下载 IP 地址不合法。</x:String>
127-
<x:String x:Key="Service.Service.InvalidEpicIpMessage">输入的 Epic 下载 IP 地址不合法。</x:String>
128126
<x:String x:Key="Service.Service.PortConflict">端口占用</x:String>
129127
<x:String x:Key="Service.Service.PortConflictMessage">以下端口被占用:&#x0a;{0}&#x0a;是否尝试强制结束这些进程?</x:String>
130128
<x:String x:Key="Service.Service.ServiceEnableFailedDialogTitle">启用服务失败</x:String>
@@ -223,7 +221,6 @@
223221
<x:String x:Key="SpeedTest.MenuItem.CustomIpForNs">指定 Nintendo Switch 下载 IP</x:String>
224222
<x:String x:Key="SpeedTest.MenuItem.CustomIpForEa">指定 EA 下载 IP</x:String>
225223
<x:String x:Key="SpeedTest.MenuItem.CustomIpForBattle">指定 Battle.net 下载 IP</x:String>
226-
<x:String x:Key="SpeedTest.MenuItem.CustomIpForEpic">指定 Epic Games 下载 IP</x:String>
227224
<x:String x:Key="SpeedTest.MenuItem.CustomIpForAkamaiCdn">指定 Akamai CDN IP</x:String>
228225
<x:String x:Key="SpeedTest.MenuItem.WriteToSystemHostsFile">写入系统 hosts 文件(可选操作,普通用户建议跳过)</x:String>
229226
<x:String x:Key="SpeedTest.MenuItem.WriteToSystemHostsFileSuccessful">写入成功</x:String>

XboxDownload/Resources/Languages/zh-Hant.axaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
<x:String x:Key="Service.Settings.NsDlIp">NS 下載 IP</x:String>
7272
<x:String x:Key="Service.Settings.EaDlIp">EA 下載 IP</x:String>
7373
<x:String x:Key="Service.Settings.BattleDlIp">戰網 下載 IP</x:String>
74-
<x:String x:Key="Service.Settings.EpicDlIp">Epic 下載 IP</x:String>
7574
<x:String x:Key="Service.Settings.LocalUpload">本地上傳</x:String>
7675
<x:String x:Key="Service.Settings.Browse">瀏覽</x:String>
7776
<x:String x:Key="Service.Settings.SelectFolder">選擇資料夾</x:String>
@@ -124,7 +123,6 @@
124123
<x:String x:Key="Service.Service.InvalidNsIpMessage">輸入的 NS 下載 IP 位址不合法。</x:String>
125124
<x:String x:Key="Service.Service.InvalidEaIpMessage">輸入的 EA 下載 IP 位址不合法。</x:String>
126125
<x:String x:Key="Service.Service.InvalidBattleIpMessage">輸入的 戰網 下載 IP 位址不合法。</x:String>
127-
<x:String x:Key="Service.Service.InvalidEpicIpMessage">輸入的 Epic 下載 IP 位址不合法。</x:String>
128126
<x:String x:Key="Service.Service.PortConflict">埠佔用</x:String>
129127
<x:String x:Key="Service.Service.PortConflictMessage">以下埠被佔用:&#x0a;{0}&#x0a;是否嘗試強制結束這些進程?</x:String>
130128
<x:String x:Key="Service.Service.ServiceEnableFailedDialogTitle">啟用服務失敗</x:String>
@@ -223,7 +221,6 @@
223221
<x:String x:Key="SpeedTest.MenuItem.CustomIpForNs">指定 Nintendo Switch 下載 IP</x:String>
224222
<x:String x:Key="SpeedTest.MenuItem.CustomIpForEa">指定 EA 下載 IP</x:String>
225223
<x:String x:Key="SpeedTest.MenuItem.CustomIpForBattle">指定 Battle.net 下載 IP</x:String>
226-
<x:String x:Key="SpeedTest.MenuItem.CustomIpForEpic">指定 Epic Games 下載 IP</x:String>
227224
<x:String x:Key="SpeedTest.MenuItem.CustomIpForAkamaiCdn">指定 Akamai CDN IP</x:String>
228225
<x:String x:Key="SpeedTest.MenuItem.WriteToSystemHostsFile">寫入系統 hosts 檔(可選操作,普通用戶建議跳過)</x:String>
229226
<x:String x:Key="SpeedTest.MenuItem.WriteToSystemHostsFileSuccessful">寫入成功</x:String>

XboxDownload/Services/DnsConnectionListener.cs

Lines changed: 20 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -349,15 +349,7 @@ public void ApplyAkamaiIpOverride(string? akamaiIp = null)
349349
Ipv4ServiceMapBackup.TryAdd(hostsMap.Key, v4);
350350
}
351351

352-
// Use local IP record for EpicCn, override with specified IP otherwise
353-
if (hostsMap.Value == "EpicCn")
354-
{
355-
Ipv4ServiceMap.AddOrUpdate(hostsMap.Key, _localIpRecords!, (_, _) => _localIpRecords!);
356-
}
357-
else
358-
{
359-
Ipv4ServiceMap.AddOrUpdate(hostsMap.Key, ipRecords, (_, _) => ipRecords);
360-
}
352+
Ipv4ServiceMap.AddOrUpdate(hostsMap.Key, ipRecords, (_, _) => ipRecords);
361353

362354
// Backup current IPv6 mapping if exists
363355
if (Ipv6ServiceMap.TryGetValue(hostsMap.Key, out var v6))
@@ -416,7 +408,7 @@ public async Task<string> StartAsync()
416408
var localIpBytes = localIpAddr.GetAddressBytes();
417409
_localIpRecords = [new ResourceRecord { Data = localIpBytes, TTL = 100, QueryClass = 1, QueryType = QueryType.A }];
418410

419-
byte[]? xboxGlobalIp = null, xboxCn1Ip = null, xboxCn2Ip = null, xboxAppIp = null, psIp = null, nsIp = null, eaIp = null, battleIp = null, epicIp = null;
411+
byte[]? xboxGlobalIp = null, xboxCn1Ip = null, xboxCn2Ip = null, xboxAppIp = null, psIp = null, nsIp = null, eaIp = null, battleIp = null;
420412
var ipMap = new List<(string host, Func<string?> get, Action<string> set, Action<byte[]?> setBytes)>
421413
{
422414
("assets2.xboxlive.cn", () => serviceViewModel.XboxCn1Ip, val => serviceViewModel.XboxCn1Ip = val, val => xboxCn1Ip = val),
@@ -425,9 +417,7 @@ public async Task<string> StartAsync()
425417
("gst.prod.dl.playstation.net", () => serviceViewModel.PsIp, val => serviceViewModel.PsIp = val, val => psIp = val),
426418
("atum.hac.lp1.d4c.nintendo.net", () => serviceViewModel.NsIp, val => serviceViewModel.NsIp = val, val => nsIp = val),
427419
("origin-a.akamaihd.net", () => serviceViewModel.EaIp, val => serviceViewModel.EaIp = val, val => eaIp = val),
428-
("blzddist1-a.akamaihd.net", () => serviceViewModel.BattleIp, val => serviceViewModel.BattleIp = val, val => battleIp = val),
429-
(isSimplifiedChinese && serviceViewModel.IsHttpServiceEnabled ? "epicgames-download1-1251447533.file.myqcloud.com" : "epicgames-download1.akamaized.net",
430-
() => serviceViewModel.EpicIp, val => serviceViewModel.EpicIp = val, val => epicIp = val),
420+
("blzddist1-a.akamaihd.net", () => serviceViewModel.BattleIp, val => serviceViewModel.BattleIp = val, val => battleIp = val)
431421
};
432422
if (isSimplifiedChinese)
433423
{
@@ -455,9 +445,7 @@ public async Task<string> StartAsync()
455445
if (string.IsNullOrEmpty(ip) && resolved is not null)
456446
set(resolved);
457447
}).ToArray();
458-
var epicTask = IpGeoHelper.IsMainlandChinaAsync(serviceViewModel.EpicIp);
459-
await Task.WhenAll(ipResolveTasks.Concat([epicTask]));
460-
var isEpicMainlandChina = epicTask.Result;
448+
await Task.WhenAll(ipResolveTasks);
461449

462450
Ipv4ServiceMap.Clear();
463451
Ipv6ServiceMap.Clear();
@@ -470,7 +458,6 @@ public async Task<string> StartAsync()
470458
AddDnsMappings("Ns", nsIp, _localIpRecords, EmptyIpRecords);
471459
AddDnsMappings("Ea", eaIp, _localIpRecords, EmptyIpRecords);
472460
AddDnsMappings("Battle", battleIp, _localIpRecords, EmptyIpRecords);
473-
AddDnsMappings("Epic", epicIp, _localIpRecords, EmptyIpRecords, isEpicMainlandChina);
474461

475462
if (serviceViewModel.IsSetLocalDnsEnabled)
476463
{
@@ -587,7 +574,10 @@ public static async Task StopAsync()
587574
// Windows / macOS
588575
if (OperatingSystem.IsWindows() || OperatingSystem.IsMacOS())
589576
{
590-
return adapter.GetIPProperties()
577+
return NetworkInterface
578+
.GetAllNetworkInterfaces()
579+
.FirstOrDefault(x => x.Id == adapter.Id)?
580+
.GetIPProperties()
591581
.DnsAddresses.FirstOrDefault(dns =>
592582
dns.AddressFamily == AddressFamily.InterNetwork &&
593583
!dns.Equals(localIpAddr) &&
@@ -905,56 +895,26 @@ private void AddDnsMappings(string ruleKey, byte[]? ip, List<ResourceRecord> loc
905895
var ipv4Records = isV4 ? ipRecords : emptyIpRecords;
906896
var ipv6Records = isV4 ? emptyIpRecords : ipRecords;
907897

908-
switch (ruleKey)
898+
foreach (var hostname in rule.Hosts)
909899
{
910-
case "Epic":
911-
if (serviceViewModel.IsHttpServiceEnabled && isXboxGameDownloadLinksShownOrMainlandChina)
900+
if (serviceViewModel.IsHttpServiceEnabled && isXboxGameDownloadLinksShownOrMainlandChina)
901+
{
902+
if (isSimplifiedChinese)
912903
{
913-
foreach (var hostname in rule.Hosts)
914-
AddMapping(hostname, localIpRecords, emptyIpRecords);
915-
if (DnsMappingGenerator.HostRules.TryGetValue("EpicCn", out var epicCnRule))
916-
{
917-
foreach (var hostname in epicCnRule.Hosts)
918-
AddMapping(hostname, ipv4Records, ipv6Records);
919-
}
904+
AddMapping(hostname, localIpRecords, emptyIpRecords);
920905
}
921906
else
922907
{
923-
foreach (var hostname in rule.Hosts)
908+
if (hostname.Contains('2'))
924909
AddMapping(hostname, ipv4Records, ipv6Records);
925-
if (serviceViewModel.IsHttpServiceEnabled)
926-
{
927-
if (DnsMappingGenerator.HostRules.TryGetValue("EpicCn", out var epicCnRule))
928-
{
929-
foreach (var hostname in epicCnRule.Hosts)
930-
AddMapping(hostname, localIpRecords, emptyIpRecords);
931-
}
932-
}
933-
}
934-
break;
935-
default:
936-
foreach (var hostname in rule.Hosts)
937-
{
938-
if (serviceViewModel.IsHttpServiceEnabled && isXboxGameDownloadLinksShownOrMainlandChina)
939-
{
940-
if (isSimplifiedChinese)
941-
{
942-
AddMapping(hostname, localIpRecords, emptyIpRecords);
943-
}
944-
else
945-
{
946-
if (hostname.Contains('2'))
947-
AddMapping(hostname, ipv4Records, ipv6Records);
948-
else
949-
AddMapping(hostname, localIpRecords, emptyIpRecords);
950-
}
951-
}
952910
else
953-
{
954-
AddMapping(hostname, ipv4Records, ipv6Records);
955-
}
911+
AddMapping(hostname, localIpRecords, emptyIpRecords);
956912
}
957-
break;
913+
}
914+
else
915+
{
916+
AddMapping(hostname, ipv4Records, ipv6Records);
917+
}
958918
}
959919

960920
if (serviceViewModel.IsHttpServiceEnabled)

XboxDownload/Services/DnsMappingGenerator.cs

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -105,28 +105,6 @@ public static class DnsMappingGenerator
105105
[
106106
"level3.ssl.blizzard.com"
107107
]
108-
),
109-
["Epic"] = (
110-
"Epic Games",
111-
[
112-
"epicgames-download1.akamaized.net"
113-
],
114-
[
115-
"download.epicgames.com",
116-
"egdownload.fastly-edge.com",
117-
"fastly-download.epicgames.com",
118-
"cloudflare.epicgamescdn.com"
119-
],
120-
[]
121-
),
122-
["EpicCn"] = (
123-
"Epic Games (Tencent Cloud)",
124-
[
125-
126-
"epicgames-download1-1251447533.file.myqcloud.com"
127-
],
128-
[],
129-
[]
130108
)
131109
};
132110

@@ -235,7 +213,7 @@ void AppendLine(string host, bool blacked)
235213
private static string[] ResolveKeys(string key)
236214
{
237215
return key.StartsWith("Akamai")
238-
? ["XboxGlobal", "XboxApp", "Ps", "Ns", "Ea", "Battle", "Epic"]
216+
? ["XboxGlobal", "XboxApp", "Ps", "Ns", "Ea", "Battle"]
239217
: [key];
240218
}
241219

0 commit comments

Comments
 (0)