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
This method tests for
self and other values to be equal, and is used
by ==.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.
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.source§impl Serialize for BridgeAddrwhere
Self: Display,
impl Serialize for BridgeAddrwhere Self: Display,
impl Eq for BridgeAddr
impl StructuralEq for BridgeAddr
impl StructuralPartialEq for BridgeAddr
Auto Trait Implementations§
impl RefUnwindSafe for BridgeAddr
impl Send for BridgeAddr
impl Sync for BridgeAddr
impl Unpin for BridgeAddr
impl UnwindSafe for BridgeAddr
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
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§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 Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.