[][src]Macro envoy_sdk::entrypoint

macro_rules! entrypoint {
    ($init_fn:expr) => { ... };

Generates the _start function that will be called by Envoy to let WebAssembly module initialize itself.


use envoy::extension::{entrypoint, Module, Result};

entrypoint! { initialize } // put initialization logic into a function to make it unit testable

/// Does one-time initialization.
/// Returns a registry of extensions provided by this module.
fn initialize() -> Result<Module> {
    // arbitrary initialization steps

        .add_http_filter(|_instance_id| MyHttpFilterFactory::default())?
        .add_network_filter(|_instance_id| MyNetworkFilterFactory::default())?
        .add_access_logger(|_instance_id| MyAccessLogger::default())