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

wasm

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewModuleConfig

func NewModuleConfig(m *InitMetadata) wazero.ModuleConfig

NewModuleConfig returns a new module config appropriate for the initialized metadata.

Types

type InitMetadata

type InitMetadata struct {
	// URL is how to load a `%.wasm` file that implements a command, usually
	// compiled to target WASI.
	//
	// If no scheme is present, this defaults to oci://, referencing an OCI
	// image. The wasm is identified be ENTRYPOINT and any other files in the
	// corresponding layers will be mounted read-only as the root file system.
	//
	// Other valid schemes are file:// for a local file or http[s]:// for one
	// retrieved via HTTP. In these cases, no filesystem will be mounted.
	URL string `mapstructure:"url"`

	// StrictSandbox when true uses fake sources to avoid vulnerabilities such
	// as timing attacks.
	//
	// # Affected configuration
	//
	//   - sys.Walltime increments with a constant value when read, initially a
	//     second resolution of the current system time.
	//   - sys.Nanotime increments with a constant value when read, initially
	//     zero.
	//   - sys.Nanosleep returns immediately.
	//   - Random number generators are seeded with a deterministic source.
	StrictSandbox bool `mapstructure:"strictSandbox"`

	// Guest is WebAssembly binary implementing the guest, loaded from URL.
	Guest []byte `mapstructure:"-"`

	// GuestName is module name of the guest, loaded from URL.
	GuestName string `mapstructure:"-"`
}

func GetInitMetadata

func GetInitMetadata(ctx context.Context, md metadata.Base) (*InitMetadata, error)

GetInitMetadata returns InitMetadata from the input metadata.

Jump to

Keyboard shortcuts

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