modified: src/client.rs

This commit is contained in:
Michael Wain 2024-09-26 02:33:51 +03:00
parent 3c88e03d9e
commit 9615c18aee

View File

@ -40,7 +40,7 @@ pub async fn client_mode(client_config: ClientConfiguration, fd: i32) {
tokio::spawn(async move { tokio::spawn(async move {
while let Ok(bytes) = rx.recv() { while let Ok(bytes) = rx.recv() {
//info!("Write to tun {:?}", hex::encode(&bytes)); info!("Write to tun {:?}", hex::encode(&bytes));
dev_writer.write_all(&bytes).unwrap(); dev_writer.write_all(&bytes).unwrap();
} }
}); });
@ -123,6 +123,7 @@ pub async fn client_mode(client_config: ClientConfiguration, fd: i32) {
if let Ok(ciphered_d) = ciphered_data { if let Ok(ciphered_d) = ciphered_data {
let vpn_packet = UDPVpnPacket{ data: ciphered_d, nonce: nonce.to_vec()}; let vpn_packet = UDPVpnPacket{ data: ciphered_d, nonce: nonce.to_vec()};
let serialized_data = vpn_packet.serialize(); let serialized_data = vpn_packet.serialize();
info!("Sent to socket");
sock_snd.send(&serialized_data).await.unwrap(); sock_snd.send(&serialized_data).await.unwrap();
} else { } else {
error!("Socket encryption failed."); error!("Socket encryption failed.");