diff --git a/src/wire/ip.rs b/src/wire/ip.rs index 3fc85ea..16c9de6 100644 --- a/src/wire/ip.rs +++ b/src/wire/ip.rs @@ -214,6 +214,19 @@ impl From<::std::net::IpAddr> for Address { } } +#[cfg(feature = "std")] +impl From
for ::std::net::IpAddr { + fn from(x: Address) -> ::std::net::IpAddr { + match x { + #[cfg(feature = "proto-ipv4")] + Address::Ipv4(ipv4) => ::std::net::IpAddr::V4(ipv4.into()), + #[cfg(feature = "proto-ipv6")] + Address::Ipv6(ipv6) => ::std::net::IpAddr::V6(ipv6.into()), + _ => unreachable!(), + } + } +} + #[cfg(all(feature = "std", feature = "proto-ipv4"))] impl From<::std::net::Ipv4Addr> for Address { fn from(ipv4: ::std::net::Ipv4Addr) -> Address {