Skip to main content

ProxyBuilder

Struct ProxyBuilder 

Source
pub struct ProxyBuilder<'a> { /* private fields */ }
Expand description

Stable builder for embedding the proxy with custom extension points. Obtain it via Proxy::builder. Every seam defaults to the built-in behaviour, so a builder with no overrides is identical to Proxy::bind. The enterprise plugs a distributed rate-limit store or premium modules here without forking (BOUNDARY §4).

Implementations§

Source§

impl<'a> ProxyBuilder<'a>

Source

pub fn modules(self, modules: Vec<Box<dyn WafModule>>) -> Self

Replace the extra detection modules appended after the built-in set. These run after the built-ins and are NOT carried across a config reload.

Source

pub fn add_module(self, module: Box<dyn WafModule>) -> Self

Append a single extra detection module (additive over Self::modules).

Source

pub fn state_store(self, store: Arc<dyn StateStore>) -> Self

Inject the rate-limit StateStore (e.g. a distributed Redis store). The store survives config reloads. Defaults to the in-memory token bucket sized from [rate_limit].max_tracked_keys.

Source

pub fn cert_source(self, source: Arc<dyn TlsCertSource>) -> Self

Inject the TlsCertSource (e.g. enterprise ACME/managed-PKI/mTLS). [tls].enabled and [tls].alpn still come from config; the source only governs cert provenance, so the config cert_path/key_path are ignored when one is injected. Defaults to the OPEN FileCertSource reading those paths.

Source

pub fn module_factory<F>(self, factory: F) -> Self
where F: Fn() -> Result<Vec<Box<dyn WafModule>>, Box<dyn Error + Send + Sync>> + Send + Sync + 'static,

Inject a ModuleFactory that (re)builds the extra detection modules (core 0.3). Unlike Self::add_module/Self::modules (built once, dropped on a reload), the factory is re-run on every config reload, so injected modules SURVIVE a SIGHUP and are re-init’d. It runs at bind too (the single source of reload-surviving modules): a boot error is fatal, and a reload error aborts that reload and keeps the last-good modules. This is the seam an embedder uses to keep premium modules across reloads (BOUNDARY §4). Factory output is appended AFTER any static .add_module extras.

Source

pub async fn build(self) -> Result<Proxy, Box<dyn Error + Send + Sync>>

Bind the listener and construct the proxy with the chosen seams.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for ProxyBuilder<'a>

§

impl<'a> !UnwindSafe for ProxyBuilder<'a>

§

impl<'a> Freeze for ProxyBuilder<'a>

§

impl<'a> Send for ProxyBuilder<'a>

§

impl<'a> Sync for ProxyBuilder<'a>

§

impl<'a> Unpin for ProxyBuilder<'a>

§

impl<'a> UnsafeUnpin for ProxyBuilder<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more