fix(discord): restore voice UDP routing on Cloudflare Anycast while isolating web traffic
- Preserve raw Cloudflare subnets in community-subnets-discord.lst in updates.uc instead of destructive deletion. - In singbox/generator_routes.uc: * Exclude Cloudflare Anycast CIDRs from general IP route rules (preventing web hijacking). * Generate a dedicated Discord Voice route rule for Cloudflare subnets scoped to network: 'udp' and voice port ranges (50000-65535, 3478, 19302, 5000-5020). * Provide DEFAULT_DISCORD_VOICE_SUBNETS fallback in core/ip.uc. - In nft/apply.uc: * Route Cloudflare subnets to ip_ports set with Discord voice ports (5000-5020, 3478, 19302, 50000-65535). * Automatically enable ip_port rules when section has community_subnets for Discord. - In section.js (Routing Rule Tracer): * Filter out Cloudflare subnets when resolving domain web traffic to Discord community subnets. * Accurately display voice UDP routing notice for Anycast ranges. - Update tests/community_subnets_sanitization.sh with voice UDP and sing-box validation.
This commit is contained in:
@@ -2519,15 +2519,11 @@ function import_all_preset_lists(settings) {
|
||||
}
|
||||
}
|
||||
|
||||
let core_ip = core_ip_module_or_null();
|
||||
let lines = split(as_string(fs.readfile(tmpfile)), "\n");
|
||||
for (let l in lines) {
|
||||
l = trim(replace(as_string(l), /\r/g, ""));
|
||||
if (l != "" && substr(l, 0, 1) != "#") {
|
||||
if (as_string(service) == "discord" && core_ip && core_ip.is_cloudflare_shared_cidr(l))
|
||||
continue;
|
||||
if (l != "" && substr(l, 0, 1) != "#")
|
||||
push(combined_lines, l);
|
||||
}
|
||||
}
|
||||
|
||||
if (downloaded)
|
||||
@@ -2589,20 +2585,12 @@ function import_builtin_subnets_from_rule(section, settings) {
|
||||
}
|
||||
}
|
||||
|
||||
let core_ip = core_ip_module_or_null();
|
||||
let lines = split(as_string(fs.readfile(tmpfile)), "\n");
|
||||
let filtered_for_nft = [];
|
||||
for (let l in lines) {
|
||||
l = trim(replace(as_string(l), /\r/g, ""));
|
||||
if (l != "" && substr(l, 0, 1) != "#") {
|
||||
if (as_string(service) == "discord" && core_ip && core_ip.is_cloudflare_shared_cidr(l))
|
||||
continue;
|
||||
if (l != "" && substr(l, 0, 1) != "#")
|
||||
push(combined_lines, l);
|
||||
push(filtered_for_nft, l);
|
||||
}
|
||||
}
|
||||
if (as_string(service) == "discord")
|
||||
write_file(tmpfile, join("\n", filtered_for_nft) + "\n");
|
||||
|
||||
nft_module_success([
|
||||
"nft-add-community-subnet-file-for-uci-section",
|
||||
|
||||
Reference in New Issue
Block a user