Changes to be committed:

modified:   src/tcp_client.rs
	modified:   src/tcp_server.rs
This commit is contained in:
Michael Wain 2024-08-14 22:15:26 +03:00
parent ddca6f3441
commit b1f4021c98
2 changed files with 3 additions and 2 deletions

View File

@ -102,7 +102,7 @@ pub async fn client_mode(remote_addr: String) {
let mut buf = vec![0; 4096]; let mut buf = vec![0; 4096];
loop { loop {
if let Ok(n) = sock_reader.read(&mut buf).await { if let Ok(n) = sock_reader.read(&mut buf).await {
//info!("Catch from socket: {:?}", &buf[..n]); info!("Catch from socket");
match bincode::deserialize::<VpnPacket>(&buf[..n]) { match bincode::deserialize::<VpnPacket>(&buf[..n]) {
Ok(vpn_packet) => tx.send(vpn_packet.data).unwrap(), Ok(vpn_packet) => tx.send(vpn_packet.data).unwrap(),
Err(error) => error!("Deserialization error {:?}", error), Err(error) => error!("Deserialization error {:?}", error),

View File

@ -87,7 +87,8 @@ pub async fn server_mode(bind_addr: String) {
tokio::spawn(async move { tokio::spawn(async move {
while let Ok(mut bytes) = rx.recv() { while let Ok(mut bytes) = rx.recv() {
info!("Source ip: {:?}", &bytes[12..=15]); info!("Got packet");
//info!("Source ip: {:?}", &bytes[12..=15]);
//bytes[12] = 192; //bytes[12] = 192;
//bytes[13] = 168; //bytes[13] = 168;
//bytes[14] = 0; //bytes[14] = 0;