From f672bb6c1e1e371240a8d151f15854687eb740bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cruz?= Date: Tue, 24 Oct 2023 21:53:26 +0100 Subject: [PATCH] build: add apple tvOS support (#365) --- boringtun-cli/src/main.rs | 2 +- boringtun/src/device/mod.rs | 6 +++--- boringtun/src/sleepyinstant/unix.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/boringtun-cli/src/main.rs b/boringtun-cli/src/main.rs index 026ec29..922ce10 100644 --- a/boringtun-cli/src/main.rs +++ b/boringtun-cli/src/main.rs @@ -11,7 +11,7 @@ use std::process::exit; use tracing::Level; fn check_tun_name(_v: String) -> Result<(), String> { - #[cfg(any(target_os = "macos", target_os = "ios"))] + #[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))] { if boringtun::device::tun::parse_utun_name(&_v).is_ok() { Ok(()) diff --git a/boringtun/src/device/mod.rs b/boringtun/src/device/mod.rs index 04cd728..b250f5e 100644 --- a/boringtun/src/device/mod.rs +++ b/boringtun/src/device/mod.rs @@ -9,7 +9,7 @@ pub mod drop_privileges; mod integration_tests; pub mod peer; -#[cfg(any(target_os = "macos", target_os = "ios"))] +#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))] #[path = "kqueue.rs"] pub mod poll; @@ -17,7 +17,7 @@ pub mod poll; #[path = "epoll.rs"] pub mod poll; -#[cfg(any(target_os = "macos", target_os = "ios"))] +#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))] #[path = "tun_darwin.rs"] pub mod tun; @@ -75,7 +75,7 @@ pub enum Error { SetSockOpt(String), #[error("Invalid tunnel name")] InvalidTunnelName, - #[cfg(any(target_os = "macos", target_os = "ios"))] + #[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))] #[error("{0}")] GetSockOpt(io::Error), #[error("{0}")] diff --git a/boringtun/src/sleepyinstant/unix.rs b/boringtun/src/sleepyinstant/unix.rs index 40aaeba..8488c2f 100644 --- a/boringtun/src/sleepyinstant/unix.rs +++ b/boringtun/src/sleepyinstant/unix.rs @@ -3,9 +3,9 @@ use std::time::Duration; use nix::sys::time::TimeSpec; use nix::time::{clock_gettime, ClockId}; -#[cfg(any(target_os = "macos", target_os = "ios"))] +#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))] const CLOCK_ID: ClockId = ClockId::CLOCK_MONOTONIC; -#[cfg(not(any(target_os = "macos", target_os = "ios")))] +#[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "tvos")))] const CLOCK_ID: ClockId = ClockId::CLOCK_BOOTTIME; #[derive(Clone, Copy, Debug)]