diff --git a/zebra-network/src/lib.rs b/zebra-network/src/lib.rs index c0513f02..0440bbad 100644 --- a/zebra-network/src/lib.rs +++ b/zebra-network/src/lib.rs @@ -16,19 +16,25 @@ extern crate bitflags; /// 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 /// parameterized by 'a), *not* that the object itself has 'static lifetime. -pub(crate) type BoxedStdError = Box; - -mod network; -pub use network::Network; +pub type BoxedStdError = Box; 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 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; - -// XXX revisit privacy once we finish encapsulation. -pub mod constants; -pub mod meta_addr; -pub mod peer; -pub mod peer_set; -pub mod timestamp_collector; +/// This will be removed when we finish encapsulation +pub mod should_be_private { + pub use crate::peer::PeerConnector; +} diff --git a/zebrad/src/commands/connect.rs b/zebrad/src/commands/connect.rs index 24bc3146..70a5b1f6 100644 --- a/zebrad/src/commands/connect.rs +++ b/zebrad/src/commands/connect.rs @@ -51,16 +51,9 @@ impl Runnable for ConnectCmd { impl ConnectCmd { async fn connect(&self) -> Result<(), failure::Error> { - use zebra_network::{ - peer::PeerConnector, - peer_set::PeerSet, - protocol::internal::{Request, Response}, - timestamp_collector::TimestampCollector, - Network, - }; + use zebra_network::{Request, Response, TimestampCollector}; info!("begin tower-based peer handling test stub"); - use tower::{buffer::Buffer, service_fn, Service, ServiceExt}; let node = Buffer::new( @@ -84,6 +77,7 @@ impl ConnectCmd { // Later, this should turn into initial_peers = vec![self.addr]; config.initial_peers = { use tokio::net::TcpStream; + use zebra_network::should_be_private::PeerConnector; let collector = TimestampCollector::new(); let mut pc = Buffer::new( @@ -114,7 +108,7 @@ impl ConnectCmd { addrs.into_iter().map(|meta| meta.addr).collect::>() }; - 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"); peer_set.ready().await.map_err(Error::from_boxed_compat)?;