Skip to content

Commit

Permalink
feat: iOS Support (#128)
Browse files Browse the repository at this point in the history
iOS Support
  • Loading branch information
GalaxyShard authored Sep 27, 2023
1 parent f54c3f9 commit ad07565
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pub use crate::linux::*;
target_os = "dragonfly",
target_os = "macos",
target_os = "android",
target_os = "ios",
))]
pub mod unix;

Expand All @@ -82,6 +83,7 @@ pub mod unix;
target_os = "dragonfly",
target_os = "macos",
target_os = "android",
target_os = "ios",
))]
pub use crate::unix::*;

Expand Down Expand Up @@ -115,6 +117,7 @@ pub fn local_ip() -> Result<IpAddr, Error> {
target_os = "dragonfly",
target_os = "macos",
target_os = "android",
target_os = "ios",
))]
{
let ifas = crate::unix::list_afinet_netifas_info()?;
Expand Down Expand Up @@ -152,6 +155,7 @@ pub fn local_ip() -> Result<IpAddr, Error> {
target_os = "netbsd",
target_os = "dragonfly",
target_os = "android",
target_os = "ios",
)))]
{
Err(Error::PlatformNotSupported(
Expand Down Expand Up @@ -185,6 +189,7 @@ pub fn local_ipv6() -> Result<IpAddr, Error> {
target_os = "dragonfly",
target_os = "macos",
target_os = "android",
target_os = "ios",
))]
{
let ifas = crate::unix::list_afinet_netifas_info()?;
Expand Down Expand Up @@ -222,6 +227,7 @@ pub fn local_ipv6() -> Result<IpAddr, Error> {
target_os = "netbsd",
target_os = "dragonfly",
target_os = "android",
target_os = "ios",
)))]
{
Err(Error::PlatformNotSupported(
Expand All @@ -240,6 +246,7 @@ pub fn local_ipv6() -> Result<IpAddr, Error> {
target_os = "netbsd",
target_os = "dragonfly",
target_os = "android",
target_os = "ios",
)))]
pub fn list_afinet_netifas() -> Result<Vec<(String, IpAddr)>, Error> {
Err(Error::PlatformNotSupported(
Expand Down Expand Up @@ -268,6 +275,7 @@ mod tests {
target_os = "dragonfly",
target_os = "macos",
target_os = "android",
target_os = "ios",
))]
fn find_local_ip() {
let my_local_ip = local_ip();
Expand Down Expand Up @@ -302,6 +310,7 @@ mod tests {
target_os = "dragonfly",
target_os = "macos",
target_os = "android",
target_os = "ios",
))]
fn find_network_interfaces() {
let network_interfaces = list_afinet_netifas();
Expand Down

0 comments on commit ad07565

Please sign in to comment.