Skip to content

Commit

Permalink
no wasm tests yet
Browse files Browse the repository at this point in the history
  • Loading branch information
aecsocket committed Aug 16, 2024
1 parent b7f28dc commit 8447cb0
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
target: ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"]
target: ["x86_64-unknown-linux-gnu"]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
Expand Down
1 change: 1 addition & 0 deletions crates/aeronet_webtransport/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ workspace = true
[package.metadata.docs.rs]
all-features = true
rustflags = ["--cfg=web_sys_unstable_apis"]
targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"]

[features]
## Enables [`rustls/dangerous-configuration`](https://docs.rs/rustls/latest/rustls/#crate-features)
Expand Down
14 changes: 5 additions & 9 deletions crates/aeronet_webtransport/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,18 @@ fn create_session_config() -> SessionConfig { unimplemented!() }

## Server

Create a closed [`WebTransportServer`] using [`WebTransportServer::new`], and use
[`WebTransportServer::open`] to start opening this server and have it listen for client connections,
Create a closed `WebTransportServer` using `WebTransportServer::new`, and use
`WebTransportServer::open` to start opening this server and have it listen for client connections,
passing in your server configuration (i.e. what port to bind to).

In Bevy, you can use `App::init_resource::<WebTransportServer>()` to automatically insert a
closed server into your app.

**Important:** after receiving a [`ServerEvent::Connecting`], you must manually decide whether to
accept or reject the client.
- Use [`server::Connecting`] to decide whether to accept this client based on their path, authority,
- Use `server::Connecting` to decide whether to accept this client based on their path, authority,
HTTP headers etc.
- Use [`WebTransportServer::respond_to_request`] to decide whether this client is allowed to connect
- Use `WebTransportServer::respond_to_request` to decide whether this client is allowed to connect
or not.

```rust
Expand Down Expand Up @@ -159,7 +159,7 @@ cannot easily be routed to (e.g. virtual machines or virtual servers which can b
demand). You can specify a list of *certificate hashes* which the client will implicitly trust
(some restrictions on these certificates apply - see the [WebTransport documentation]).

On the server side, use [`cert::hash_to_b64`] on your server's certificate to generate a base 64
On the server side, use `cert::hash_to_b64` on your server's certificate to generate a base 64
encoded version of the certificate hash.
On the client side, use [`cert::hash_from_b64`] to decode the base 64 string into bytes of the
certificate hash. You can use this certificate hash value in either the `ClientConfigBuilder`
Expand All @@ -184,8 +184,4 @@ On Firefox, I don't know what the equivalent flags are. PRs open!
[`WebTransportClient`]: client::WebTransportClient
[`WebTransportClient::new`]: client::WebTransportClient::new
[`WebTransportClient::connect`]: client::WebTransportClient::connect
[`WebTransportServer`]: server::WebTransportServer
[`WebTransportServer::new`]: server::WebTransportServer::new
[`WebTransportServer::open`]: server::WebTransportServer::open
[`WebTransportServer::respond_to_request`]: server::WebTransportServer::respond_to_request
[WebTransport documentation]: https://developer.mozilla.org/en-US/docs/Web/API/WebTransport/WebTransport#servercertificatehashes
2 changes: 1 addition & 1 deletion crates/aeronet_webtransport/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#![doc = include_str!("../README.md")]
#![cfg_attr(
target_family = "wasm",
allow(clippy::future_not_send, clippy::arc_with_non_send_sync)
)]
#![doc = include_str!("../README.md")]

pub use aeronet_proto as proto;

Expand Down
5 changes: 1 addition & 4 deletions crates/aeronet_webtransport/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use xwt_core::utils::maybe;
/// Provides a platform-agnostic way of spawning futures required to drive a
/// WebTransport endpoint.
///
/// [`WebTransportClient::connect`] and [`WebTransportServer::open`] both return
/// Connecting a WebTransport client or opening a WebTransport server returns
/// [`Future`]s which must be spawned on an async runtime. However, which
/// runtime to use exactly (and how that runtime is provided) is
/// target-dependent. This type exists to provide a platform-agnostic way of
Expand All @@ -34,9 +34,6 @@ use xwt_core::utils::maybe;
/// `wasm-bindgen`.
///
/// If using Bevy, you can use this as a resource in your systems.
///
/// [`WebTransportClient::connect`]: crate::client::WebTransportClient::connect
/// [`WebTransportServer::open`]: crate::server::WebTransportServer::open
#[derive(Debug, Clone)]
#[cfg_attr(feature = "bevy", derive(bevy_ecs::prelude::Resource))]
pub struct WebTransportRuntime {
Expand Down

0 comments on commit 8447cb0

Please sign in to comment.