Enum SocketAddress
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§
§impl Clone for SocketAddress
impl Clone for SocketAddress
§fn clone(&self) -> SocketAddress
fn clone(&self) -> SocketAddress
Returns a copy 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 more§impl Debug for SocketAddress
impl Debug for SocketAddress
§impl Display for SocketAddress
impl Display for SocketAddress
§impl From<SocketAddr> for SocketAddress
impl From<SocketAddr> for SocketAddress
§fn from(addr: SocketAddr) -> SocketAddress
fn from(addr: SocketAddr) -> SocketAddress
Converts to this type from the input type.
§impl From<SocketAddrV4> for SocketAddress
impl From<SocketAddrV4> for SocketAddress
§fn from(addr: SocketAddrV4) -> SocketAddress
fn from(addr: SocketAddrV4) -> SocketAddress
Converts to this type from the input type.
§impl From<SocketAddrV6> for SocketAddress
impl From<SocketAddrV6> for SocketAddress
§fn from(addr: SocketAddrV6) -> SocketAddress
fn from(addr: SocketAddrV6) -> SocketAddress
Converts to this type from the input type.
§impl FromStr for SocketAddress
impl FromStr for SocketAddress
§type Err = SocketAddressParseError
type Err = SocketAddressParseError
The associated error which can be returned from parsing.
§fn from_str(s: &str) -> Result<SocketAddress, <SocketAddress as FromStr>::Err>
fn from_str(s: &str) -> Result<SocketAddress, <SocketAddress as FromStr>::Err>
Parses a string
s
to return a value of this type. Read more§impl PartialEq for SocketAddress
impl PartialEq for SocketAddress
§impl Readable for SocketAddress
impl Readable for SocketAddress
§fn read<R>(reader: &mut R) -> Result<SocketAddress, DecodeError>where
R: Read,
fn read<R>(reader: &mut R) -> Result<SocketAddress, DecodeError>where
R: Read,
Reads a
Self
in from the given Read
.§impl ToSocketAddrs for SocketAddress
impl ToSocketAddrs for SocketAddress
§type Iter = IntoIter<SocketAddr>
type Iter = IntoIter<SocketAddr>
Returned iterator over socket addresses which this type may correspond
to.
§fn to_socket_addrs(
&self,
) -> Result<<SocketAddress as ToSocketAddrs>::Iter, Error>
fn to_socket_addrs( &self, ) -> Result<<SocketAddress as ToSocketAddrs>::Iter, Error>
Converts this object to an iterator of resolved
SocketAddr
s. Read more§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§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request