add makefile
This commit is contained in:
parent
60257b256a
commit
6339b6bc4b
39 changed files with 3145 additions and 248 deletions
|
|
@ -2,6 +2,7 @@ use std::{
|
|||
io::{Error, Read},
|
||||
os::fd::{AsRawFd, FromRawFd, IntoRawFd, RawFd},
|
||||
};
|
||||
|
||||
use tracing::instrument;
|
||||
|
||||
use super::TunOptions;
|
||||
|
|
@ -28,9 +29,8 @@ impl AsRawFd for TunInterface {
|
|||
|
||||
impl FromRawFd for TunInterface {
|
||||
unsafe fn from_raw_fd(fd: RawFd) -> TunInterface {
|
||||
TunInterface {
|
||||
socket: socket2::Socket::from_raw_fd(fd),
|
||||
}
|
||||
let socket = socket2::Socket::from_raw_fd(fd);
|
||||
TunInterface { socket }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -65,4 +65,4 @@ pub fn string_to_ifname(name: &str) -> [libc::c_char; libc::IFNAMSIZ] {
|
|||
let len = name.len().min(buf.len());
|
||||
buf[..len].copy_from_slice(unsafe { &*(name.as_bytes() as *const _ as *const [libc::c_char]) });
|
||||
buf
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue