diff --git a/README.md b/README.md index fd9a620..4925f09 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,8 @@ async fn main(){ let mut ipstack_config = ipstack::IpStackConfig::default(); ipstack_config.mtu(MTU); - ipstack_config.packet_information(cfg!(unix)); + let packet_information = cfg!(all(target_family = "unix", not(target_os = "android"))); + ipstack_config.packet_information(packet_information); let mut ip_stack = ipstack::IpStack::new(ipstack_config, tun::create_as_async(&config).unwrap()); while let Ok(stream) = ip_stack.accept().await { diff --git a/examples/tun.rs b/examples/tun.rs index 2af5e20..bfafc9e 100644 --- a/examples/tun.rs +++ b/examples/tun.rs @@ -66,7 +66,8 @@ async fn main() -> Result<(), Box> { let mut ipstack_config = ipstack::IpStackConfig::default(); ipstack_config.mtu(MTU); - ipstack_config.packet_information(cfg!(unix)); + let packet_information = cfg!(all(target_family = "unix", not(target_os = "android"))); + ipstack_config.packet_information(packet_information); let mut ip_stack = ipstack::IpStack::new(ipstack_config, tun2::create_as_async(&config)?); diff --git a/src/lib.rs b/src/lib.rs index 6bfc485..d48e103 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -35,14 +35,14 @@ const TTL: u8 = 128; #[cfg(unix)] const TUN_FLAGS: [u8; 2] = [0x00, 0x00]; -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "android"))] const TUN_PROTO_IP6: [u8; 2] = [0x86, 0xdd]; -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "android"))] const TUN_PROTO_IP4: [u8; 2] = [0x08, 0x00]; -#[cfg(target_os = "macos")] -const TUN_PROTO_IP6: [u8; 2] = [0x00, 0x02]; -#[cfg(target_os = "macos")] +#[cfg(any(target_os = "macos", target_os = "ios"))] +const TUN_PROTO_IP6: [u8; 2] = [0x00, 0x0A]; +#[cfg(any(target_os = "macos", target_os = "ios"))] const TUN_PROTO_IP4: [u8; 2] = [0x00, 0x02]; pub struct IpStackConfig {