@@ -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 )
0 commit comments