aboutsummaryrefslogtreecommitdiff
path: root/tests/utils/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/utils/mod.rs')
-rw-r--r--tests/utils/mod.rs19
1 files changed, 13 insertions, 6 deletions
diff --git a/tests/utils/mod.rs b/tests/utils/mod.rs
index 24b0ac8..55a1353 100644
--- a/tests/utils/mod.rs
+++ b/tests/utils/mod.rs
@@ -1,4 +1,8 @@
-use std::{thread::sleep, time::Duration};
+use std::{
+ net::{IpAddr, Ipv4Addr},
+ thread::sleep,
+ time::Duration,
+};
use bevy::{
app::ScheduleRunnerPlugin,
@@ -17,7 +21,7 @@ use bevy_quinnet::{
},
server::{
self, certificate::CertificateRetrievalMode, QuinnetServerPlugin, Server,
- ServerConfigurationData,
+ ServerConfiguration,
},
shared::{
channel::{ChannelId, ChannelType},
@@ -56,7 +60,8 @@ pub enum SharedMessage {
TestMessage(String),
}
-pub const SERVER_HOST: &str = "127.0.0.1";
+pub const SERVER_IP: IpAddr = IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1));
+pub const LOCAL_BIND_IP: IpAddr = IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0));
pub fn build_client_app() -> App {
let mut client_app = App::new();
@@ -81,7 +86,7 @@ pub fn build_server_app() -> App {
}
pub fn default_client_configuration(port: u16) -> ConnectionConfiguration {
- ConnectionConfiguration::new(SERVER_HOST.to_string(), port, "0.0.0.0".to_string(), 0)
+ ConnectionConfiguration::from_ips(SERVER_IP, port, LOCAL_BIND_IP, 0)
}
pub fn start_simple_connection(mut client: ResMut<Client>, port: Res<Port>) {
@@ -96,8 +101,10 @@ pub fn start_simple_connection(mut client: ResMut<Client>, port: Res<Port>) {
pub fn start_listening(mut server: ResMut<Server>, port: Res<Port>) {
server
.start_endpoint(
- ServerConfigurationData::new(SERVER_HOST.to_string(), port.0, "0.0.0.0".to_string()),
- CertificateRetrievalMode::GenerateSelfSigned,
+ ServerConfiguration::from_ip(LOCAL_BIND_IP, port.0),
+ CertificateRetrievalMode::GenerateSelfSigned {
+ server_hostname: SERVER_IP.to_string(),
+ },
)
.unwrap();
}