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:
parent
1949d2a2fa
commit
0e8b83493f
@ -24,7 +24,7 @@ pub mod general {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl CoreVpnClient {
|
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...");
|
info!("Starting client...");
|
||||||
|
|
||||||
let dr_cancel: CancellationToken = CancellationToken::new();
|
let dr_cancel: CancellationToken = CancellationToken::new();
|
||||||
|
@ -34,14 +34,14 @@ pub struct DeviceReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl DeviceWriter {
|
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?;
|
self.writer.send_all(buf).await?;
|
||||||
Ok(0)
|
Ok(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DeviceReader {
|
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?;
|
let n = self.reader.recv(buf).await?;
|
||||||
Ok(n)
|
Ok(n)
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ pub struct DeviceReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl DeviceWriter {
|
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)?;
|
let mut write_pack = self.session.allocate_send_packet(buf.len() as u16)?;
|
||||||
write_pack.bytes_mut().copy_from_slice(buf);
|
write_pack.bytes_mut().copy_from_slice(buf);
|
||||||
self.session.send_packet(write_pack);
|
self.session.send_packet(write_pack);
|
||||||
@ -86,7 +86,7 @@ impl DeviceWriter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl DeviceReader {
|
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()?;
|
let packet = self.session.receive_blocking()?;
|
||||||
*buf = packet.bytes().to_vec();
|
*buf = packet.bytes().to_vec();
|
||||||
Ok(buf.len())
|
Ok(buf.len())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user