rest of previous commit

This commit is contained in:
PoliEcho 2025-07-27 20:50:33 +02:00
parent 49e3aa1a3a
commit 0235de2896
3 changed files with 13 additions and 2 deletions

View File

@ -65,4 +65,14 @@ pub enum RegisterRequestDataPositions {
DATA = (SALT_AND_IV_SIZE + RegisterRequestDataPositions::IV as u8) as isize, // after this there will be id and sockaddr in string or encrypted form after DATA = (SALT_AND_IV_SIZE + RegisterRequestDataPositions::IV as u8) as isize, // after this there will be id and sockaddr in string or encrypted form after
} }
#[allow(non_camel_case_types)]
pub enum GetResponseDataPositions {
ENCRYPTED = 1, // this feeld should be 0 if not encrypted
ID_LEN = 2,
NUM_OF_CLIENTS = 3,
SALT = 4,
CLIENTS = (SALT_AND_IV_SIZE + RegisterRequestDataPositions::SALT as u8) as isize,
// after this there will be blocks of this sturcture: one byte size of sockaddr than there will be IV that is SALT_AND_IV_SIZE long and after that there will be sockaddr this repeats until the end of packet
}
pub mod shared; pub mod shared;

View File

@ -9,7 +9,7 @@ use rayon::prelude::*;
use std::sync::Arc; use std::sync::Arc;
use std::u8; use std::u8;
pub async fn handle_request( pub async fn handle_request(
mut buf: [u8; BUFFER_SIZE], buf: [u8; BUFFER_SIZE],
socket: std::sync::Arc<std::net::UdpSocket>, socket: std::sync::Arc<std::net::UdpSocket>,
src: core::net::SocketAddr, src: core::net::SocketAddr,
data_len: usize, data_len: usize,

View File

@ -1,6 +1,7 @@
use pea_2_pea::*; use pea_2_pea::*;
use std::sync::{Arc, atomic::Ordering}; use std::sync::{Arc, atomic::Ordering};
#[derive(Clone)]
#[readonly::make] #[readonly::make]
pub struct Client { pub struct Client {
#[readonly] #[readonly]
@ -19,7 +20,7 @@ impl Client {
} }
} }
} }
#[derive(Clone)]
#[readonly::make] #[readonly::make]
pub struct Registration { pub struct Registration {
#[readonly] #[readonly]