merge boringtun into burrow
This commit is contained in:
parent
e643d9dd41
commit
28af9003d0
39 changed files with 3122 additions and 228 deletions
|
|
@ -1,13 +1,11 @@
|
|||
use std::{io::Error, net::Ipv4Addr};
|
||||
|
||||
use fehler::throws;
|
||||
use std::io::Error;
|
||||
use std::net::Ipv4Addr;
|
||||
use tun::TunInterface;
|
||||
|
||||
#[test]
|
||||
#[throws]
|
||||
fn test_create() {
|
||||
TunInterface::new()?;
|
||||
}
|
||||
fn test_create() { TunInterface::new()?; }
|
||||
|
||||
#[test]
|
||||
#[throws]
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
use fehler::throws;
|
||||
use std::io::Error;
|
||||
use std::{io::Error, net::Ipv4Addr};
|
||||
|
||||
use std::net::Ipv4Addr;
|
||||
use fehler::throws;
|
||||
use tun::TunInterface;
|
||||
|
||||
#[throws]
|
||||
|
|
@ -9,8 +8,8 @@ use tun::TunInterface;
|
|||
#[ignore = "requires interactivity"]
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
fn tst_read() {
|
||||
// This test is interactive, you need to send a packet to any server through 192.168.1.10
|
||||
// EG. `sudo route add 8.8.8.8 192.168.1.10`,
|
||||
// This test is interactive, you need to send a packet to any server through
|
||||
// 192.168.1.10 EG. `sudo route add 8.8.8.8 192.168.1.10`,
|
||||
//`dig @8.8.8.8 hackclub.com`
|
||||
let mut tun = TunInterface::new()?;
|
||||
println!("tun name: {:?}", tun.name()?);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use std::net::Ipv4Addr;
|
|||
#[cfg(all(feature = "tokio", not(target_os = "windows")))]
|
||||
async fn test_create() {
|
||||
let tun = tun::TunInterface::new().unwrap();
|
||||
let async_tun = tun::tokio::TunInterface::new(tun).unwrap();
|
||||
let _ = tun::tokio::TunInterface::new(tun).unwrap();
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
|
@ -17,6 +17,6 @@ async fn test_write() {
|
|||
let async_tun = tun::tokio::TunInterface::new(tun).unwrap();
|
||||
let mut buf = [0u8; 1500];
|
||||
buf[0] = 6 << 4;
|
||||
let bytes_written = async_tun.write(&buf).await.unwrap();
|
||||
let bytes_written = async_tun.send(&buf).await.unwrap();
|
||||
assert!(bytes_written > 0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue