| Crates.io | cardinal-plugins |
| lib.rs | cardinal-plugins |
| version | 0.2.41 |
| created_at | 2025-09-26 03:12:36.169622+00 |
| updated_at | 2025-11-28 16:40:38.33802+00 |
| description | Middleware registry and execution engine for the Cardinal gateway |
| homepage | https://github.com/andrespirela/cardinal |
| repository | https://github.com/andrespirela/cardinal |
| max_upload_size | |
| id | 1855374 |
| size | 138,887 |
The middleware runtime.
RestrictedRouteMiddleware, etc.) and user-supplied WASM plugins inside PluginContainer.PluginRunner, respecting global order and destination-scoped middleware.cardinal-wasm-plugins.struct MyInbound;
#[async_trait::async_trait]
impl RequestMiddleware for MyInbound {
async fn on_request(&self, session: &mut Session, backend: Arc<DestinationWrapper>, ctx: Arc<CardinalContext>) -> Result<MiddlewareResult, CardinalError> {
// inspect/modify session, backend, ctx
Ok(MiddlewareResult::Continue)
}
}
Register it by inserting into PluginContainer during bootstrap (either by editing the defaults or supplying a provider factory).
[[plugins]]
wasm = { name = "my-filter", path = "filters/my_filter.wasm" }
The runner validates exports (handle, __new) and executes it in inbound or outbound mode depending on where it’s registered.