pub struct HelloMessageWithProtocols {
pub protocol_version: ProtocolVersion,
pub client_version: String,
pub protocols: Vec<Protocol>,
pub port: u16,
pub id: PeerId,
}Expand description
This is a superset of HelloMessage that provides additional protocol Protocol information
about the number of messages used by each capability in order to do proper message ID
multiplexing.
This type is required for the p2p handshake because the HelloMessage does not share the
number of messages used by each capability.
To get the encodable HelloMessage without the additional protocol information, use the
HelloMessageWithProtocols::message.
Fields§
§protocol_version: ProtocolVersionThe version of the p2p protocol.
client_version: StringSpecifies the client software identity, as a human-readable string (e.g. “Ethereum(++)/1.0.0”).
protocols: Vec<Protocol>The list of supported capabilities and their versions.
port: u16The port that the client is listening on, zero indicates the client is not listening.
By default this is 30303 which is the same as the default discovery port.
id: PeerIdThe secp256k1 public key corresponding to the node’s private key.
Implementations§
Source§impl HelloMessageWithProtocols
impl HelloMessageWithProtocols
Sourcepub const fn builder(id: PeerId) -> HelloMessageBuilder
pub const fn builder(id: PeerId) -> HelloMessageBuilder
Starts a new HelloMessageProtocolsBuilder
use reth_eth_wire::HelloMessageWithProtocols;
use reth_network_peers::pk2id;
use secp256k1::SecretKey;
let secret_key = SecretKey::new(&mut rand::rng());
let id = pk2id(&secret_key.public_key());
let status = HelloMessageWithProtocols::builder(id).build();Sourcepub fn message(&self) -> HelloMessage
pub fn message(&self) -> HelloMessage
Returns the raw HelloMessage without the additional protocol information.
Sourcepub fn into_message(self) -> HelloMessage
pub fn into_message(self) -> HelloMessage
Converts the type into a HelloMessage without the additional protocol information.
Sourcepub fn contains_protocol(&self, protocol: &Protocol) -> bool
pub fn contains_protocol(&self, protocol: &Protocol) -> bool
Returns true if the set of protocols contains the given protocol.
Trait Implementations§
Source§impl Clone for HelloMessageWithProtocols
impl Clone for HelloMessageWithProtocols
Source§impl Debug for HelloMessageWithProtocols
impl Debug for HelloMessageWithProtocols
Source§impl<'de> Deserialize<'de> for HelloMessageWithProtocols
Available on crate feature serde only.
impl<'de> Deserialize<'de> for HelloMessageWithProtocols
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>,
impl Eq for HelloMessageWithProtocols
Source§impl Serialize for HelloMessageWithProtocols
Available on crate feature serde only.
impl Serialize for HelloMessageWithProtocols
serde only.impl StructuralPartialEq for HelloMessageWithProtocols
Auto Trait Implementations§
impl Freeze for HelloMessageWithProtocols
impl RefUnwindSafe for HelloMessageWithProtocols
impl Send for HelloMessageWithProtocols
impl Sync for HelloMessageWithProtocols
impl Unpin for HelloMessageWithProtocols
impl UnsafeUnpin for HelloMessageWithProtocols
impl UnwindSafe for HelloMessageWithProtocols
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
key and return true if they are equal.§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<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 moreimpl<T> MaybeSerde for Twhere
T: Serialize + for<'de> Deserialize<'de>,
§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: 120 bytes