build: add apple tvOS support (#365)

This commit is contained in:
Luís Cruz 2023-10-24 21:53:26 +01:00 committed by GitHub
parent 62c88737db
commit f672bb6c1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

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

View File

@ -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}")]

View File

@ -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)]