2019-09-10 13:27:10 -07:00
|
|
|
//! Networking code for Zebra. 🦓
|
2019-09-09 18:35:56 -07:00
|
|
|
|
2019-09-10 13:27:10 -07:00
|
|
|
#![deny(missing_docs)]
|
2019-09-09 18:35:56 -07:00
|
|
|
|
2019-10-10 18:15:24 -07:00
|
|
|
#[macro_use]
|
|
|
|
extern crate pin_project;
|
2019-10-08 13:57:24 -07:00
|
|
|
#[macro_use]
|
|
|
|
extern crate serde;
|
2019-09-14 07:00:36 -07:00
|
|
|
#[macro_use]
|
2019-09-23 18:11:05 -07:00
|
|
|
extern crate tracing;
|
2019-09-30 11:58:32 -07:00
|
|
|
#[macro_use]
|
|
|
|
extern crate bitflags;
|
2019-09-14 07:00:36 -07:00
|
|
|
|
2019-10-08 13:49:12 -07:00
|
|
|
/// Type alias to make working with tower traits easier.
|
|
|
|
///
|
|
|
|
/// 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<dyn std::error::Error + Send + Sync + 'static>;
|
|
|
|
|
2019-09-24 11:25:06 -07:00
|
|
|
mod network;
|
|
|
|
pub use network::Network;
|
|
|
|
|
2019-10-08 13:57:24 -07:00
|
|
|
mod config;
|
|
|
|
pub use config::Config;
|
|
|
|
|
2019-09-23 19:43:43 -07:00
|
|
|
pub mod protocol;
|
Add a `connect` command for testing.
With `./src/zcashd -debug=net -logips=1`:
```
2019-09-19 15:24:38 Added connection to 127.0.0.1:35932 peer=1
2019-09-19 15:24:38 connection from 127.0.0.1:35932 accepted
2019-09-19 15:24:38 socket closed
2019-09-19 15:24:38 disconnecting peer=1
```
With `RUST_LOG="trace"`, `cargo run connect`:
```
Sep 19 08:24:24.530 INFO zebrad::commands::connect: version=Version { version: Version(170007), services: Services(1), timestamp: 2019-09-19T15:24:24.530059300Z, address_recv: (Services(1), V4(127.0.0.1:8233)), address_from: (Services(1), V4(127.0.0.1:9000)), nonce: Nonce(1), user_agent: "Zebra Connect", start_height: BlockHeight(0), relay: false }
Sep 19 08:24:24.530 TRACE Task::run: tokio_executor::threadpool::task: state=Running
Sep 19 08:24:24.530 DEBUG Task::run: tokio_net::driver::reactor: adding I/O source token=0
Sep 19 08:24:24.530 INFO zebrad::commands::connect: version_bytes="24e9276476657273696f6e000000000063000000cb30ab03179802000100000000000000a89d835d00000000010000000000000000000000000000000000ffff7f0000012029010000000000000000000000000000000000ffff7f000001232801000000000000000d5a6562726120436f6e6e6563740000000000"
Sep 19 08:24:24.530 TRACE Task::run: log: registering with poller
```
2019-09-11 22:30:32 -07:00
|
|
|
|
2019-10-07 15:36:16 -07:00
|
|
|
// XXX revisit privacy once we finish encapsulation.
|
Add a `connect` command for testing.
With `./src/zcashd -debug=net -logips=1`:
```
2019-09-19 15:24:38 Added connection to 127.0.0.1:35932 peer=1
2019-09-19 15:24:38 connection from 127.0.0.1:35932 accepted
2019-09-19 15:24:38 socket closed
2019-09-19 15:24:38 disconnecting peer=1
```
With `RUST_LOG="trace"`, `cargo run connect`:
```
Sep 19 08:24:24.530 INFO zebrad::commands::connect: version=Version { version: Version(170007), services: Services(1), timestamp: 2019-09-19T15:24:24.530059300Z, address_recv: (Services(1), V4(127.0.0.1:8233)), address_from: (Services(1), V4(127.0.0.1:9000)), nonce: Nonce(1), user_agent: "Zebra Connect", start_height: BlockHeight(0), relay: false }
Sep 19 08:24:24.530 TRACE Task::run: tokio_executor::threadpool::task: state=Running
Sep 19 08:24:24.530 DEBUG Task::run: tokio_net::driver::reactor: adding I/O source token=0
Sep 19 08:24:24.530 INFO zebrad::commands::connect: version_bytes="24e9276476657273696f6e000000000063000000cb30ab03179802000100000000000000a89d835d00000000010000000000000000000000000000000000ffff7f0000012029010000000000000000000000000000000000ffff7f000001232801000000000000000d5a6562726120436f6e6e6563740000000000"
Sep 19 08:24:24.530 TRACE Task::run: log: registering with poller
```
2019-09-11 22:30:32 -07:00
|
|
|
pub mod constants;
|
2019-10-07 15:36:16 -07:00
|
|
|
pub mod meta_addr;
|
|
|
|
pub mod peer;
|
2019-10-10 18:15:24 -07:00
|
|
|
pub mod peer_set;
|
2019-10-07 15:36:16 -07:00
|
|
|
pub mod timestamp_collector;
|