Expand description
Sentinel WebAssembly Agent Library
A WebAssembly agent for Sentinel reverse proxy that executes Wasm modules for request/response processing. Modules can be written in any language that compiles to WebAssembly (Rust, Go, C, AssemblyScript, etc.).
§Wasm Module ABI
Modules must export the following functions:
// Memory allocation (required)
alloc(size: i32) -> i32 // Allocate `size` bytes, return pointer
dealloc(ptr: i32, size: i32) // Free memory at `ptr`
// Request/Response handlers (at least one required)
on_request_headers(ptr: i32, len: i32) -> i64 // Returns (result_ptr << 32) | result_len
on_response_headers(ptr: i32, len: i32) -> i64 // Returns (result_ptr << 32) | result_lenThe host passes JSON data to the module and expects JSON back.
Structs§
- Wasm
Agent - WebAssembly agent
- Wasm
Config Json - Configuration JSON for Wasm agent
- Wasm
Request - Request data passed to Wasm module
- Wasm
Response - Response data passed to Wasm module
- Wasm
Result - Result from Wasm module execution