Mutable attempt

modified:   frida_client/src/client.rs
	modified:   frida_core/src/linux_tun.rs
	modified:   frida_core/src/win_tun.rs
This commit is contained in:
Michael Wain 2024-12-10 18:19:14 +02:00
parent 1949d2a2fa
commit 0e8b83493f
3 changed files with 5 additions and 5 deletions

View File

@ -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();

View File

@ -34,14 +34,14 @@ pub struct DeviceReader {
}
impl DeviceWriter {
pub async fn write(&self, buf: &Vec<u8>) -> Result<usize, Box<dyn Error>> {
pub async fn write(&mut self, buf: &Vec<u8>) -> Result<usize, Box<dyn Error>> {
self.writer.send_all(buf).await?;
Ok(0)
}
}
impl DeviceReader {
pub async fn read(&self, buf: &mut Vec<u8>) -> Result<usize, Box<dyn Error>> {
pub async fn read(&mut self, buf: &mut Vec<u8>) -> Result<usize, Box<dyn Error>> {
let n = self.reader.recv(buf).await?;
Ok(n)
}

View File

@ -77,7 +77,7 @@ pub struct DeviceReader {
}
impl DeviceWriter {
pub async fn write(&self, buf: &Vec<u8>) -> Result<usize, Box<dyn Error>> {
pub async fn write(&mut self, buf: &Vec<u8>) -> Result<usize, Box<dyn Error>> {
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<u8>) -> Result<usize, Box<dyn Error>> {
pub async fn read(&mut self, buf: &mut Vec<u8>) -> Result<usize, Box<dyn Error>> {
let packet = self.session.receive_blocking()?;
*buf = packet.bytes().to_vec();
Ok(buf.len())