1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//! WASI 0.2 sockets transport for rust-libp2p.
//!
//! This crate implements [`libp2p_core::Transport`] over the `wasi:sockets/tcp` interface,
//! enabling rust-libp2p applications to run as Wasm Components on any WASI 0.2 host
//! (Wasmtime, Spin, jco, Wasmer) without modification to the rest of the libp2p stack.
//!
//! # Supported multiaddrs
//!
//! - `/ip4/<addr>/tcp/<port>`
//! - `/ip4/<addr>/tcp/<port>/p2p/<peer-id>`
//! - `/ip6/<addr>/tcp/<port>`
//! - `/ip6/<addr>/tcp/<port>/p2p/<peer-id>`
//!
//! # Not supported
//!
//! - `/dns4`, `/dns6`, `/dnsaddr` — DNS resolution via `wasi:sockets/ip-name-lookup` is a
//! planned follow-up.
//! - `/quic-v1`, `/ws`, `/wss`, `/webrtc`, `/p2p-circuit` — out of scope.
//! - UDP — out of scope for v0.1.
//!
//! # Quick start
//!
//! ```no_run
//! use libp2p_wasi_sockets::WasiTcpTransport;
//!
//! let transport = WasiTcpTransport::default();
//! ```
//!
//! Build and run under Wasmtime:
//!
//! ```bash
//! cargo build --release --target wasm32-wasip2
//! wasmtime run -S inherit-network ./target/wasm32-wasip2/release/my_app.wasm
//! ```
//!
//! If you omit `-S inherit-network`, all dials will fail with
//! [`Error::AccessDenied`] — Wasmtime denies all outbound connections by default.
pub use Error;
pub use WasiTcpStream;
pub use ;