wasm

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

README

Wasm Plugin

This plugin allows you to customize delivery requests including URL, method, headers, and payload.

The Application Binary Interface (ABI) is defined in versions.

For more examples, please see examples/wasm.

Configuration
Name Type Description
file
required*
string The filename of wasm module.
envs
optional
map The environment variables that are exposed to the wasm module.
Configuration examples
name: wasm
enabled: true
config:
  file: /path/to/your.wasm
  envs:
    foo: bar

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(config []byte) (plugin.Plugin, error)

Types

type Config

type Config struct {
	File string            `json:"file" validate:"required"`
	Envs map[string]string `json:"envs"`
}

type LogLevel

type LogLevel int32
const (
	LogLveDebug LogLevel = 0
	LogLveInfo  LogLevel = 1
	LogLveWarn  LogLevel = 2
	LogLveError LogLevel = 3
)

type Status

type Status int32
const (
	StatusOk                  Status = 0
	StatusInternalFailure     Status = 1
	StatusBadArgument         Status = 2
	StatusInvalidMemoryAccess Status = 3
	StatusInvalidJSON         Status = 11
)

func GetRequestJSON

func GetRequestJSON(ctx context.Context, m api.Module, jsonPtr, jsonSizePtr uint32) Status

func Log

func Log(ctx context.Context, m api.Module, logLevel, strValue, strSize uint32) Status

func SetRequestJSON

func SetRequestJSON(ctx context.Context, m api.Module, jsonPtr, jsonSize uint32) Status

type WasmPlugin

type WasmPlugin struct {
	plugin.BasePlugin[Config]
}

func (*WasmPlugin) ExecuteOutbound

func (p *WasmPlugin) ExecuteOutbound(outbound *plugin.Outbound, _ *plugin.Context) error

func (*WasmPlugin) ValidateConfig

func (p *WasmPlugin) ValidateConfig() error

Jump to

Keyboard shortcuts

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