From 0a5d9bbd29da18e9d306b885f9572316c9864406 Mon Sep 17 00:00:00 2001 From: YiYing He Date: Mon, 3 Jun 2024 11:54:49 +0800 Subject: [PATCH] Mark the rustls plug-in as deprecated. Signed-off-by: YiYing He --- docs/contribute/source/plugin/rusttls.md | 7 ++++++- docs/develop/rust/database/my_sql_driver.md | 21 ++++++++++----------- docs/develop/rust/http_service/client.md | 5 ++--- docs/develop/rust/setup.md | 14 ++++++-------- docs/start/install.md | 7 +++---- docs/start/wasmedge/extensions/plugins.md | 2 +- 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/docs/contribute/source/plugin/rusttls.md b/docs/contribute/source/plugin/rusttls.md index 6f8986f8..f7aa4b6f 100644 --- a/docs/contribute/source/plugin/rusttls.md +++ b/docs/contribute/source/plugin/rusttls.md @@ -2,7 +2,12 @@ sidebar_position: 8 --- -# Build with Rustls Plug-in +# (DEPRECATED after `0.14.0`) Build with Rustls Plug-in + + +:::note +This plug-in has been deprecated after WasmEdge `0.14.0` because the `rustls` is replaced by [`reqwest`](../../../develop/rust/http_service/client.md#the-reqwest-api). +::: The WasmEdge Rustls plug-in is a replacement for the OpenSSL plug-in in WasmEdge. It provides a Rust-friendly interface to the Rustls library, which is a modern, fast, and more secure alternative to OpenSSL. diff --git a/docs/develop/rust/database/my_sql_driver.md b/docs/develop/rust/database/my_sql_driver.md index 80033cff..2346acab 100644 --- a/docs/develop/rust/database/my_sql_driver.md +++ b/docs/develop/rust/database/my_sql_driver.md @@ -39,7 +39,7 @@ wasmedge --env "DATABASE_SSL=1" --env "DATABASE_URL=mysql://user:passwd@mydb.123 In order to compile the `mysql_async` and `tokio` crates, we will need to apply two patches to add WasmEdge-specific socket APIs to those crates. The following example shows that the TLS connection is enabled. -``` +```toml [patch.crates-io] tokio = { git = "https://github.com/second-state/wasi_tokio.git", branch = "v1.36.x" } socket2 = { git = "https://github.com/second-state/socket2.git", branch = "v0.5.x" } @@ -57,7 +57,7 @@ statements. Connect to a MySQL database. -``` +```rust // Below we create a customized connection pool let opts = Opts::from_url(&*get_url()).unwrap(); let mut builder = OptsBuilder::from_opts(opts); @@ -74,7 +74,7 @@ Connect to a MySQL database. Create a table on the connected database. -``` +```rust // create table if no tables exist let result = r"SHOW TABLES LIKE 'orders';" .with(()) @@ -94,7 +94,7 @@ Create a table on the connected database. Insert some records into the MySQL database using SQL. -``` +```rust let orders = vec![ Order::new(1, 12, 2, 56.0, 15.0, 2.0, String::from("Mataderos 2312")), Order::new(2, 15, 3, 256.0, 30.0, 16.0, String::from("1234 NW Bobcat")), @@ -122,7 +122,7 @@ Insert some records into the MySQL database using SQL. Query the database. -``` +```rust // query data let loaded_orders = "SELECT * FROM orders" .with(()) @@ -147,8 +147,8 @@ Query the database. Delete some records from the database. -``` - // // delete some data +```rust + // delete some data r"DELETE FROM orders WHERE order_id=4;" .ignore(&mut conn) .await?; @@ -177,8 +177,8 @@ Delete some records from the database. Update records in the MySQL database. -``` - // // update some data +```rust + // update some data r"UPDATE orders SET shipping_address = '8366 Elizabeth St.' WHERE order_id = 2;" @@ -208,8 +208,7 @@ Update records in the MySQL database. Close the database connection. -``` +```rust drop(conn); pool.disconnect().await.unwrap(); ``` - diff --git a/docs/develop/rust/http_service/client.md b/docs/develop/rust/http_service/client.md index 3c364c6c..bf8eeda5 100644 --- a/docs/develop/rust/http_service/client.md +++ b/docs/develop/rust/http_service/client.md @@ -109,7 +109,7 @@ wasmedge compile target/wasm32-wasi/release/wasmedge_hyper_client.wasm wasmedge_ wasmedge wasmedge_hyper_client.wasm ``` -In your Rust application, import the [hyper](https://crates.io/crates/hyper) crate, +In your Rust application, import the [hyper](https://crates.io/crates/hyper) crate, and patch it with WasmEdge sockets patches. Just add the following line to your `Cargo.toml`. @@ -138,7 +138,7 @@ wasmedge wasmedge_hyper_client_https.wasm In the HTTPS version of `Cargo.toml`, you just need to import the standard [hyper-rustls](https://crates.io/crates/hyper-rustls), [rustls](https://crates.io/crates/rustls) and [webpki-roots](https://crates.io/crates/webpki-roots) crates with the same patches as above. -``` +```toml [patch.crates-io] tokio = { git = "https://github.com/second-state/wasi_tokio.git", branch = "v1.36.x" } socket2 = { git = "https://github.com/second-state/socket2.git", branch = "v0.5.x" } @@ -211,4 +211,3 @@ async fn post_url_return_str (url: hyper::Uri, post_body: &'static [u8]) -> Resu Ok(()) } ``` - diff --git a/docs/develop/rust/setup.md b/docs/develop/rust/setup.md index 84e5b416..29af920f 100644 --- a/docs/develop/rust/setup.md +++ b/docs/develop/rust/setup.md @@ -36,17 +36,16 @@ rustup target add wasm32-wasi ### Async networking with tokio -WasmEdge supports async networking APIs provided by [Tokio](https://tokio.rs/) and related crates. If you have tokio in your `Cargo.toml`, you -need to add a few config flags to help the Rust compiler choose the correct feature branches in the library source code. Here is an example of `cargo build` command for -compiling a tokio app to Wasm. +WasmEdge supports async networking APIs provided by [Tokio](https://tokio.rs/) and related crates. If you have tokio in your `Cargo.toml`, you +need to add a few config flags to help the Rust compiler choose the correct feature branches in the library source code. Here is an example of `cargo build` command for compiling a tokio app to Wasm. -``` +```bash RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasi --release ``` Alternatively, you could add these lines to the `.cargo/config.toml` file. -``` +```toml [build] target = "wasm32-wasi" rustflags = ["--cfg", "wasmedge", "--cfg", "tokio_unstable"] @@ -59,13 +58,12 @@ on MacOS, you need a special version of the Clang tool, released from the offici > When you compile Rust TLS source code to Wasm on Linux, the result Wasm file is cross-platform and can run correctly on any platform with WasmEdge installed. This section is only applicable when you need to **compile** Rust TLS source code on MacOS. -[Download the latest wasi-sdk release](https://github.com/WebAssembly/wasi-sdk/releases) for your platform and +[Download the latest wasi-sdk release](https://github.com/WebAssembly/wasi-sdk/releases) for your platform and expand it into a directory. Point the `WASI_SDK_PATH` variable to this directory and export a `CC` variable for the default Clang. -``` +```bash export WASI_SDK_PATH /path/to/wasi-sdk-22.0 export CC="${WASI_SDK_PATH}/bin/clang --sysroot=${WASI_SDK_PATH}/share/wasi-sysroot" ``` That's it. Now you can use the `cargo` tools on MacOS to compile tokio libraries with `rust-tls` feature turned on. - diff --git a/docs/start/install.md b/docs/start/install.md index 304806d8..132d0be7 100644 --- a/docs/start/install.md +++ b/docs/start/install.md @@ -56,7 +56,7 @@ WasmEdge plug-ins are pre-built native modules that provide additional functiona curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- --plugins wasi_nn-ggml ``` -To install multiple plug-ins, you can pass a list of plug-ins with the `--plugins` option. For example, the following command installs the `wasi_logging`` and the `wasi_nn-ggml` plug-ins. The `wasi_logging` plug-in allows the Rust [log::Log](https://crates.io/crates/log) API to compile into Wasm and run in WasmEdge. +To install multiple plug-ins, you can pass a list of plug-ins with the `--plugins` option. For example, the following command installs the `wasi_logging`` and the`wasi_nn-ggml` plug-ins. The `wasi_logging` plug-in allows the Rust [log::Log](https://crates.io/crates/log) API to compile into Wasm and run in WasmEdge. ```bash curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- --plugins wasi_logging wasi_nn-ggml @@ -254,7 +254,7 @@ curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/insta ### WasmEdge zlib Plug-in -The zlib is required for compiling and running many existing C / C++ / Rust apps in Wasm. Most noticeably, it is required for the Python port to Wasm. It supports the standard [zlib.h](https://github.com/madler/zlib/blob/develop/zlib.h) C API. +The zlib is required for compiling and running many existing C / C++ / Rust apps in Wasm. Most noticeably, it is required for the Python port to Wasm. It supports the standard [zlib.h](https://github.com/madler/zlib/blob/develop/zlib.h) C API. ```bash curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- --plugins wasmedge_zlib @@ -289,7 +289,6 @@ If you install this plug-in WITHOUT installer, you can [refer to here to install Then, go to [TensorFlow interface in Rust chapter](../develop/rust/wasinn/tf_plugin.md) to see how to run `WasmEdge-TensorFlow` functions. - ### TLS plug-in @@ -299,7 +298,7 @@ The WasmEdge TLS plugin is being deprecated from WasmEdge 0.14.0. We now compile The WasmEdge TLS plug-in utilizes the native OpenSSL library to support HTTPS and TLS requests from WasmEdge sockets. To install WasmEdge with the TLS plug-in, run the following command. -``` +```bash curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- -v 0.13.5 --plugins wasmedge_rustls ``` diff --git a/docs/start/wasmedge/extensions/plugins.md b/docs/start/wasmedge/extensions/plugins.md index 910bc39b..c93a9b30 100644 --- a/docs/start/wasmedge/extensions/plugins.md +++ b/docs/start/wasmedge/extensions/plugins.md @@ -26,7 +26,7 @@ The following lists are the WasmEdge official released plug-ins. Users can insta | [WasmEdge-TensorflowLite](../../../contribute/source/plugin/tensorflowlite.md)| A native library for inferring TensorFlow-Lite models. | `manylinux2014 (x86_64, aarch64)`
`ubuntu 20.04 (x86_64)`
`darwin (x86_64, arm64)`
(since `0.13.0`) | [Rust](https://crates.io/crates/wasmedge_tensorflow_interface) (0.3.0) | [Steps](../../../contribute/source/plugin/tensorflowlite.md) | | WasmEdge-OpenCV | Very popular utility functions to process images and videos for AI input/output. | `manylinux2014 (x86_64, aarch64)`
`ubuntu 20.04 (x86_64)`
`darwin (x86_64, arm64)`
(since `0.13.3`) | Rust | | | [WasmEdge-eBPF](../../../contribute/source/plugin/ebpf.md) | A native library for inferring eBPF applications | `manylinux2014 (x86_64, aarch64)`
`ubuntu 20.04 (x86_64)`
(since `0.13.2`) | Rust | [Steps](../../../contribute/source/plugin/ebpf.md) | -| [WasmEdge-rustls](../../../contribute/source/plugin/rusttls.md) | A native library for inferring Rust and TLS Library | `manylinux2014 (x86_64, aarch64)`
`ubuntu 20.04 (x86_64)`
`darwin (x86_64, arm64)`
(since `0.13.0`) | [Rust](https://crates.io/crates/wasmedge_rustls_api) | [Steps](../../../contribute/source/plugin/rusttls.md) | +| [WasmEdge-rustls](../../../contribute/source/plugin/rusttls.md) (DEPRECATED) | A native library for inferring Rust and TLS Library | `manylinux2014 (x86_64, aarch64)`
`ubuntu 20.04 (x86_64)`
`darwin (x86_64, arm64)`
(since `0.13.0`, until `0.13.5`) | [Rust](https://crates.io/crates/wasmedge_rustls_api) | [Steps](../../../contribute/source/plugin/rusttls.md) | ## Old WasmEdge Extensions