wazero_net

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: MIT Imports: 20 Imported by: 0

README

WAZERO NET

this project provider net/http for wazero, it not belong to wazero's official project

Dial's Conn can not convert to net.TCPConn,net.UDPConn

Install

go get github.com/labulakalia/wazero_net@v0.0.4

Example

must use go version >= go1.24, because go1.24 will support go:wasmexport directive to export function

Install Required Go Version

go install golang.org/dl/go1.24rc1@latest
go1.24rc1 download
cd example
GOOS=wasip1 GOARCH=wasm go1.24rc1 build -buildmode=c-shared -o http.wasm http.go
GOOS=wasip1 GOARCH=wasm go1.24rc1 build -buildmode=c-shared -o net.wasm net.go
go1.24rc1 run example.go

Todo

  • support ip,unix addr
  • add unit test

Some Limit

https://go.dev/blog/wasi#limitations, this is example code

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitFuncExport

func InitFuncExport(r wazero.Runtime) wazero.HostModuleBuilder

func ReadBytes

func ReadBytes(m api.Module, offset, byteCount uint32) ([]byte, error)

Types

type HostNet

type HostNet struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis
wasi
net

Jump to

Keyboard shortcuts

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