Changes to be committed:
modified: src/tcp_client.rs modified: src/tcp_server.rs
This commit is contained in:
parent
ddca6f3441
commit
b1f4021c98
@ -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),
|
||||||
|
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user