pub struct IngressRouter { /* private fields */ }Expand description
An Application that routes incoming requests using the live Ingress rule table.
Finds the first matching IngressRule and forwards the request to
{service_name}.{namespace}.svc.cluster.local:{service_port} over HTTP/1.1.
Returns 404 Not Found when no rule matches.
Implementations§
Source§impl IngressRouter
impl IngressRouter
Sourcepub fn new(watcher: KubernetesIngressWatcher) -> Self
pub fn new(watcher: KubernetesIngressWatcher) -> Self
Wrap a watcher in an IngressRouter with default timeouts.
Sourcepub fn connect_timeout_ms(self, ms: u64) -> Self
pub fn connect_timeout_ms(self, ms: u64) -> Self
Override the TCP connect timeout (default: 5 000 ms).
Sourcepub fn read_timeout_ms(self, ms: u64) -> Self
pub fn read_timeout_ms(self, ms: u64) -> Self
Override the response read timeout (default: 30 000 ms).
Trait Implementations§
Source§impl Application for IngressRouter
impl Application for IngressRouter
Source§fn execute(
&self,
request: &Request,
connection: &ConnectionInfo,
) -> Result<Response, String>
fn execute( &self, request: &Request, connection: &ConnectionInfo, ) -> Result<Response, String>
Receives a parsed request and returns a fully-built response.
Walk your controller list with
is_matching / process and return the first match.Source§fn runs_inline(&self, _request: &Request, _connection: &ConnectionInfo) -> bool
fn runs_inline(&self, _request: &Request, _connection: &ConnectionInfo) -> bool
true when executing request is quick and never waits on anything
but the local filesystem — health checks, metrics, small static files.
The async servers (HTTP/1.1, HTTP/2, HTTP/3) then call execute
directly on the event loop, as nginx does, instead of handing the
request to tokio’s blocking pool: that handoff (a shared lock and two
cross-thread wake-ups) costs more than serving a small file. Read moreSource§fn execute_async<'a>(
&'a self,
_request: &'a Request,
_connection: &'a ConnectionInfo,
) -> Option<AsyncResponse<'a>>
fn execute_async<'a>( &'a self, _request: &'a Request, _connection: &'a ConnectionInfo, ) -> Option<AsyncResponse<'a>>
An asynchronous version of
execute for this request, when the
application has one: the async servers await it on the connection’s
task instead of tying up a blocking-pool thread while it waits (the
config-driven proxy uses this to wait for a backend without holding a
thread). None (the default) means “use execute”. Wrappers return
Some only when they add no synchronous work of their own.Auto Trait Implementations§
impl !RefUnwindSafe for IngressRouter
impl !UnwindSafe for IngressRouter
impl Freeze for IngressRouter
impl Send for IngressRouter
impl Sync for IngressRouter
impl Unpin for IngressRouter
impl UnsafeUnpin for IngressRouter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more