summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--talpid-tunnel/src/tun_provider/mod.rs2
-rw-r--r--talpid-tunnel/src/tun_provider/unix.rs9
2 files changed, 7 insertions, 4 deletions
diff --git a/talpid-tunnel/src/tun_provider/mod.rs b/talpid-tunnel/src/tun_provider/mod.rs
index 94a82735d1..1bf4e1abb4 100644
--- a/talpid-tunnel/src/tun_provider/mod.rs
+++ b/talpid-tunnel/src/tun_provider/mod.rs
@@ -35,6 +35,7 @@ cfg_if! {
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct TunConfig {
/// Interface name to use.
+ #[cfg(target_os = "linux")]
pub name: Option<String>,
/// IP addresses for the tunnel interface.
@@ -80,6 +81,7 @@ impl TunConfig {
/// Android to route all traffic inside the tunnel.
pub fn blocking_config() -> TunConfig {
TunConfig {
+ #[cfg(target_os = "linux")]
name: None,
addresses: vec![IpAddr::V4(Ipv4Addr::new(10, 0, 0, 1))],
mtu: 1380,
diff --git a/talpid-tunnel/src/tun_provider/unix.rs b/talpid-tunnel/src/tun_provider/unix.rs
index b045dad877..6286779cee 100644
--- a/talpid-tunnel/src/tun_provider/unix.rs
+++ b/talpid-tunnel/src/tun_provider/unix.rs
@@ -66,10 +66,11 @@ impl UnixTunProvider {
#[allow(unused_mut)]
let mut builder = TunnelDeviceBuilder::default();
#[cfg(target_os = "linux")]
- builder.enable_packet_information();
- #[cfg(target_os = "linux")]
- if let Some(ref name) = self.config.name {
- builder.name(name);
+ {
+ builder.enable_packet_information();
+ if let Some(ref name) = self.config.name {
+ builder.name(name);
+ }
}
builder.create()?
};