Skip to content

Commit

Permalink
prep v0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
UkoeHB committed Jan 15, 2025
1 parent 9d10fbc commit 4681d8d
Show file tree
Hide file tree
Showing 19 changed files with 41 additions and 47 deletions.
12 changes: 6 additions & 6 deletions bevy_renet2/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "bevy_renet2"
description = "Bevy plugin for the renet2 crate"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
keywords = ["gamedev", "networking"]
license = "MIT OR Apache-2.0"
Expand Down Expand Up @@ -32,16 +32,16 @@ required-features = ["serde", "netcode"]
bevy_app = {version = "0.15", default-features = false}
bevy_ecs = {version = "0.15", default-features = false}
bevy_time = {version = "0.15", default-features = false}
renet2 = {path = "../renet2", version = "0.1.0", default-features = false, features = ["bevy"]}
renet2_netcode = {path = "../renet2_netcode", version = "0.1.0", optional = true, default-features = false, features = ["bevy"]}
renet2_steam = {path = "../renet2_steam", version = "0.1.0", optional = true, default-features = false, features = ["bevy"]}
renet2 = {path = "../renet2", default-features = false, features = ["bevy"]}
renet2_netcode = {path = "../renet2_netcode", optional = true, default-features = false, features = ["bevy"]}
renet2_steam = {path = "../renet2_steam", optional = true, default-features = false, features = ["bevy"]}
steamworks = {version = "0.11", optional = true}

