@@ -2321,21 +2321,45 @@ public static async Task<bool> ApplyRegionalPreset(Config config, EPresetType ty
23212321 config . ConstItem . SrsSourceUrl = Global . SingboxRulesetSources [ 1 ] ;
23222322 config . ConstItem . RouteRulesTemplateSourceUrl = Global . RoutingRulesSources [ 1 ] ;
23232323
2324- await SaveDNSItems ( config , await GetExternalDNSItem ( ECoreType . Xray , Global . DNSTemplateSources [ 1 ] + "v2ray.json" ) ) ;
2325- await SaveDNSItems ( config , await GetExternalDNSItem ( ECoreType . sing_box , Global . DNSTemplateSources [ 1 ] + "sing_box.json" ) ) ;
2324+ var xrayDnsRussia = await GetExternalDNSItem ( ECoreType . Xray , Global . DNSTemplateSources [ 1 ] + "v2ray.json" ) ;
2325+ var singboxDnsRussia = await GetExternalDNSItem ( ECoreType . sing_box , Global . DNSTemplateSources [ 1 ] + "sing_box.json" ) ;
2326+ var simpleDnsRussia = await GetExternalSimpleDNSItem ( Global . DNSTemplateSources [ 1 ] + "simple_dns.json" ) ;
23262327
2327- config . SimpleDNSItem = await GetExternalSimpleDNSItem ( Global . DNSTemplateSources [ 1 ] + "simple_dns.json" ) ?? InitBuiltinSimpleDNS ( ) ;
2328+ if ( simpleDnsRussia == null )
2329+ {
2330+ xrayDnsRussia . Enabled = true ;
2331+ singboxDnsRussia . Enabled = true ;
2332+ config . SimpleDNSItem = InitBuiltinSimpleDNS ( ) ;
2333+ }
2334+ else
2335+ {
2336+ config . SimpleDNSItem = simpleDnsRussia ;
2337+ }
2338+ await SaveDNSItems ( config , xrayDnsRussia ) ;
2339+ await SaveDNSItems ( config , singboxDnsRussia ) ;
23282340 break ;
23292341
23302342 case EPresetType . Iran :
23312343 config . ConstItem . GeoSourceUrl = Global . GeoFilesSources [ 2 ] ;
23322344 config . ConstItem . SrsSourceUrl = Global . SingboxRulesetSources [ 2 ] ;
23332345 config . ConstItem . RouteRulesTemplateSourceUrl = Global . RoutingRulesSources [ 2 ] ;
23342346
2335- await SaveDNSItems ( config , await GetExternalDNSItem ( ECoreType . Xray , Global . DNSTemplateSources [ 2 ] + "v2ray.json" ) ) ;
2336- await SaveDNSItems ( config , await GetExternalDNSItem ( ECoreType . sing_box , Global . DNSTemplateSources [ 2 ] + "sing_box.json" ) ) ;
2347+ var xrayDnsIran = await GetExternalDNSItem ( ECoreType . Xray , Global . DNSTemplateSources [ 2 ] + "v2ray.json" ) ;
2348+ var singboxDnsIran = await GetExternalDNSItem ( ECoreType . sing_box , Global . DNSTemplateSources [ 2 ] + "sing_box.json" ) ;
2349+ var simpleDnsIran = await GetExternalSimpleDNSItem ( Global . DNSTemplateSources [ 2 ] + "simple_dns.json" ) ;
23372350
2338- config . SimpleDNSItem = await GetExternalSimpleDNSItem ( Global . DNSTemplateSources [ 2 ] + "simple_dns.json" ) ?? InitBuiltinSimpleDNS ( ) ;
2351+ if ( simpleDnsIran == null )
2352+ {
2353+ xrayDnsIran . Enabled = true ;
2354+ singboxDnsIran . Enabled = true ;
2355+ config . SimpleDNSItem = InitBuiltinSimpleDNS ( ) ;
2356+ }
2357+ else
2358+ {
2359+ config . SimpleDNSItem = simpleDnsIran ;
2360+ }
2361+ await SaveDNSItems ( config , xrayDnsIran ) ;
2362+ await SaveDNSItems ( config , singboxDnsIran ) ;
23392363 break ;
23402364 }
23412365
0 commit comments