From b922bf56e3771fe6227a082762f685dac11d8e15 Mon Sep 17 00:00:00 2001 From: Jett Chen Date: Sun, 17 Dec 2023 02:15:27 +0800 Subject: [PATCH] build for linux --- burrow/src/daemon/net/systemd.rs | 5 +++++ burrow/src/main.rs | 4 ++-- burrow/src/wireguard/config.rs | 1 - tun/src/unix/linux/mod.rs | 8 ++++---- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/burrow/src/daemon/net/systemd.rs b/burrow/src/daemon/net/systemd.rs index 8a2b29c..e619c04 100644 --- a/burrow/src/daemon/net/systemd.rs +++ b/burrow/src/daemon/net/systemd.rs @@ -1,3 +1,8 @@ +use super::*; +use crate::daemon::DaemonResponse; +use anyhow::Result; +use std::os::fd::IntoRawFd; + pub async fn listen( cmd_tx: async_channel::Sender, rsp_rx: async_channel::Receiver, diff --git a/burrow/src/main.rs b/burrow/src/main.rs index 5003277..645ed5b 100644 --- a/burrow/src/main.rs +++ b/burrow/src/main.rs @@ -68,7 +68,7 @@ async fn try_start() -> Result<()> { .map(|_| ()) } -#[cfg(any(target_os = "linux", target_vendor = "apple"))] +#[cfg(target_vendor = "apple")] #[instrument] async fn try_retrieve() -> Result<()> { LogTracer::init() @@ -165,7 +165,7 @@ async fn try_start() -> Result<()> { Ok(()) } -#[cfg(not(any(target_os = "linux", target_vendor = "apple")))] +#[cfg(not(target_vendor = "apple"))] async fn try_retrieve() -> Result<()> { Ok(()) } diff --git a/burrow/src/wireguard/config.rs b/burrow/src/wireguard/config.rs index b198174..a2599d4 100644 --- a/burrow/src/wireguard/config.rs +++ b/burrow/src/wireguard/config.rs @@ -4,7 +4,6 @@ use base64::engine::general_purpose; use base64::Engine; use fehler::throws; use ip_network::IpNetwork; -use nix::libc::malloc_printf; use std::net::ToSocketAddrs; use std::str::FromStr; use x25519_dalek::{PublicKey, StaticSecret}; diff --git a/tun/src/unix/linux/mod.rs b/tun/src/unix/linux/mod.rs index b4b5b8c..e60429f 100644 --- a/tun/src/unix/linux/mod.rs +++ b/tun/src/unix/linux/mod.rs @@ -13,8 +13,8 @@ use fehler::throws; use libc::in6_ifreq; use socket2::{Domain, SockAddr, Socket, Type}; use tracing::{info, instrument}; - -use super::{ifname_to_string, string_to_ifname, TunOptions}; +use super::{ifname_to_string, string_to_ifname}; +use crate::TunOptions; mod sys; @@ -40,10 +40,10 @@ impl TunInterface { let mut flags = libc::IFF_TUN as i16; - if options.no_pi.is_some() { + if options.no_pi { flags |= libc::IFF_NO_PI as i16; } - if options.tun_excl.is_some() { + if options.tun_excl { flags |= libc::IFF_TUN_EXCL as i16; }