Crates.io | aeronet |
lib.rs | aeronet |
version | 0.9.0 |
source | src |
created_at | 2023-10-07 17:04:26.202778 |
updated_at | 2024-11-07 22:10:41.010821 |
description | Low-level networking for Bevy |
homepage | |
repository | https://github.com/aecsocket/aeronet |
max_upload_size | |
id | 996480 |
size | 10,414 |
aeronet
A set of Bevy-native networking crates, focused on providing robust and rock-solid data transfer primitives.
unwrap
s - all panicking paths are a bug unless explicitly documentedHigh-level networking features such as replication, rollback, and prediction are explicit non-goals for this crate. Instead, this crate aims to provide a solid foundation for implementing these features.
aeronet_channel
: over MPSC channels
cargo run --example channel
aeronet_websocket
: over WebSockets (using TCP)
cargo run --example websocket_echo_server -F server
cargo run --example websocket_client -F client
# WASM
cargo install wasm-server-runner
cargo run --example websocket_client -F client --target wasm32-unknown-unknown
aeronet_webtransport
: over WebTransport (using QUIC)
cargo run --example webtransport_echo_server -F server
cargo run --example webtransport_client -F client,dangerous-configuration
# WASM
cargo install wasm-server-runner
cargo run --example webtransport_client -F client --target wasm32-unknown-unknown
aeronet_steam
: over Steam's networking sockets
cargo run --example steam_echo_server -F server
cargo run --example steam_client -F client
aeronet_replicon
: high-level replication via bevy_replicon
cargo run --bin move_box_server
cargo run --bin move_box_client
aeronet
is fundamentally split into multiple layers:
aeronet_io
Session
is, and how it behavesaeronet_channel
, aeronet_webtransport
, etc.
aeronet_transport
aeronet_transport
specificallyaeronet
, but you can use a crate which integrates aeronet
with one of these e.g. aeronet_replicon
To learn about how to use this crate, it is recommended that you learn the architecture by skimming
the examples and reading the documentation of important types such as Session
. If you're not
sure where to start, take a look at the echo_client
and echo_server
crates. The examples are
designed to be self-contained and self-documenting, giving you an easy jumping-off point for
learning.
Crates and items are thoroughly documented through rustdoc, and are the most likely to be up to date, so you should use that as the definitive reference for information on specific items.
Once you have a rough idea of the architecture, choose an IO layer implementation from the list at
the top, add it and aeronet
to your app, and start building!
aeronet
aeronet
and its subcrates use a combination of:
cargo
, for individual, self-contained featurescargo
, for testing code in the context of a full Bevy app
aeronet_channel
has integration testscargo-fuzz
, for protocol-level features and parsing
aeronet_transport
To run the fuzz tests:
cd crates/aeronet_transport
cargo +nightly fuzz run <fuzz target>
As a debug tool, you may want to see the state of your session over time while you are in the app.
If using aeronet_transport
, you can use the visualizer
feature to enable an egui_plot
visualizer which displays statistics on sessions. This includes data such as round-trip time and
packet loss percentage.
Using a conditioner allows you to emulate poor network conditions locally, and see how your app copes with problems such as duplicate or lost packets, delay, and jitter.
Some example tools you may use are:
tc
sudo tc qdisc add dev lo root netem delay 250ms
sudo tc qdisc add dev lo root netem delay 200ms 50ms distribution normal
sudo tc qdisc add dev lo root netem loss 50%
sudo tc qdisc delete dev lo root
aeronet
does not provide support for conditioning within the networking crate itself, since
conditioning testing is more effective (and representative of real-world results) when the
conditioning is applied at the lowest level possible.