Changes to be committed:
modified: src/client.rs modified: src/server.rs
This commit is contained in:
parent
93d67ace44
commit
46aaf3dccb
@ -4,7 +4,7 @@ use tokio::task::JoinSet;
|
||||
use packet::{builder::Builder, icmp, ip, Packet};
|
||||
use std::io::{Read, Write};
|
||||
use tun2::BoxError;
|
||||
use log::{error, info, LevelFilter};
|
||||
use log::{error, info, warn, LevelFilter};
|
||||
use std::sync::Arc;
|
||||
use std::net::{ SocketAddr, Ipv4Addr };
|
||||
use std::collections::HashMap;
|
||||
@ -143,6 +143,8 @@ pub async fn client_mode(client_config: ClientConfiguration) {
|
||||
Ok(decrypted) => { tx.send(decrypted); },
|
||||
Err(error) => error!("Decryption error! {:?}", error)
|
||||
}
|
||||
} else {
|
||||
warn!("There is no static_secret");
|
||||
}
|
||||
}, // payload
|
||||
_ => error!("Unexpected header value.")
|
||||
@ -175,7 +177,11 @@ pub async fn client_mode(client_config: ClientConfiguration) {
|
||||
let serialized_data = vpn_packet.serialize();
|
||||
info!("Writing to sock: {:?}", serialized_data);
|
||||
sock_snd.send(&serialized_data).await.unwrap();
|
||||
} else {
|
||||
error!("Socket encryption failed.");
|
||||
}
|
||||
} else {
|
||||
warn!("There is no shared_secret in main loop");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,6 +67,8 @@ pub async fn server_mode(server_config: ServerConfiguration) {
|
||||
if let Ok(ciphered_d) = ciphered_data {
|
||||
let vpn_packet = UDPVpnPacket{ data: ciphered_d, nonce: nonce.to_vec()};
|
||||
sock_snd.send_to(&vpn_packet.serialize(), peer.addr).await;
|
||||
} else {
|
||||
error!("Traffic encryption failed.");
|
||||
}
|
||||
} else {
|
||||
// TODO: check in config is broadcast mode enabled (if not, do not send this to everyone)
|
||||
|
Loading…
x
Reference in New Issue
Block a user