Implementing linux tun adapter
Some checks failed
gitea/Frida/pipeline/head There was a failure building this commit
Some checks failed
gitea/Frida/pipeline/head There was a failure building this commit
new file: frida_core/src/linux_tun.rs modified: frida_core/src/main.rs modified: frida_core/src/win_tun.rs
This commit is contained in:
parent
0edc0fef1d
commit
32eec5252a
36
frida_core/src/linux_tun.rs
Normal file
36
frida_core/src/linux_tun.rs
Normal file
@ -0,0 +1,36 @@
|
||||
use std::sync::Arc;
|
||||
use std::error::Error;
|
||||
|
||||
pub fn create() -> (DeviceReader, DeviceWriter) {
|
||||
let tun = Arc::new(
|
||||
Tun::builder()
|
||||
.name("") // if name is empty, then it is set by kernel.
|
||||
.tap() // uses TAP instead of TUN (default).
|
||||
.packet_info() // avoids setting IFF_NO_PI.
|
||||
.up() // or set it up manually using `sudo ip link set <tun-name> up`.
|
||||
.try_build() // or `.try_build_mq(queues)` for multi-queue support.
|
||||
.unwrap(),
|
||||
);
|
||||
|
||||
println!("tun created, name: {}, fd: {}", tun.name(), tun.as_raw_fd());
|
||||
|
||||
let (mut reader, mut _writer) = tokio::io::split(tun);
|
||||
}
|
||||
|
||||
pub struct DeviceWriter {
|
||||
|
||||
}
|
||||
|
||||
pub struct DeviceReader {
|
||||
|
||||
}
|
||||
|
||||
impl DeviceWriter {
|
||||
pub async fn write(&self, buf: &Vec<u8>) -> Result<usize, Box<dyn Error>> {
|
||||
}
|
||||
}
|
||||
|
||||
impl DeviceReader {
|
||||
pub async fn read(&self, buf: &mut Vec<u8>) -> Result<usize, Box<dyn Error>> {
|
||||
}
|
||||
}
|
@ -3,8 +3,13 @@ use log::{info, error, LevelFilter};
|
||||
|
||||
mod device;
|
||||
mod tun;
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
mod win_tun;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
mod linux_tun;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
Builder::new()
|
||||
|
Loading…
x
Reference in New Issue
Block a user