Adding missed convertor for InetSocketAddr
use std::fmt;
use std::str::FromStr;
use std::convert::TryFrom;
-use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
+use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr};
#[cfg(feature="use-tor")]
use torut::onion::{TorPublicKeyV3, OnionAddressV3, TORV3_PUBLIC_KEY_LENGTH};
@@ -434,6 +434,13 @@ impl TryFrom<InetSocketAddr> for std::net::SocketAddr {
}
}
+impl From<std::net::SocketAddr> for InetSocketAddr {
+ #[inline]
+ fn from(addr: SocketAddr) -> Self {
+ Self::new(addr.ip().into(), addr.port())
+ }
+}
+
pub struct InetSocketAddrExt(pub Transport, pub InetSocketAddr);
