feat: support admin_peers (#4435)

This commit is contained in:
Matthias Seitz
2023-08-31 13:36:50 -07:00
committed by GitHub
parent d8a7ee2eb4
commit a76da98316
11 changed files with 177 additions and 90 deletions

View File

@ -5,6 +5,7 @@ use reth_codecs::add_arbitrary_tests;
use reth_primitives::bytes::{BufMut, Bytes};
use reth_rlp::{Decodable, DecodeError, Encodable, RlpDecodable, RlpEncodable};
use smol_str::SmolStr;
use std::fmt;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
@ -72,6 +73,12 @@ impl Capability {
}
}
impl fmt::Display for Capability {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}/{}", self.name, self.version)
}
}
#[cfg(any(test, feature = "arbitrary"))]
impl<'a> arbitrary::Arbitrary<'a> for Capability {
fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result<Self> {

View File

@ -75,6 +75,11 @@ impl<S> UnauthedP2PStream<S> {
pub fn new(inner: S) -> Self {
Self { inner }
}
/// Returns a reference to the inner stream.
pub fn inner(&self) -> &S {
&self.inner
}
}
impl<S> UnauthedP2PStream<S>
@ -242,6 +247,11 @@ impl<S> P2PStream<S> {
}
}
/// Returns a reference to the inner stream.
pub fn inner(&self) -> &S {
&self.inner
}
/// Sets a custom outgoing message buffer capacity.
///
/// # Panics