pub struct Proxy { /* private fields */ }Implementations§
Source§impl Proxy
impl Proxy
Sourcepub async fn bind(config: &Config) -> Result<Self, Box<dyn Error + Send + Sync>>
pub async fn bind(config: &Config) -> Result<Self, Box<dyn Error + Send + Sync>>
Bind a proxy from config with the default extension surface (built-in
modules, in-memory rate-limit store, file-based TLS cert). For embedding —
injecting a custom store or extra modules — use Proxy::builder.
Sourcepub fn builder(config: &Config) -> ProxyBuilder<'_>
pub fn builder(config: &Config) -> ProxyBuilder<'_>
Start configuring a proxy with injectable extension points (the stable
embedding API): extra detection modules and the rate-limit StateStore.
Every seam has a default, so Proxy::builder(cfg).build() equals
Proxy::bind.
Sourcepub fn reloader(&self) -> Reloader
pub fn reloader(&self) -> Reloader
A cheap, cloneable handle to hot-reload this proxy’s configuration.
Obtain it before run() (which consumes self); the binary wires it to
SIGHUP, tests call reload_from directly.
pub fn local_addr(&self) -> Result<SocketAddr>
Sourcepub fn metrics_addr(&self) -> Option<SocketAddr>
pub fn metrics_addr(&self) -> Option<SocketAddr>
Address of the metrics endpoint, when [metrics].enabled (tests/operability).
Sourcepub async fn run(self) -> Result<(), Box<dyn Error + Send + Sync>>
pub async fn run(self) -> Result<(), Box<dyn Error + Send + Sync>>
Serve forever (until an accept error). Equivalent to Self::run_with_shutdown with a
signal that never fires — the historical behaviour.
Sourcepub async fn run_with_shutdown(
self,
shutdown: impl Future<Output = ()> + Send,
) -> Result<(), Box<dyn Error + Send + Sync>>
pub async fn run_with_shutdown( self, shutdown: impl Future<Output = ()> + Send, ) -> Result<(), Box<dyn Error + Send + Sync>>
Serve until shutdown resolves, then gracefully drain (core 0.5.4 seam).
On the signal the listener stops accepting NEW connections and each in-flight connection
is told to finish its current exchange (keep-alive disabled) and close; the method returns
once every connection has drained. An embedder wires this to SIGTERM so a Kubernetes
rolling update loses no in-flight request (the caller bounds total drain time — e.g.
terminationGracePeriodSeconds). Additive: run() delegates here with a never-firing
signal, so existing behaviour is unchanged.