incorporate wireguard daemon with network interface
This commit is contained in:
parent
f1649ce3b2
commit
bf15221a7b
3 changed files with 25 additions and 8 deletions
|
|
@ -44,7 +44,11 @@ impl TunInterface {
|
|||
#[throws]
|
||||
#[instrument]
|
||||
pub fn recv(&mut self, buf: &mut [u8]) -> usize {
|
||||
self.socket.read(buf)?
|
||||
// there might be a more efficient way to implement this
|
||||
let tmp_buf = &mut [0u8; 1500];
|
||||
let len = self.socket.read(tmp_buf)?;
|
||||
buf[..len-4].copy_from_slice(&tmp_buf[4..len]);
|
||||
len-4
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue