Help us shape the future of Go! Take the 2026 Go Developer Survey

wasm

package
v1.127.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine struct {

	// Embed common engine options
	*engine.CommonEngineOptions
	// contains filtered or unexported fields
}

Engine implements the PolicyEngine interface for WASM policies

func NewEngine

func NewEngine(opts ...engine.Option) *Engine

NewEngine creates a new WASM policy engine with the given options

func (*Engine) MatchesEvaluation

func (e *Engine) MatchesEvaluation(_ context.Context, _ *engine.Policy,
	_ []string, _ []map[string]any, _ map[string]string) (bool, error)

MatchesEvaluation is a stub implementation for WASM policies WASM policies don't currently support evaluation matching

func (*Engine) MatchesParameters

func (e *Engine) MatchesParameters(_ context.Context, _ *engine.Policy,
	_, _ map[string]string) (bool, error)

MatchesParameters is a stub implementation for WASM policies WASM policies don't currently support parameter matching

func (*Engine) Verify

func (e *Engine) Verify(ctx context.Context, policy *engine.Policy, input []byte, args map[string]any) (*engine.EvaluationResult, error)

Verify executes a WASM policy against the provided input

type ErrorCategory

type ErrorCategory string

ErrorCategory represents the type of WASM policy error

const (
	CategoryHTTPForbidden ErrorCategory = "http_forbidden"
	CategoryTimeout       ErrorCategory = "timeout"
	CategoryMemory        ErrorCategory = "memory"
	CategoryPanic         ErrorCategory = "panic"
	CategoryUnknown       ErrorCategory = "unknown"
)

type PolicyError

type PolicyError struct {
	Category    ErrorCategory
	UserMessage string
	Hint        string
	OriginalErr error
}

PolicyError represents a parsed WASM policy error with user-friendly messaging

func (*PolicyError) Error

func (e *PolicyError) Error() string

Error implements the error interface for PolicyError

Jump to

Keyboard shortcuts

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