Struct tor_linkspec::BridgeAddr
source · pub struct BridgeAddr(_);Expand description
An address of a bridge, for use in configuration.
Contains precisely, either:
- A hostname (as a string), plus a
u16port; or - An (IPv4 or IPv6) socket address including port - i.e., a
SocketAddr, or to put it another way, an IP address (v4 or v6) plus au16port.
Hostnames which are not syntactically invalid Internet hostnames,
and a port value of zero,
can be represented within a BridgeAddr.
Implementations§
source§impl BridgeAddr
impl BridgeAddr
sourcepub fn new_addr_from_sockaddr(sa: SocketAddr) -> Self
pub fn new_addr_from_sockaddr(sa: SocketAddr) -> Self
Create a new BridgeAddr referring to a numeric address and port
sourcepub fn as_socketaddr(&self) -> Option<&SocketAddr>
pub fn as_socketaddr(&self) -> Option<&SocketAddr>
If this is a numeric address, return it as a SocketAddr
sourcepub fn new_named_host_port(hostname: impl Into<String>, port: u16) -> Self
pub fn new_named_host_port(hostname: impl Into<String>, port: u16) -> Self
Create a new BridgeAddr referring to a numeric address and port
sourcepub fn as_host_port(&self) -> Option<(&str, u16)>
pub fn as_host_port(&self) -> Option<(&str, u16)>
If this is a named host and port, return it as hostname string and port
Trait Implementations§
source§impl Clone for BridgeAddr
impl Clone for BridgeAddr
source§fn clone(&self) -> BridgeAddr
fn clone(&self) -> BridgeAddr
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 moresource§impl Debug for BridgeAddr
impl Debug for BridgeAddr
source§impl<'de> Deserialize<'de> for BridgeAddrwhere
Self: FromStr,
<Self as FromStr>::Err: Display,
impl<'de> Deserialize<'de> for BridgeAddrwhere
Self: FromStr,
<Self as FromStr>::Err: Display,
source§fn deserialize<__D>(deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for BridgeAddr
impl Display for BridgeAddr
source§impl FromStr for BridgeAddr
impl FromStr for BridgeAddr
source§impl Hash for BridgeAddr
impl Hash for BridgeAddr
source§impl PartialEq<BridgeAddr> for BridgeAddr
impl PartialEq<BridgeAddr> for BridgeAddr
source§fn eq(&self, other: &BridgeAddr) -> bool
fn eq(&self, other: &BridgeAddr) -> bool
source§impl Redactable for BridgeAddr
impl Redactable for BridgeAddr
source§fn display_redacted(&self, f: &mut Formatter<'_>) -> Result
fn display_redacted(&self, f: &mut Formatter<'_>) -> Result
As
Display::fmt, but produce a redacted representation.source§fn debug_redacted(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn debug_redacted(&self, f: &mut Formatter<'_>) -> Result<(), Error>
As
Debug::fmt, but produce a redacted representation.source§fn redacted(&self) -> Redacted<&Self>
fn redacted(&self) -> Redacted<&Self>
Return a smart pointer that will display or debug this object as its
redacted form. Read more
source§fn maybe_redacted(&self, redact: bool) -> MaybeRedacted<&Self>
fn maybe_redacted(&self, redact: bool) -> MaybeRedacted<&Self>
Return a smart pointer that redacts this object if
redact is true.