[−][src]Enum internet2::addr::InetAddr
A universal address covering IPv4, IPv6 and Tor in a single byte sequence of 32 bytes.
Holds either:
- IPv4-to-IPv6 address
- IPv6 address
- Tor address (V2 and V3)
NB: we are using TorPublicKeyV3
instead of OnionAddressV3
, since
OnionAddressV3
keeps checksum and other information which can be
reconstructed from TorPublicKeyV3
. The 2-byte checksum in OnionAddressV3
is designed for human-readable part that checks that the address was typed
in correctly. In computer-stored digital data it may be deterministically
regenerated and does not add any additional security.
For Version2 Tor support only OnionAddressV2
handling is supported.
OnionAddressV2
can only be constructed from an address string.
Tor addresses are distinguished by the fact that last 16 bits must be set to 0
Variants (Non-exhaustive)
IPv4(Ipv4Addr)
IP address of V4 standard
IPv6(Ipv6Addr)
IP address of V6 standard
Tor address of V3 standard
Tor address of V2 standard
Implementations
impl InetAddr
[src]
pub fn to_ipv6(&self) -> Option<Ipv6Addr>
[src]
Returns an IPv6 address, constructed from IPv4 data; or, if Onion
address is used, Option::None
pub fn to_ipv4(&self) -> Option<Ipv6Addr>
[src]
Returns an IPv4 address, if any, or Option::None
pub fn is_tor(&self) -> bool
[src]
Determines whether provided address is a Tor address
pub fn to_onion_v2(&self) -> Option<OnionAddressV2>
[src]
Returns Onion v2 address, if any, or Option::None
pub fn to_onion(&self) -> Option<OnionAddressV3>
[src]
Returns Onion v3 address, if any, or Option::None
Trait Implementations
impl Clone for InetAddr
[src]
impl Copy for InetAddr
[src]
impl Debug for InetAddr
[src]
impl Default for InetAddr
[src]
impl Display for InetAddr
[src]
impl Eq for InetAddr
[src]
impl From<[u16; 8]> for InetAddr
[src]
impl From<[u8; 16]> for InetAddr
[src]
impl From<[u8; 4]> for InetAddr
[src]
impl From<IpAddr> for InetAddr
[src]
impl From<Ipv4Addr> for InetAddr
[src]
impl From<Ipv6Addr> for InetAddr
[src]
impl From<OnionAddressV2> for InetAddr
[src]
impl From<OnionAddressV3> for InetAddr
[src]
impl From<TorPublicKeyV3> for InetAddr
[src]
impl FromStr for InetAddr
[src]
type Err = AddrParseError
The associated error which can be returned from parsing.
pub fn from_str(s: &str) -> Result<InetAddr, <InetAddr as FromStr>::Err>
[src]
impl Hash for InetAddr
[src]
pub fn hash<H>(&self, state: &mut H) where
H: Hasher,
[src]
H: Hasher,
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for InetAddr
[src]
pub fn cmp(&self, other: &InetAddr) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl ParseArgFromStr for InetAddr
[src]
impl PartialEq<InetAddr> for InetAddr
[src]
impl PartialOrd<InetAddr> for InetAddr
[src]
pub fn partial_cmp(&self, other: &InetAddr) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Strategy for InetAddr
[src]
type Strategy = UsingUniformAddr
impl Strategy for InetAddr
[src]
impl StructuralEq for InetAddr
[src]
impl StructuralPartialEq for InetAddr
[src]
impl<'_> TryFrom<&'_ str> for InetAddr
[src]
type Error = <InetAddr as FromStr>::Err
The type returned in the event of a conversion error.
pub fn try_from(
value: &str
) -> Result<InetAddr, <InetAddr as TryFrom<&'_ str>>::Error>
[src]
value: &str
) -> Result<InetAddr, <InetAddr as TryFrom<&'_ str>>::Error>
impl Uniform for InetAddr
[src]
pub fn addr_format(&self) -> AddrFormat
[src]
pub fn addr(&self) -> [u8; 33]
[src]
pub fn port(&self) -> Option<u16>
[src]
pub fn transport(&self) -> Option<Transport>
[src]
pub fn from_uniform_addr(addr: UniformAddr) -> Result<InetAddr, DecodeError> where
InetAddr: Sized,
[src]
InetAddr: Sized,
pub fn from_uniform_addr_lossy(
addr: UniformAddr
) -> Result<InetAddr, DecodeError> where
InetAddr: Sized,
[src]
addr: UniformAddr
) -> Result<InetAddr, DecodeError> where
InetAddr: Sized,
pub fn to_uniform_addr(&self) -> UniformAddr
[src]
pub fn to_raw_uniform(&self) -> [u8; 37]
[src]
pub fn from_raw_uniform_addr(uniform: [u8; 37]) -> Result<Self, DecodeError>
[src]
pub fn from_raw_uniform_addr_lossy(
uniform: [u8; 37]
) -> Result<Self, DecodeError>
[src]
uniform: [u8; 37]
) -> Result<Self, DecodeError>
Auto Trait Implementations
impl RefUnwindSafe for InetAddr
[src]
impl Send for InetAddr
[src]
impl Sync for InetAddr
[src]
impl Unpin for InetAddr
[src]
impl UnwindSafe for InetAddr
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,