make tun dependency optional (#142)

* remove log crates
* remove udp/raw of smoltcp
* make tun as optional dependancy, compile for freebsd works
This commit is contained in:
Sijie.Sun
2024-06-11 09:09:32 +08:00
committed by GitHub
parent 8aa57ebc22
commit 34f832bbad
26 changed files with 310 additions and 488 deletions
+2 -2
View File
@@ -43,7 +43,7 @@ impl NetNSGuard {
}
let ns = std::fs::File::open(ns_path).unwrap();
log::info!(
tracing::info!(
"[INIT NS] switching to new ns_name: {:?}, ns_file: {:?}",
name,
ns
@@ -59,7 +59,7 @@ impl Drop for NetNSGuard {
if self.old_ns.is_none() {
return;
}
log::info!("[INIT NS] switching back to old ns, ns: {:?}", self.old_ns);
tracing::info!("[INIT NS] switching back to old ns, ns: {:?}", self.old_ns);
setns(
self.old_ns.as_ref().unwrap().as_fd(),
CloneFlags::CLONE_NEWNET,