mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: add network request proxy example (#13974)
This commit is contained in:
@ -369,6 +369,12 @@ impl<N: NetworkPrimitives> NetworkConfigBuilder<N> {
|
||||
self
|
||||
}
|
||||
|
||||
/// Launches the network with an unused network and discovery port
|
||||
/// This is useful for testing.
|
||||
pub fn with_unused_ports(self) -> Self {
|
||||
self.with_unused_discovery_port().with_unused_listener_port()
|
||||
}
|
||||
|
||||
/// Sets the discovery port to an unused port.
|
||||
/// This is useful for testing.
|
||||
pub fn with_unused_discovery_port(self) -> Self {
|
||||
|
||||
@ -168,3 +168,6 @@ pub use metrics::TxTypesCounter;
|
||||
pub use network::{NetworkHandle, NetworkProtocols};
|
||||
pub use swarm::NetworkConnectionState;
|
||||
pub use transactions::{FilterAnnouncement, MessageFilter, ValidateTx68};
|
||||
|
||||
/// re-export p2p interfaces
|
||||
pub use reth_network_p2p as p2p;
|
||||
|
||||
@ -159,6 +159,16 @@ impl NetworkManager {
|
||||
}
|
||||
|
||||
impl<N: NetworkPrimitives> NetworkManager<N> {
|
||||
/// Sets the dedicated channel for events indented for the
|
||||
/// [`TransactionsManager`](crate::transactions::TransactionsManager).
|
||||
pub fn with_transactions(
|
||||
mut self,
|
||||
tx: mpsc::UnboundedSender<NetworkTransactionEvent<N>>,
|
||||
) -> Self {
|
||||
self.set_transactions(tx);
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the dedicated channel for events indented for the
|
||||
/// [`TransactionsManager`](crate::transactions::TransactionsManager).
|
||||
pub fn set_transactions(&mut self, tx: mpsc::UnboundedSender<NetworkTransactionEvent<N>>) {
|
||||
@ -166,6 +176,13 @@ impl<N: NetworkPrimitives> NetworkManager<N> {
|
||||
Some(UnboundedMeteredSender::new(tx, NETWORK_POOL_TRANSACTIONS_SCOPE));
|
||||
}
|
||||
|
||||
/// Sets the dedicated channel for events indented for the
|
||||
/// [`EthRequestHandler`](crate::eth_requests::EthRequestHandler).
|
||||
pub fn with_eth_request_handler(mut self, tx: mpsc::Sender<IncomingEthRequest<N>>) -> Self {
|
||||
self.set_eth_request_handler(tx);
|
||||
self
|
||||
}
|
||||
|
||||
/// Sets the dedicated channel for events indented for the
|
||||
/// [`EthRequestHandler`](crate::eth_requests::EthRequestHandler).
|
||||
pub fn set_eth_request_handler(&mut self, tx: mpsc::Sender<IncomingEthRequest<N>>) {
|
||||
|
||||
Reference in New Issue
Block a user