pub struct TrustedPeer {
pub host: Host,
pub tcp_port: u16,
pub udp_port: u16,
pub id: PeerId,
}
Expand description
Represents the node record of a trusted peer. The only difference between this and a
NodeRecord
is that this does not contain the IP address of the peer, but rather a domain
or IP address.
This is useful when specifying nodes which are in internal infrastructure and may only be discoverable reliably using DNS.
This should NOT be used for any use case other than in trusted peer lists.
Fields§
§host: Host
The host of a node.
tcp_port: u16
TCP port of the port that accepts connections.
udp_port: u16
UDP discovery port.
id: PeerId
Public key of the discovery service
Implementations§
Source§impl TrustedPeer
impl TrustedPeer
Sourcepub fn from_secret_key(host: Host, port: u16, sk: &SecretKey) -> Self
Available on crate feature secp256k1
only.
pub fn from_secret_key(host: Host, port: u16, sk: &SecretKey) -> Self
secp256k1
only.Derive the NodeRecord
from the secret key and addr
Sourcepub const fn new(host: Host, port: u16, id: PeerId) -> Self
pub const fn new(host: Host, port: u16, id: PeerId) -> Self
Creates a new record from a socket addr and peer id.
Sourcepub fn resolve_blocking(&self) -> Result<NodeRecord, Error>
pub fn resolve_blocking(&self) -> Result<NodeRecord, Error>
Resolves the host in a TrustedPeer
to an IP address, returning a NodeRecord
.
This use ToSocketAddr
to resolve the host to an IP address.
Sourcepub async fn resolve(&self) -> Result<NodeRecord, Error>
Available on crate feature net
only.
pub async fn resolve(&self) -> Result<NodeRecord, Error>
net
only.Resolves the host in a TrustedPeer
to an IP address, returning a NodeRecord
.
Trait Implementations§
Source§impl Clone for TrustedPeer
impl Clone for TrustedPeer
Source§fn clone(&self) -> TrustedPeer
fn clone(&self) -> TrustedPeer
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for TrustedPeer
impl Debug for TrustedPeer
Source§impl<'de> Deserialize<'de> for TrustedPeer
impl<'de> Deserialize<'de> for TrustedPeer
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 TrustedPeer
impl Display for TrustedPeer
Source§impl From<NodeRecord> for TrustedPeer
impl From<NodeRecord> for TrustedPeer
Source§fn from(record: NodeRecord) -> Self
fn from(record: NodeRecord) -> Self
Source§impl FromStr for TrustedPeer
impl FromStr for TrustedPeer
Source§impl Hash for TrustedPeer
impl Hash for TrustedPeer
Source§impl PartialEq for TrustedPeer
impl PartialEq for TrustedPeer
Source§impl Serialize for TrustedPeerwhere
Self: Display,
impl Serialize for TrustedPeerwhere
Self: Display,
impl Eq for TrustedPeer
impl StructuralPartialEq for TrustedPeer
Auto Trait Implementations§
impl Freeze for TrustedPeer
impl RefUnwindSafe for TrustedPeer
impl Send for TrustedPeer
impl Sync for TrustedPeer
impl Unpin for TrustedPeer
impl UnwindSafe for TrustedPeer
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> MaybeSendSync for T
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: 96 bytes