pub enum SocketAddress {
TcpIpV4 {
addr: [u8; 4],
port: u16,
},
TcpIpV6 {
addr: [u8; 16],
port: u16,
},
OnionV2([u8; 12]),
OnionV3 {
ed25519_pubkey: [u8; 32],
checksum: u16,
version: u8,
port: u16,
},
Hostname {
hostname: Hostname,
port: u16,
},
}Expand description
An address which can be used to connect to a remote peer.
Variants§
TcpIpV4
An IPv4 address and port on which the peer is listening.
TcpIpV6
An IPv6 address and port on which the peer is listening.
OnionV2([u8; 12])
An old-style Tor onion address/port on which the peer is listening.
This field is deprecated and the Tor network generally no longer supports V2 Onion addresses. Thus, the details are not parsed here.
OnionV3
A new-style Tor onion address/port on which the peer is listening.
To create the human-readable “hostname”, concatenate the ED25519 pubkey, checksum, and version, wrap as base32 and append “.onion”.
Fields
Hostname
A hostname/port on which the peer is listening.
Trait Implementations§
Source§impl Clone for SocketAddress
impl Clone for SocketAddress
Source§fn clone(&self) -> SocketAddress
fn clone(&self) -> SocketAddress
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SocketAddress
impl Debug for SocketAddress
Source§impl Display for SocketAddress
impl Display for SocketAddress
Source§impl From<SocketAddr> for SocketAddress
Available on crate feature std only.
impl From<SocketAddr> for SocketAddress
Available on crate feature
std only.Source§fn from(addr: SocketAddr) -> Self
fn from(addr: SocketAddr) -> Self
Converts to this type from the input type.
Source§impl From<SocketAddrV4> for SocketAddress
Available on crate feature std only.
impl From<SocketAddrV4> for SocketAddress
Available on crate feature
std only.Source§fn from(addr: SocketAddrV4) -> Self
fn from(addr: SocketAddrV4) -> Self
Converts to this type from the input type.
Source§impl From<SocketAddrV6> for SocketAddress
Available on crate feature std only.
impl From<SocketAddrV6> for SocketAddress
Available on crate feature
std only.Source§fn from(addr: SocketAddrV6) -> Self
fn from(addr: SocketAddrV6) -> Self
Converts to this type from the input type.
Source§impl FromStr for SocketAddress
Available on crate feature std only.
impl FromStr for SocketAddress
Available on crate feature
std only.Source§impl Hash for SocketAddress
impl Hash for SocketAddress
Source§impl PartialEq for SocketAddress
impl PartialEq for SocketAddress
Source§impl Readable for SocketAddress
impl Readable for SocketAddress
Source§fn read<R: Read>(reader: &mut R) -> Result<SocketAddress, DecodeError>
fn read<R: Read>(reader: &mut R) -> Result<SocketAddress, DecodeError>
Reads a
Self in from the given Read.Source§impl ToSocketAddrs for SocketAddress
Available on crate feature std only.
impl ToSocketAddrs for SocketAddress
Available on crate feature
std only.Source§type Iter = IntoIter<SocketAddr>
type Iter = IntoIter<SocketAddr>
Returned iterator over socket addresses which this type may correspond
to.
Source§fn to_socket_addrs(&self) -> Result<Self::Iter>
fn to_socket_addrs(&self) -> Result<Self::Iter>
Converts this object to an iterator of resolved
SocketAddrs. Read moreSource§impl Writeable for SocketAddress
impl Writeable for SocketAddress
impl Eq for SocketAddress
impl StructuralPartialEq for SocketAddress
Auto Trait Implementations§
impl Freeze for SocketAddress
impl RefUnwindSafe for SocketAddress
impl Send for SocketAddress
impl Sync for SocketAddress
impl Unpin for SocketAddress
impl UnwindSafe for SocketAddress
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> LengthReadable for Twhere
T: Readable,
impl<T> LengthReadable for Twhere
T: Readable,
Source§fn read_from_fixed_length_buffer<R>(reader: &mut R) -> Result<T, DecodeError>where
R: LengthLimitedRead,
fn read_from_fixed_length_buffer<R>(reader: &mut R) -> Result<T, DecodeError>where
R: LengthLimitedRead,
Reads a
Self in from the given LengthLimitedRead.