-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Erik Chi
committed
Oct 30, 2023
1 parent
bbe6daf
commit b54ca07
Showing
10 changed files
with
90 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# WATM development Library -- `water-wasm-crate` | ||
|
||
A library for eaiser development of WATM modules, satisfies APIs [here](https://app.gitbook.com/o/KHlQypYtIQKkb8YeZ6Hx/s/lVX5MqollomuX6vW80T6/wasm-and-wasi-apis). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Host Library -- `water` | ||
|
||
A library for integrating WATER, satisfies APIs [here](https://app.gitbook.com/o/KHlQypYtIQKkb8YeZ6Hx/s/lVX5MqollomuX6vW80T6/rust-apis). | ||
|
||
## Designs | ||
**execute**: | ||
1. wasmtime runtime creation | ||
2. Setup env: | ||
1. memory initialiation & limitation | ||
2. (`v1_preview` feature) wasm_config sharing to WASM | ||
3. export helper functions (e.g. creation of TCP, TLS, crypto, etc) | ||
3. (`v1` feature) setup multi-threading | ||
4. Run the `entry_fn` or execute as the Role (`Dial`, `Listen`, `Relay`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# cli tool for using `water` library | ||
|
||
🚧 Currently under reimplementation 🚧 | ||
|
||
## How to run? | ||
To run the Host program + WASM: | ||
```shell | ||
cargo run --bin wasmable_transport -- --wasm-path <./proxy.wasm> --entry-fn <main> --config-wasm <conf.json> | ||
``` | ||
|
||
Then you can netcat into the connection, for now, I included a `proxy.wasm` as a multiple conneciton echo server, test with several terminals: | ||
```shell | ||
nc 127.0.0.1 9005 | ||
``` | ||
you should see `> CONNECTED` in the terminal of running WASM, then you can connect a bunch like this and input anything to see how it echos. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# WATM Examples | ||
|
||
This folder is for all the WATM examples that developed using the [WATM library crate](https://github.com/erikziyunchi/water-rs/tree/main/crates/wasm), and runnable with the [WATER library engine](https://github.com/erikziyunchi/water-rs/tree/main/crates/water). | ||
|
||
One can find details of these in each examples' README. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# WATM as worker implementation of an echo client | ||
|
||
It uses the `water-wasm-crate` library and is able to run as a `Dialer` or `Listener` Role. It is currently implemented with `v1_preview` where it has the capability of managing connections inside it (tell the Host which `address:port` it `dial()` to / `listen()` on). | ||
|
||
## How to run? | ||
You can also find a full runnable test for this example with using our water-host library [here](https://github.com/erikziyunchi/water-rs/blob/main/tests/tests/echo_tests.rs). | ||
|
||
You can config it as the following: | ||
```json | ||
{ | ||
"remote_address": "127.0.0.1", | ||
"remote_port": 8080, | ||
"local_address": "127.0.0.1", | ||
"local_port": 8088 | ||
} | ||
``` | ||
|
||
## How to compile? | ||
```shell | ||
cargo build --target wasm32-wasi && mv ../../../target/wasm32-wasi/debug/echo_client.wasm ./echo_client.wasm | ||
``` | ||
|
||
If you want to optmize the size of the `.wasm` binary: | ||
```shell | ||
wasm-opt --strip-debug ./echo_client.wasm -o ./echo_client.wasm | ||
``` |
Binary file renamed
BIN
+1.8 MB
examples/water_bins/echo_client/proxy.wasm → ...s/water_bins/echo_client/echo_client.wasm
100644 → 100755
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.