From 0e8b83493f3b6987c13631beb4b0cfb444fcae97 Mon Sep 17 00:00:00 2001 From: "alterwain@protonmail.com" Date: Tue, 10 Dec 2024 18:19:14 +0200 Subject: [PATCH] Mutable attempt modified: frida_client/src/client.rs modified: frida_core/src/linux_tun.rs modified: frida_core/src/win_tun.rs --- frida_client/src/client.rs | 2 +- frida_core/src/linux_tun.rs | 4 ++-- frida_core/src/win_tun.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/frida_client/src/client.rs b/frida_client/src/client.rs index 81e5829..86cb117 100644 --- a/frida_client/src/client.rs +++ b/frida_client/src/client.rs @@ -24,7 +24,7 @@ pub mod general { } impl CoreVpnClient { - pub async fn start(&mut self, sock: UdpSocket, dev_reader: DeviceReader, dev_writer: DeviceWriter, mtu: u16) { + pub async fn start(&mut self, sock: UdpSocket, mut dev_reader: DeviceReader, mut dev_writer: DeviceWriter, mtu: u16) { info!("Starting client..."); let dr_cancel: CancellationToken = CancellationToken::new(); diff --git a/frida_core/src/linux_tun.rs b/frida_core/src/linux_tun.rs index f933083..472daf8 100644 --- a/frida_core/src/linux_tun.rs +++ b/frida_core/src/linux_tun.rs @@ -34,14 +34,14 @@ pub struct DeviceReader { } impl DeviceWriter { - pub async fn write(&self, buf: &Vec) -> Result> { + pub async fn write(&mut self, buf: &Vec) -> Result> { self.writer.send_all(buf).await?; Ok(0) } } impl DeviceReader { - pub async fn read(&self, buf: &mut Vec) -> Result> { + pub async fn read(&mut self, buf: &mut Vec) -> Result> { let n = self.reader.recv(buf).await?; Ok(n) } diff --git a/frida_core/src/win_tun.rs b/frida_core/src/win_tun.rs index 1c18a7d..01c9543 100644 --- a/frida_core/src/win_tun.rs +++ b/frida_core/src/win_tun.rs @@ -77,7 +77,7 @@ pub struct DeviceReader { } impl DeviceWriter { - pub async fn write(&self, buf: &Vec) -> Result> { + pub async fn write(&mut self, buf: &Vec) -> Result> { let mut write_pack = self.session.allocate_send_packet(buf.len() as u16)?; write_pack.bytes_mut().copy_from_slice(buf); self.session.send_packet(write_pack); @@ -86,7 +86,7 @@ impl DeviceWriter { } impl DeviceReader { - pub async fn read(&self, buf: &mut Vec) -> Result> { + pub async fn read(&mut self, buf: &mut Vec) -> Result> { let packet = self.session.receive_blocking()?; *buf = packet.bytes().to_vec(); Ok(buf.len())