haraldh edited PR #3729 from wasmtime_listen_cli
to main
:
As a follow up for https://github.com/bytecodealliance/wasmtime/pull/3711, this implements CLI options to insert pre-opened sockets.
--listenfd
: Inherit environment variables and file descriptors following the systemd listen fd specification (UNIX only)
--tcplisten <SOCKET ADDRESS>
: Grant access to the given TCP listen socketTODO
- [ ] Write test cases
<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
haraldh updated PR #3729 from wasmtime_listen_cli
to main
.
haraldh updated PR #3729 from wasmtime_listen_cli
to main
.
haraldh edited PR #3729 from wasmtime_listen_cli
to main
:
As a follow up for https://github.com/bytecodealliance/wasmtime/pull/3711, this implements CLI options to insert pre-opened sockets.
--listenfd
: Inherit environment variables and file descriptors following the systemd listen fd specification (UNIX only)
--tcplisten <SOCKET ADDRESS>
: Grant access to the given TCP listen socketTODO
- [ ] Write test cases
EXAMPLES
$ git clone --branch wasi https://github.com/haraldh/mio.git $ cd mio $ cargo +nightly build --target wasm32-wasi --example tcp_server --features="os-poll net" $ wasmtime run --tcplisten 127.0.0.1:9000 --env 'LISTEN_FDS=1' target/wasm32-wasi/debug/examples/tcp_server.wasm $ ^Z bg $ echo Hello | nc 127.0.0.1 9000 Hello world!
haraldh edited PR #3729 from wasmtime_listen_cli
to main
:
As a follow up for https://github.com/bytecodealliance/wasmtime/pull/3711, this implements CLI options to insert pre-opened sockets.
--listenfd
: Inherit environment variables and file descriptors following the systemd listen fd specification (UNIX only)
--tcplisten <SOCKET ADDRESS>
: Grant access to the given TCP listen socketTODO
- [ ] Write test cases
EXAMPLES
$ git clone --branch wasi https://github.com/haraldh/mio.git $ cd mio $ cargo +nightly build --target wasm32-wasi --example tcp_server --features="os-poll net" $ wasmtime run --tcplisten 127.0.0.1:9000 --env 'LISTEN_FDS=1' target/wasm32-wasi/debug/examples/tcp_server.wasm $ ^Z bg $ echo Hello | nc 127.0.0.1 9000 Hello world! $ fg $ ^C
haraldh edited PR #3729 from wasmtime_listen_cli
to main
:
As a follow up for https://github.com/bytecodealliance/wasmtime/pull/3711, this implements CLI options to insert pre-opened sockets.
--listenfd
: Inherit environment variables and file descriptors following the systemd listen fd specification (UNIX only)
--tcplisten <SOCKET ADDRESS>
: Grant access to the given TCP listen socketTODO
- [ ] Write test cases
EXAMPLES
$ git clone --branch wasi https://github.com/haraldh/mio.git $ cd mio $ cargo +nightly build --target wasm32-wasi --example tcp_server --features="os-poll net" $ wasmtime run --tcplisten 127.0.0.1:9000 --env 'LISTEN_FDS=1' target/wasm32-wasi/debug/examples/tcp_server.wasm Using preopened socket FD 3 You can connect to the server using `nc`: $ nc <IP> <PORT> You'll see our welcome message and anything you type will be printed here. ^Z [1]+ Stopped wasmtime run --tcplisten 127.0.0.1:9000 --env 'LISTEN_FDS=1' target/wasm32-wasi/debug/examples/tcp_server.wasm $ bg $ echo Hello | nc 127.0.0.1 9000 Hello world! $ fg $ ^C
haraldh edited PR #3729 from wasmtime_listen_cli
to main
:
As a follow up for https://github.com/bytecodealliance/wasmtime/pull/3711, this implements CLI options to insert pre-opened sockets.
--listenfd
: Inherit environment variables and file descriptors following the systemd listen fd specification (UNIX only)
--tcplisten <SOCKET ADDRESS>
: Grant access to the given TCP listen socketTODO
- [ ] Write test cases
EXAMPLES
$ git clone --branch wasi https://github.com/haraldh/mio.git $ cd mio $ cargo +nightly build --target wasm32-wasi --example tcp_server --features="os-poll net" $ wasmtime run --tcplisten 127.0.0.1:9000 --env 'LISTEN_FDS=1' target/wasm32-wasi/debug/examples/tcp_server.wasm Using preopened socket FD 3 You can connect to the server using `nc`: $ nc <IP> <PORT> You'll see our welcome message and anything you type will be printed here. ^Z [1]+ Stopped wasmtime run --tcplisten 127.0.0.1:9000 --env 'LISTEN_FDS=1' target/wasm32-wasi/debug/examples/tcp_server.wasm $ bg $ echo Hello | nc 127.0.0.1 9000 Hello world! $ fg $ ^C
haraldh edited PR #3729 from wasmtime_listen_cli
to main
:
As a follow up for https://github.com/bytecodealliance/wasmtime/pull/3711, this implements CLI options to insert pre-opened sockets.
--listenfd
: Inherit environment variables and file descriptors following the systemd listen fd specification (UNIX only)
--tcplisten <SOCKET ADDRESS>
: Grant access to the given TCP listen socketTODO
- [ ] Write test cases
EXAMPLES
$ git clone --branch wasi https://github.com/haraldh/mio.git $ cd mio $ cargo +nightly build --target wasm32-wasi --example tcp_server --features="os-poll net" $ wasmtime run --tcplisten 127.0.0.1:9000 --env 'LISTEN_FDS=1' target/wasm32-wasi/debug/examples/tcp_server.wasm Using preopened socket FD 3 You can connect to the server using `nc`: $ nc <IP> <PORT> You'll see our welcome message and anything you type will be printed here. ^Z [1]+ Stopped wasmtime run --tcplisten 127.0.0.1:9000 --env 'LISTEN_FDS=1' target/wasm32-wasi/debug/examples/tcp_server.wasm $ bg $ echo Hello | nc 127.0.0.1 9000 Accepted connection from: 0.0.0.0:0 Hello world! Received data: Hello Connection closed $ fg $ ^C
sunfishcode submitted PR review.
sunfishcode merged PR #3729.
Last updated: Dec 23 2024 at 13:07 UTC