Changes to be committed:

modified:   src/client.rs
	modified:   src/main.rs
This commit is contained in:
Michael Wain 2024-08-22 18:11:05 +03:00
parent d06f10fc2f
commit 475ef4ec6d
2 changed files with 3 additions and 3 deletions

View File

@ -169,7 +169,7 @@ pub async fn client_mode(client_config: ClientConfiguration) {
if s_c.is_some() { if s_c.is_some() {
let aes = Aes256Gcm::new(s_c.as_ref().unwrap().as_bytes().into()); let aes = Aes256Gcm::new(s_c.as_ref().unwrap().as_bytes().into());
let nonce = Aes256Gcm::generate_nonce(&mut OsRng); let nonce = Aes256Gcm::generate_nonce(&mut OsRng);
info!("Nonce len: {:?}", &nonce.len());
let ciphered_data = aes.encrypt(&nonce, &bytes[..]); let ciphered_data = aes.encrypt(&nonce, &bytes[..]);
if let Ok(ciphered_d) = ciphered_data { if let Ok(ciphered_d) = ciphered_data {

View File

@ -35,7 +35,7 @@ impl VpnPacket {
} }
struct UDPVpnPacket { struct UDPVpnPacket {
nonce: Vec<u8>, // [u8; 64] nonce: Vec<u8>, // [u8; 12]
data: Vec<u8> data: Vec<u8>
} }
@ -48,7 +48,7 @@ impl UDPSerializable for UDPVpnPacket {
impl UDPVpnPacket { impl UDPVpnPacket {
fn deserialize(data: &Vec<u8>) -> Self { fn deserialize(data: &Vec<u8>) -> Self {
UDPVpnPacket { nonce: data[1..=64].to_vec(), data: data[65..].to_vec() } UDPVpnPacket { nonce: data[1..=12].to_vec(), data: data[13..].to_vec() }
} }
} }