mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: rm HasRemoteAddr trait (#8809)
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -6844,7 +6844,6 @@ dependencies = [
|
||||
"hmac 0.12.1",
|
||||
"pin-project",
|
||||
"rand 0.8.5",
|
||||
"reth-net-common",
|
||||
"reth-network-peers",
|
||||
"reth-primitives",
|
||||
"secp256k1 0.28.2",
|
||||
|
||||
@ -16,4 +16,4 @@ workspace = true
|
||||
alloy-primitives.workspace = true
|
||||
|
||||
# async
|
||||
tokio = { workspace = true, features = ["full"] }
|
||||
tokio = { workspace = true, features = ["time"] }
|
||||
|
||||
@ -10,7 +10,4 @@
|
||||
|
||||
pub mod ban_list;
|
||||
|
||||
/// Traits related to tokio streams
|
||||
pub mod stream;
|
||||
|
||||
pub mod ratelimit;
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
use std::net::SocketAddr;
|
||||
use tokio::net::TcpStream;
|
||||
/// This trait is for instrumenting a `TCPStream` with a socket addr
|
||||
pub trait HasRemoteAddr {
|
||||
/// Maybe returns a [`SocketAddr`]
|
||||
fn remote_addr(&self) -> Option<SocketAddr>;
|
||||
}
|
||||
|
||||
impl HasRemoteAddr for TcpStream {
|
||||
fn remote_addr(&self) -> Option<SocketAddr> {
|
||||
self.peer_addr().ok()
|
||||
}
|
||||
}
|
||||
@ -12,7 +12,6 @@ workspace = true
|
||||
|
||||
[dependencies]
|
||||
reth-primitives.workspace = true
|
||||
reth-net-common.workspace = true
|
||||
reth-network-peers = { workspace = true, features = ["secp256k1"] }
|
||||
|
||||
alloy-rlp = { workspace = true, features = ["derive"] }
|
||||
|
||||
@ -4,7 +4,6 @@ use crate::{
|
||||
codec::ECIESCodec, error::ECIESErrorImpl, ECIESError, EgressECIESValue, IngressECIESValue,
|
||||
};
|
||||
use futures::{ready, Sink, SinkExt};
|
||||
use reth_net_common::stream::HasRemoteAddr;
|
||||
use reth_primitives::{
|
||||
bytes::{Bytes, BytesMut},
|
||||
B512 as PeerId,
|
||||
@ -38,10 +37,10 @@ pub struct ECIESStream<Io> {
|
||||
|
||||
impl<Io> ECIESStream<Io>
|
||||
where
|
||||
Io: AsyncRead + AsyncWrite + Unpin + HasRemoteAddr,
|
||||
Io: AsyncRead + AsyncWrite + Unpin,
|
||||
{
|
||||
/// Connect to an `ECIES` server
|
||||
#[instrument(skip(transport, secret_key), fields(peer=&*format!("{:?}", transport.remote_addr())))]
|
||||
#[instrument(skip(transport, secret_key))]
|
||||
pub async fn connect(
|
||||
transport: Io,
|
||||
secret_key: SecretKey,
|
||||
@ -98,7 +97,6 @@ where
|
||||
}
|
||||
|
||||
/// Listen on a just connected ECIES client
|
||||
#[instrument(skip_all, fields(peer=&*format!("{:?}", transport.remote_addr())))]
|
||||
pub async fn incoming(transport: Io, secret_key: SecretKey) -> Result<Self, ECIESError> {
|
||||
let ecies = ECIESCodec::new_server(secret_key)?;
|
||||
|
||||
|
||||
@ -15,7 +15,6 @@ use reth_eth_wire::{
|
||||
UnauthedP2PStream,
|
||||
};
|
||||
use reth_metrics::common::mpsc::MeteredPollSender;
|
||||
use reth_net_common::stream::HasRemoteAddr;
|
||||
use reth_network_peers::PeerId;
|
||||
use reth_primitives::{ForkFilter, ForkId, ForkTransition, Head};
|
||||
use reth_tasks::TaskSpawner;
|
||||
@ -927,7 +926,7 @@ async fn authenticate(
|
||||
|
||||
/// Returns an [`ECIESStream`] if it can be built. If not, send a
|
||||
/// [`PendingSessionEvent::EciesAuthError`] and returns `None`
|
||||
async fn get_eciess_stream<Io: AsyncRead + AsyncWrite + Unpin + HasRemoteAddr>(
|
||||
async fn get_eciess_stream<Io: AsyncRead + AsyncWrite + Unpin>(
|
||||
stream: Io,
|
||||
secret_key: SecretKey,
|
||||
direction: Direction,
|
||||
|
||||
Reference in New Issue
Block a user