dispatchrun / wasi-go

A Go implementation of the WebAssembly System Interface (WASI)
Apache License 2.0
124 stars 7 forks source link

wasirun: add --listen option to preopen listener sockets #14

Closed chriso closed 1 year ago

chriso commented 1 year ago

This PR introduces the ability to preopen sockets.

wasirun now accepts a --listen <addr> option that accepts short addresses like :8080, or fully qualified addresses like tcp6://localhost:8080?opt1=x&opt2=y&opt3=z.

$ wasirun --listen :8080 main.wasm &
[1] 59290
$ curl http://localhost:8080                                               
Hello, World!

This is a prerequisite to be able to use net.FileListener inside the WASM module (see https://github.com/stealthrocket/go/pull/1).