[dev-dependencies]
bevy = {version = "0.15", default-features = false, features = ["bevy_core_pipeline", "bevy_render", "bevy_window", "bevy_asset", "bevy_pbr", "x11", "tonemapping_luts", "ktx2", "zstd"]}
bincode = "1.3"
env_logger = "0.11"
renet2 = {path = "../renet2", version = "0.1.0", default-features = false, features = ["bevy"] }
renet2_netcode = {path = "../renet2_netcode", version = "0.1.0", default-features = false, features = ["bevy", "memory_transport"]}
renet2 = {path = "../renet2", default-features = false, features = ["bevy"] }
renet2_netcode = {path = "../renet2_netcode", default-features = false, features = ["bevy", "memory_transport"]}
serde = {version = "1.0", features = ["derive"]}
tracing-subscriber = { version = "0.3", features = [ "env-filter", "std", "tracing-log" ] }
2 changes: 1 addition & 1 deletion bevy_renet2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,4 @@ If you want a more complex example you can checkout the [demo_bevy](https://gith

|bevy|bevy_renet2|
|----|-----------|
|0.15|0.0.7 - 0.1.0|
|0.15|0.0.7 - 0.1|
6 changes: 3 additions & 3 deletions bevy_replicon_renet2/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_replicon_renet2"
version = "0.1.0"
version = "0.1.1"
authors = [
"Hennadii Chernyshchyk <[email protected]>",
"koe <[email protected]>",
Expand All @@ -23,13 +23,13 @@ rustdoc-args = ["-Zunstable-options", "--cfg", "docsrs"]

[dependencies]
bevy_replicon = { version = "0.29", default-features = false }
bevy_renet2 = { path = "../bevy_renet2", version = "0.1.0", default-features = false }
bevy_renet2 = { path = "../bevy_renet2", default-features = false }
bevy = { version = "0.15", default-features = false }

[dev-dependencies]
serde = "1.0"
clap = { version = "4.1", features = ["derive"] }
bevy_renet2 = { path = "../bevy_renet2", version = "0.1.0", features = ["native_transport"] }
bevy_renet2 = { path = "../bevy_renet2", features = ["native_transport"] }
bevy = { version = "0.15", default-features = false, features = [
"bevy_state",
"bevy_text",
Expand Down
2 changes: 1 addition & 1 deletion bevy_replicon_renet2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ An integration of `bevy_renet2` as a messaging backend for [`bevy_replicon`](htt

| bevy_replicon_renet2 | bevy_renet2 | bevy_replicon | bevy |
| -------------------- | ----------- | ------------- | ------ |
| 0.1.0 | 0.1.0 | 0.29 | 0.15.0 |
| 0.1 | 0.1 | 0.29 | 0.15.0 |
| 0.0.9 | 0.0.7 | 0.29 | 0.15.0 |
| 0.0.5 | 0.0.4 | 0.26 | 0.14.0 |
| 0.0.4 | 0.0.3 | 0.26 | 0.14.0 |
Expand Down
4 changes: 2 additions & 2 deletions bevy_replicon_renet2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ If the `transport` feature is enabled, netcode plugins will also be automaticall
## Server and client creation
To connect to the server or create it, you need to initialize the
[`RenetClient`](renet2::RenetClient) and [`NetcodeClientTransport`](renet2::transport::NetcodeClientTransport) **or**
[`RenetServer`](renet2::RenetServer) and [`NetcodeServerTransport`](renet2::transport::NetcodeServerTransport) resources from Renet.
[`RenetClient`](renet2::RenetClient) and `renet2_netcode::NetcodeClientTransport` **or**
[`RenetServer`](renet2::RenetServer) and `renet2_netcode::NetcodeServerTransport` resources from Renet.
Never insert client and server resources in the same app for single-player, it will cause a replication loop.
Expand Down
11 changes: 1 addition & 10 deletions demo_bevy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,7 @@ netcode = ["bevy_renet2/netcode"]
steam = ["bevy_renet2/steam"]

[dependencies]
bevy = { version = "0.15", default-features = false, features = [
"bevy_core_pipeline",
"bevy_render",
"bevy_asset",
"bevy_pbr",
"x11",
"tonemapping_luts",
"ktx2",
"zstd",
] }
bevy = { version = "0.15", default-features = true }
bevy_renet2 = { path = "../bevy_renet2", default-features = false }
serde = { version = "1.0", features = ["derive"] }
bincode = "1.3"
Expand Down
2 changes: 1 addition & 1 deletion renet2/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "renet2"
version = "0.1.0"
version = "0.1.1"
authors = ["koe <[email protected]>"]
description = "Server/Client network protocol library for multiplayer games, forked from renet"
edition = "2021"
Expand Down
2 changes: 1 addition & 1 deletion renet2/src/remote_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ impl RenetClient {
///
/// It will be false for sockets like UDP or WebTransport, and true for in-memory sockets and WebSockets.
///
/// See [`TransportSocket::is_reliable`].
/// See `ClientSocket::is_reliable` in `renet2_netcode`.
pub fn new(mut config: ConnectionConfig, has_reliable_socket: bool) -> Self {
if has_reliable_socket {
config.downgrade_to_unreliable();
Expand Down
6 changes: 3 additions & 3 deletions renet2_netcode/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "renet2_netcode"
version = "0.1.0"
version = "0.1.1"
authors = ["koe <[email protected]>"]
description = "Netcode integration for renet2"
edition = "2021"
Expand Down Expand Up @@ -97,8 +97,8 @@ ws_client_transport = [
bytes = "1.1"
log = "0.4"
octets = "0.3"
renetcode2 = { path = "../renetcode2", version = "0.1.0" }
renet2 = { path = "../renet2", version = "0.1.0" }
renetcode2 = { path = "../renetcode2" }
renet2 = { path = "../renet2" }
hmac-sha256 = { version = "1.1" }
url = { version = "2.4" }
bevy_ecs = { version = "0.15", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion renet2_netcode/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl NetcodeClientTransport {
/// Disconnects the client from the transport layer.
///
/// This sends the disconnect packet instantly, use this when closing/exiting games,
/// should use [RenetClient::disconnect][crate::RenetClient::disconnect] otherwise.
/// should use [RenetClient::disconnect] otherwise.
pub fn disconnect(&mut self) {
if self.netcode_client.is_disconnected() {
return;
Expand Down
2 changes: 1 addition & 1 deletion renet2_netcode/src/native_socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::net::{SocketAddr, UdpSocket};

use super::{ClientSocket, NetcodeError, NetcodeTransportError, ServerSocket};

/// Implementation of [`TransportSocket`] for `UdpSockets`.
/// Implementation of [`ServerSocket`] for `UdpSockets`.
#[derive(Debug)]
pub struct NativeSocket {
socket: UdpSocket,
Expand Down
2 changes: 1 addition & 1 deletion renet2_netcode/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ impl NetcodeServerTransport {
/// Disconnects all connected clients.
///
/// This sends the disconnect packet instantly, use this when closing/exiting games,
/// should use [RenetServer::disconnect_all][crate::RenetServer::disconnect_all] otherwise.
/// should use [RenetServer::disconnect_all] otherwise.
pub fn disconnect_all(&mut self, server: &mut RenetServer) {
for client_id in self.netcode_server.clients_id() {
let server_result = self.netcode_server.disconnect(client_id);
Expand Down
14 changes: 9 additions & 5 deletions renet2_netcode/src/sockets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use super::NetcodeTransportError;
/// Note that while `netcode` uses `SocketAddr` everywhere, if your transport uses a different 'connection URL'
/// scheme then you can layer the bytes into the [`ConnectToken`](renetcode2::ConnectToken) server address list.
/// Just keep in mind that when a client disconnects, the client will traverse the server address list to find
/// an address to reconnect with. If that isn't supported by your scheme, then when [`TransportSocket::send`] is
/// an address to reconnect with. If that isn't supported by your scheme, then when [`ServerSocket::send`] is
/// called with an invalid/unexpected server address you should return an error. If you want to support
/// multiple server addresses but your URLs exceed 16 bytes (IPV6 addresses are 16 bytes), then you should pre-parse
/// the server list from the connect token, and then map that list to the 16-byte IPV6 segments that will be produced
Expand All @@ -21,8 +21,8 @@ pub trait ServerSocket: Debug + Send + Sync + 'static {
fn is_encrypted(&self) -> bool;
/// Gets the reliability of the socket.
///
/// If this is true, then `RenetServer` will 'downgrade' all channels to
/// [`crate::channel::SendType::Unreliable`] so there is not a redundant reliability layer.
/// If this is true, then [`RenetServer`](renet2::RenetServer) will 'downgrade' all channels to
/// [`SendType::Unreliable`](renet2::SendType::Unreliable) so there is not a redundant reliability layer.
fn is_reliable(&self) -> bool;

/// Gets the data source's `SocketAddr`.
Expand Down Expand Up @@ -79,11 +79,15 @@ pub trait ClientSocket: Debug + Send + Sync + 'static {
///
/// If the socket internally encrypts packets before sending them, then this should return `true`.
/// In that case, `renetcode` will not pre-encrypt packets before [`Self::send`] is called.
///
/// Should match the encryption policy of the server socket you will connect to.
fn is_encrypted(&self) -> bool;
/// Gets the reliability of the socket.
///
/// If this is true, then `RenetServer` will 'downgrade' all channels to
/// [`crate::channel::SendType::Unreliable`] so there is not a redundant reliability layer.
/// If this is true, then [`RenetClient`](renet2::RenetClient) will 'downgrade' all channels to
/// [`SendType::Unreliable`](renet2::SendType::Unreliable) so there is not a redundant reliability layer.
///
/// Should match the reliability of the server socket you will connect to.
fn is_reliable(&self) -> bool;

/// Gets the data source's `SocketAddr`.
Expand Down
1 change: 0 additions & 1 deletion renet2_netcode/src/websocket_socket/server/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ pub struct WebSocketServerConfig {
/// Socket address to listen on.
///
/// It is recommended to use a pre-defined IP and a wildcard port.
/// The pre-defined IP should be used when obtaining [`Self::cert`] from your certificate authority (CA).
///
/// Using a wildcard port will reduce your chance of competing with other sockets on your machine (e.g. other
/// WebTransport servers running different game instances).
Expand Down
6 changes: 3 additions & 3 deletions renet2_netcode/src/webtransport_socket/server/cert_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{ServerCertHash, WebServerDestination};

/// Generates a self-signed certificate for use in `WebTransportConfig`.
///
/// The [`PrivateKey`] should not be publicized.
/// The [`PrivateKeyDer`] should not be publicized.
pub fn generate_self_signed_certificate(
params: CertificateParams,
) -> Result<(CertificateDer<'static>, PrivateKeyDer<'static>), rcgen::Error> {
Expand All @@ -27,7 +27,7 @@ pub fn generate_self_signed_certificate(
/// - The validity period is set to 2 weeks from now to support [`ServerCertHash`].
/// - ECDSA is used, not RSA.
///
/// The [`PrivateKey`] should not be publicized.
/// The [`PrivateKeyDer`] should not be publicized.
pub fn generate_self_signed_certificate_opinionated<T: Into<WebServerDestination>>(
subject_alt_names: impl IntoIterator<Item = T>,
) -> Result<(CertificateDer<'static>, PrivateKeyDer<'static>), rcgen::Error> {
Expand Down Expand Up @@ -93,7 +93,7 @@ fn _spki_fingerprint_base64(cert: &Certificate) -> Option<String> {
}
*/

/// Gets a [`ServerCertHash`] from a [`Certificate`].
/// Gets a [`ServerCertHash`] from a [`CertificateDer`].
pub fn get_server_cert_hash(cert: &CertificateDer<'_>) -> ServerCertHash {
let hash = hmac_sha256::Hash::hash(cert.as_ref());
ServerCertHash { hash }
Expand Down
4 changes: 2 additions & 2 deletions renet2_netcode/src/webtransport_socket/server/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub struct WebTransportServerConfig {
}

impl WebTransportServerConfig {
/// Makes a new config with a self-signed [`Certificate`] tied to the `listen` address.
/// Makes a new config with a self-signed [`CertificateDer`] tied to the `listen` address.
///
/// Returns the [`ServerCertHash`] of the certificate, which can be used to set up clients via
/// `WebTransportClientConfig`.
Expand All @@ -66,7 +66,7 @@ impl WebTransportServerConfig {
Self::new_selfsigned_with_proxies(listen, vec![listen.into()], max_clients)
}

/// Makes a new config with a self-signed [`Certificate`] tied to the `proxies` destinations.
/// Makes a new config with a self-signed [`CertificateDer`] tied to the `proxies` destinations.
///
/// Returns the [`ServerCertHash`] of the certificate, which can be used to set up clients via
/// `WebTransportClientConfig`.
Expand Down
4 changes: 2 additions & 2 deletions renet2_steam/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "renet2_steam"
version = "0.1.0"
version = "0.1.1"
keywords = ["gamedev", "networking", "transport"]
description = "steam transport for the renet2 crate"
repository = "https://github.com/UkoeHB/renet2"
Expand All @@ -17,7 +17,7 @@ rustdoc-args = ["-Zunstable-options", "--cfg", "docsrs"]
bevy = ["dep:bevy_ecs"]

[dependencies]
renet2 = { version = "0.1.0", path = "../renet2" }
renet2 = { path = "../renet2" }
steamworks = "0.11"
log = "0.4.19"
bevy_ecs = { version = "0.15", optional = true }
Expand Down
4 changes: 2 additions & 2 deletions renet2_visualizer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "renet2_visualizer"
version = "0.1.0"
version = "0.1.1"
keywords = ["gamedev", "networking"]
description = "Egui metrics visualizer for the renet2 crate"
repository = "https://github.com/UkoeHB/renet2"
Expand All @@ -16,6 +16,6 @@ rustdoc-args = ["-Zunstable-options", "--cfg", "docsrs"]
bevy = ["dep:bevy_ecs"]

[dependencies]
renet2 = { path = "../renet2", version = "0.1.0" }
renet2 = { path = "../renet2" }
egui = "0.29"
bevy_ecs = { version = "0.15", optional = true }
2 changes: 1 addition & 1 deletion renetcode2/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "renetcode2"
version = "0.1.0"
version = "0.1.1"
description = "Server/Client network protocol library for multiplayer games"
keywords = ["gamedev", "networking", "cryptography"]
repository = "https://github.com/UkoeHB/renet2"
Expand Down

0 comments on commit 4681d8d

Please sign in to comment.