Save
Some checks failed
Rust Checks / checks (push) Failing after 1m7s

This commit is contained in:
Tipragot 2024-02-10 10:33:09 +01:00
parent 9dee5ad781
commit 33b11b71c3
3 changed files with 13 additions and 1 deletions

1
Cargo.lock generated
View file

@ -402,6 +402,7 @@ version = "0.2.0"
dependencies = [
"aes-gcm",
"base64 0.21.7",
"bevy",
"igd",
"local-ip-address",
]

View file

@ -16,3 +16,4 @@ local-ip-address = "0.5.7"
aes-gcm = "0.10.3"
base64 = "0.21.7"
igd = "0.12.1"
bevy = "0.12.1"

View file

@ -42,13 +42,14 @@
//! # }
//! ```
use std::collections::LinkedList;
use std::collections::{HashMap, LinkedList};
use std::io::{self, Read, Write};
use std::net::{IpAddr, Ipv4Addr, SocketAddrV4, TcpListener, TcpStream};
use aes_gcm::aead::{Aead, AeadCore, KeyInit, OsRng};
use aes_gcm::{Aes128Gcm, Key, Nonce};
use base64::prelude::*;
use bevy::prelude::*;
use igd::{Gateway, PortMappingProtocol};
use local_ip_address::local_ip;
@ -367,3 +368,12 @@ impl Drop for Listener {
.ok();
}
}
/// A resource that store the last event id used to register an [Event].
///
/// This is used to give an unique id to each event.
#[derive(Resource, Default)]
struct LastEventId(u16);
/// An extension trait for the bevy [App] to allow registering network events.
pub trait NetworkAppExt {}