basic

package
v1.9.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

README

Basic WebAssembly Middleware

WebAssembly is a way to safely run code compiled in other languages. Runtimes execute WebAssembly Modules (Wasm), which are most often binaries with a .wasm extension.

This component allows you to rewrite a request URI with custom logic compiled to a Wasm using the waPC protocol.

Please see the documentation for general configuration.

Generating Wasm

To compile your wasm, you must compile source using a wapc-go guest SDK such as TinyGo. You can also make a copy of hello.go and replace the function rewrite with your custom logic.

If using TinyGo, compile like so and set the path attribute to the output:

tinygo build -o example.wasm -scheduler=none --no-debug -target=wasi example.go`

Notes

  • This is an alpha feature, so configuration is subject to change.
  • This module implements the host side of the waPC protocol using wapc-go.
  • This uses wazero for the WebAssembly runtime as it has no dependencies, nor relies on CGO. This allows installation without shared libraries.
  • Many WebAssembly compilers leave memory unbounded and/or set to 16MB. Do not set a large pool size without considering memory amplification.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMiddleware

func NewMiddleware(logger logger.Logger) middleware.Middleware

NewMiddleware returns a new wasm basic middleware.

Types

This section is empty.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL