Skip to content

Commit

Permalink
examples/utils: only compile TunTap on Linux or Android
Browse files Browse the repository at this point in the history
  • Loading branch information
thvdveld committed Sep 16, 2024
1 parent 45a18a2 commit f18cf53
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions examples/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ use std::process;
use std::str::{self, FromStr};
use std::time::{SystemTime, UNIX_EPOCH};

#[cfg(feature = "phy-tuntap_interface")]
#[cfg(all(
feature = "phy-tuntap_interface",
any(target_os = "linux", target_os = "android")
))]
use smoltcp::phy::TunTapInterface;
use smoltcp::phy::{Device, FaultInjector, Medium, Tracer};
use smoltcp::phy::{PcapMode, PcapWriter};
Expand Down Expand Up @@ -96,7 +99,10 @@ pub fn add_tuntap_options(opts: &mut Options, _free: &mut [&str]) {
opts.optopt("", "tap", "TAP interface to use", "tap0");
}

#[cfg(feature = "phy-tuntap_interface")]
#[cfg(all(
feature = "phy-tuntap_interface",
any(target_os = "linux", target_os = "android")
))]
pub fn parse_tuntap_options(matches: &mut Matches) -> TunTapInterface {
let tun = matches.opt_str("tun");
let tap = matches.opt_str("tap");
Expand Down

0 comments on commit f18cf53

Please sign in to comment.