WEB: bounded opt-in wildcard host routing added

This commit is contained in:
Alexey
2026-10-17 23:42:26 +03:00
parent b2b088495d
commit 9738244285
67 changed files with 2572 additions and 239 deletions
+14 -2
View File
@@ -185,12 +185,24 @@ pub(super) fn build_upstream(
impl ProxyConfig {
/// Compares selected endpoints separately from source-only configuration equality.
pub(crate) fn web_decoy_endpoints_equal(&self, other: &Self) -> bool {
fn selected(config: &ProxyConfig) -> impl Iterator<Item = (&String, SocketAddr)> {
fn selected(config: &ProxyConfig) -> impl Iterator<Item = ((u8, &str), SocketAddr)> {
config
.web
.runtime
.iter()
.flat_map(|runtime| runtime.vhosts.iter())
.flat_map(|runtime| {
runtime
.vhosts
.iter()
.map(|(host, vhost)| ((0, host.as_str()), vhost))
.chain(
runtime
.wildcards
.iter()
.map(|(suffix, vhost)| ((1, suffix.as_str()), vhost)),
)
.chain(runtime.catch_all.iter().map(|vhost| ((2, "*"), vhost)))
})
.filter_map(|(host, vhost)| match vhost.decoy.as_ref() {
WebRuntimeDecoy::HttpUpstream { addr, .. } => Some((host, *addr)),
WebRuntimeDecoy::StaticDirectory(_) => None,