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)>
Look up the route prefix and loaded entry for a CONNECT-style
host:port. Returns Some((prefix, route)) on a match.
Used by the TLS-intercept CONNECT branch to map the agent’s
CONNECT api.openai.com:443 target back to a route prefix
("openai") so the credential store can be consulted.
Sourcepub fn has_intercept_route(&self, host_port: &str) -> bool
pub fn has_intercept_route(&self, host_port: &str) -> bool
Returns true if the host:port matches a route that requires
TLS interception (has credential_key, oauth2, or non-empty
endpoint_rules).
Used in the CONNECT dispatch path to choose between transparent tunnelling, the existing 403, and the new intercept handler.
Sourcepub fn route_upstream_hosts(&self) -> HashSet<String>
pub fn route_upstream_hosts(&self) -> HashSet<String>
Return the set of normalised host:port strings for all route
upstreams. Uses pre-normalised values computed at load time.