build for linux

This commit is contained in:
Jett Chen 2023-12-17 02:15:27 +08:00
parent 5297f61f9f
commit b922bf56e3
4 changed files with 11 additions and 7 deletions

View file

@ -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<DaemonCommand>,
rsp_rx: async_channel::Receiver<DaemonResponse>,

View file

@ -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(())
}

View file

@ -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};

View file

@ -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;
}