pub struct RouteStore { /* private fields */ }Expand description
Store of all configured routes, keyed by normalised prefix.
Loaded at proxy startup for all routes in the config, not just those with credentials. This ensures L7 endpoint filtering and upstream routing work independently of credential presence.
Implementations§
Source§impl RouteStore
impl RouteStore
Sourcepub fn load(routes: &[RouteConfig]) -> Result<Self>
pub fn load(routes: &[RouteConfig]) -> Result<Self>
Load route configuration for all configured routes.
Each route’s endpoint rules are compiled at startup so the hot path
does a regex match, not a glob compile. Routes with a tls_ca field
get a per-route TLS connector built from the custom CA certificate.
Sourcepub fn get(&self, prefix: &str) -> Option<&LoadedRoute>
pub fn get(&self, prefix: &str) -> Option<&LoadedRoute>
Get a loaded route by normalised prefix, if configured.
Sourcepub fn is_route_upstream(&self, host_port: &str) -> bool
pub fn is_route_upstream(&self, host_port: &str) -> bool
Check whether host_port (e.g. "api.openai.com:443") matches
any route’s upstream URL. Uses pre-normalised host:port strings
computed at load time to avoid per-request URL parsing.
Sourcepub fn lookup_by_upstream(
&self,
host_port: &str,
) -> Option<(&str, &LoadedRoute)>
pub fn lookup_by_upstream( &self, host_port: &str, ) -> Option<(&str, &LoadedRoute)>
Return the first route matching host:port, or None.
Prefer lookup_all_by_upstream
when multiple routes may share the same upstream.
Sourcepub fn lookup_all_by_upstream(
&self,
host_port: &str,
) -> Vec<(&str, &LoadedRoute)>
pub fn lookup_all_by_upstream( &self, host_port: &str, ) -> Vec<(&str, &LoadedRoute)>
Return all routes whose upstream matches host:port, sorted by
prefix for deterministic iteration.
Sourcepub fn has_intercept_route(&self, host_port: &str) -> bool
pub fn has_intercept_route(&self, host_port: &str) -> bool
Whether any route for host:port requires TLS interception.
Sourcepub fn route_upstream_hosts(&self) -> HashSet<String>
pub fn route_upstream_hosts(&self) -> HashSet<String>
All unique upstream host:port strings across loaded routes.