[router] fix p and d worker filtering and bootstrap port handling (#11729)

This commit is contained in:
Simo Lin
2025-10-16 14:19:39 -07:00
committed by GitHub
parent 4c9bcb9d56
commit 64affab495
3 changed files with 31 additions and 30 deletions

View File

@@ -247,6 +247,20 @@ pub enum ConnectionMode {
},
}
impl ConnectionMode {
/// Check if this connection mode matches another, with special handling for gRPC
/// This allows matching any gRPC connection regardless of port when comparing
/// Grpc { port: None } as a wildcard
pub fn matches(&self, filter: &ConnectionMode) -> bool {
match (self, filter) {
(ConnectionMode::Http, ConnectionMode::Http) => true,
(ConnectionMode::Grpc { .. }, ConnectionMode::Grpc { port: None }) => true,
(ConnectionMode::Grpc { port: p1 }, ConnectionMode::Grpc { port: p2 }) => p1 == p2,
_ => false,
}
}
}
impl fmt::Display for ConnectionMode {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {