Do not export zebra-network internals.
Until we finish outbound peer dialing, this still contains one module that re-exports the `PeerConnector`.
This commit is contained in:
parent
7c35e7e6c0
commit
f0bb2bff77
|
|
@ -16,19 +16,25 @@ extern crate bitflags;
|
||||||
/// Note: the 'static lifetime bound means that the *type* cannot have any
|
/// Note: the 'static lifetime bound means that the *type* cannot have any
|
||||||
/// non-'static lifetimes, (e.g., when a type contains a borrow and is
|
/// non-'static lifetimes, (e.g., when a type contains a borrow and is
|
||||||
/// parameterized by 'a), *not* that the object itself has 'static lifetime.
|
/// parameterized by 'a), *not* that the object itself has 'static lifetime.
|
||||||
pub(crate) type BoxedStdError = Box<dyn std::error::Error + Send + Sync + 'static>;
|
pub type BoxedStdError = Box<dyn std::error::Error + Send + Sync + 'static>;
|
||||||
|
|
||||||
mod network;
|
|
||||||
pub use network::Network;
|
|
||||||
|
|
||||||
mod config;
|
mod config;
|
||||||
|
mod constants;
|
||||||
|
mod meta_addr;
|
||||||
|
mod network;
|
||||||
|
mod peer;
|
||||||
|
mod peer_set;
|
||||||
|
mod protocol;
|
||||||
|
mod timestamp_collector;
|
||||||
|
|
||||||
pub use config::Config;
|
pub use config::Config;
|
||||||
|
pub use meta_addr::MetaAddr;
|
||||||
|
pub use network::Network;
|
||||||
|
pub use peer_set::init;
|
||||||
|
pub use protocol::internal::{Request, Response};
|
||||||
|
pub use timestamp_collector::TimestampCollector;
|
||||||
|
|
||||||
pub mod protocol;
|
/// This will be removed when we finish encapsulation
|
||||||
|
pub mod should_be_private {
|
||||||
// XXX revisit privacy once we finish encapsulation.
|
pub use crate::peer::PeerConnector;
|
||||||
pub mod constants;
|
}
|
||||||
pub mod meta_addr;
|
|
||||||
pub mod peer;
|
|
||||||
pub mod peer_set;
|
|
||||||
pub mod timestamp_collector;
|
|
||||||
|
|
|
||||||
|
|
@ -51,16 +51,9 @@ impl Runnable for ConnectCmd {
|
||||||
|
|
||||||
impl ConnectCmd {
|
impl ConnectCmd {
|
||||||
async fn connect(&self) -> Result<(), failure::Error> {
|
async fn connect(&self) -> Result<(), failure::Error> {
|
||||||
use zebra_network::{
|
use zebra_network::{Request, Response, TimestampCollector};
|
||||||
peer::PeerConnector,
|
|
||||||
peer_set::PeerSet,
|
|
||||||
protocol::internal::{Request, Response},
|
|
||||||
timestamp_collector::TimestampCollector,
|
|
||||||
Network,
|
|
||||||
};
|
|
||||||
|
|
||||||
info!("begin tower-based peer handling test stub");
|
info!("begin tower-based peer handling test stub");
|
||||||
|
|
||||||
use tower::{buffer::Buffer, service_fn, Service, ServiceExt};
|
use tower::{buffer::Buffer, service_fn, Service, ServiceExt};
|
||||||
|
|
||||||
let node = Buffer::new(
|
let node = Buffer::new(
|
||||||
|
|
@ -84,6 +77,7 @@ impl ConnectCmd {
|
||||||
// Later, this should turn into initial_peers = vec![self.addr];
|
// Later, this should turn into initial_peers = vec![self.addr];
|
||||||
config.initial_peers = {
|
config.initial_peers = {
|
||||||
use tokio::net::TcpStream;
|
use tokio::net::TcpStream;
|
||||||
|
use zebra_network::should_be_private::PeerConnector;
|
||||||
|
|
||||||
let collector = TimestampCollector::new();
|
let collector = TimestampCollector::new();
|
||||||
let mut pc = Buffer::new(
|
let mut pc = Buffer::new(
|
||||||
|
|
@ -114,7 +108,7 @@ impl ConnectCmd {
|
||||||
addrs.into_iter().map(|meta| meta.addr).collect::<Vec<_>>()
|
addrs.into_iter().map(|meta| meta.addr).collect::<Vec<_>>()
|
||||||
};
|
};
|
||||||
|
|
||||||
let (mut peer_set, _tc) = zebra_network::peer_set::init(config, node);
|
let (mut peer_set, _tc) = zebra_network::init(config, node);
|
||||||
|
|
||||||
info!("waiting for peer_set ready");
|
info!("waiting for peer_set ready");
|
||||||
peer_set.ready().await.map_err(Error::from_boxed_compat)?;
|
peer_set.ready().await.map_err(Error::from_boxed_compat)?;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue