title |
---|
TraefikGrainPlugin |
Experimental Traefik plugin using WASM and Grain.
This is the "main" code for the plugin, and where any operations can be preformed on HTTP requests or responses.
Examples here include using Grain's Pattern Matching on requests to take some actions.
Traefik invokes a WASM plugin by call
handle_request
andhandle_response
exports. Since these require unsafe pointers,HttpWasm
module wraps them. So Grain-based "callbacks" can useregisterRequestHandler
orregisterResponseHandler
to avoid needing unsafe code.
But for Traefik's http-wasm host to find them, theplugin.gr
must expose these, which just uses the implementation inWasmHttp
to call any registered handlers here.
Functions and constants included in the TraefikGrainPlugin module.
handle_request : () => WasmI64
See http-wasm ABI spec for handle_request
handle_response : (high: WasmI32, low: WasmI32) => Void
See http-wasm ABI spec for handle_response