pub struct OnionAddr {
pub port: u16,
/* private fields */
}Expand description
A v3, Copyable onion address.
Fields§
§port: u16Virtual port of the peer
Implementations§
Source§impl OnionAddr
impl OnionAddr
Sourcepub fn new(addr: &str, port: u16) -> Result<Self, OnionAddrParsingError>
pub fn new(addr: &str, port: u16) -> Result<Self, OnionAddrParsingError>
Attempt to create an OnionAddr from a complete .onion address string and a port.
Return an OnionAddrParsingError if the supplied addr is invalid.
Sourcepub fn check_addr(addr: &str) -> Result<[u8; 56], OnionAddrParsingError>
pub fn check_addr(addr: &str) -> Result<[u8; 56], OnionAddrParsingError>
Establish if the .onion address is valid.
Return the 56 character domain bytes if valid, OnionAddrParsingError otherwise.
Sourcepub fn addr_string(&self) -> String
pub fn addr_string(&self) -> String
Generate an onion address string.
Returns a String containing the onion domain name and “.onion” TLD only, in form of zbjkbs...ofptid.onion.
pub const fn port(&self) -> u16
pub const fn domain(&self) -> [u8; 56]
Trait Implementations§
Source§impl BorshDeserialize for OnionAddr
impl BorshDeserialize for OnionAddr
fn deserialize_reader<__R: Read>(reader: &mut __R) -> Result<Self, Error>
§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
impl Copy for OnionAddr
Source§impl<'de> Deserialize<'de> for OnionAddr
Available on crate feature serde only.
impl<'de> Deserialize<'de> for OnionAddr
serde only.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>,
Source§impl Display for OnionAddr
Display for OnionAddr. It prints the onion address and port, in the form of <domain>.onion:<port>
impl Display for OnionAddr
Display for OnionAddr. It prints the onion address and port, in the form of <domain>.onion:<port>
impl Eq for OnionAddr
Source§impl From<OnionAddr> for NetworkAddress
impl From<OnionAddr> for NetworkAddress
impl StructuralPartialEq for OnionAddr
Source§impl TryFrom<NetworkAddress> for OnionAddr
impl TryFrom<NetworkAddress> for OnionAddr
Source§type Error = NetworkAddressIncorrectZone
type Error = NetworkAddressIncorrectZone
Auto Trait Implementations§
impl Freeze for OnionAddr
impl RefUnwindSafe for OnionAddr
impl Send for OnionAddr
impl Sync for OnionAddr
impl Unpin for OnionAddr
impl UnsafeUnpin for OnionAddr
impl UnwindSafe for OnionAddr
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§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
§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
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 58 bytes