Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@ netlink-sys = "0.8"

[target.'cfg(windows)'.dependencies.windows-sys]
version = "0.59"
features = ["Win32_Foundation", "Win32_NetworkManagement_IpHelper", "Win32_Networking_WinSock", "Win32_NetworkManagement_Ndis"]
features = [
"Win32_Foundation",
"Win32_NetworkManagement_IpHelper",
"Win32_Networking_WinSock",
"Win32_NetworkManagement_Ndis",
]

[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies]
[target.'cfg(target_vendor = "apple")'.dependencies]
system-configuration = "0.6"

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ This project was rebranded from [default-net][default-net-crates-io-url] by the

## Supported platform
- Linux
- macOS
- macOS and other Apple targets (iOS, watchOS, tvOS, etc.)
- Windows

## Usage
Expand Down
2 changes: 1 addition & 1 deletion src/gateway/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#[cfg(any(target_os = "openbsd", target_os = "freebsd", target_os = "netbsd"))]
pub(crate) mod bsd;

#[cfg(any(target_os = "macos", target_os = "ios"))]
#[cfg(target_vendor = "apple")]
pub(crate) mod macos;

#[cfg(any(target_os = "linux", target_os = "android"))]
Expand Down
8 changes: 3 additions & 5 deletions src/interface/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,19 @@ pub use self::types::*;

#[cfg(any(
target_os = "linux",
target_os = "macos",
target_vendor = "apple",
target_os = "openbsd",
target_os = "freebsd",
target_os = "netbsd",
target_os = "ios",
target_os = "android"
))]
mod unix;
#[cfg(any(
target_os = "linux",
target_os = "macos",
target_vendor = "apple",
target_os = "openbsd",
target_os = "freebsd",
target_os = "netbsd",
target_os = "ios",
target_os = "android"
))]
use self::unix::*;
Expand All @@ -41,7 +39,7 @@ mod linux;
#[cfg(target_os = "android")]
mod android;

#[cfg(any(target_os = "macos", target_os = "ios"))]
#[cfg(target_vendor = "apple")]
mod macos;
#[cfg(feature = "gateway")]
use crate::device::NetworkDevice;
Expand Down
5 changes: 2 additions & 3 deletions src/interface/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,10 @@ impl InterfaceType {
}
/// Returns OS-specific value of InterfaceType
#[cfg(any(
target_os = "macos",
target_vendor = "apple",
target_os = "openbsd",
target_os = "freebsd",
target_os = "netbsd",
target_os = "ios"
target_os = "netbsd"
))]
pub fn value(&self) -> u32 {
match *self {
Expand Down
16 changes: 6 additions & 10 deletions src/interface/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub fn get_system_dns_conf() -> Vec<IpAddr> {
}
}

#[cfg(any(target_os = "macos", target_os = "ios"))]
#[cfg(target_vendor = "apple")]
pub fn interfaces() -> Vec<Interface> {
use super::macos;

Expand Down Expand Up @@ -214,11 +214,10 @@ pub(super) fn sockaddr_to_network_addr(
}

#[cfg(any(
target_vendor = "apple",
target_os = "openbsd",
target_os = "freebsd",
target_os = "netbsd",
target_os = "macos",
target_os = "ios"
target_os = "netbsd"
))]
fn sockaddr_to_network_addr(
sa: *mut libc::sockaddr,
Expand Down Expand Up @@ -261,8 +260,7 @@ fn sockaddr_to_network_addr(
}

#[cfg(any(
target_os = "macos",
target_os = "ios",
target_vendor = "apple",
target_os = "openbsd",
target_os = "freebsd",
target_os = "netbsd"
Expand All @@ -286,8 +284,7 @@ pub fn is_running(interface: &Interface) -> bool {
}

#[cfg(any(
target_os = "macos",
target_os = "ios",
target_vendor = "apple",
target_os = "openbsd",
target_os = "freebsd",
target_os = "netbsd"
Expand All @@ -304,8 +301,7 @@ pub fn is_physical_interface(interface: &Interface) -> bool {
}

#[cfg(any(
target_os = "macos",
target_os = "ios",
target_vendor = "apple",
target_os = "openbsd",
target_os = "freebsd",
target_os = "netbsd"
Expand Down
Loading