Initial beacon node setup.

- Add network crate.
- Add sync crate.
- Add version crate.
- Add lighthouse configuration.
- Add network configuration.
This commit is contained in:
Age Manning
2019-02-28 10:24:27 +11:00
parent 45c6e0395f
commit 19a64f906e
17 changed files with 345 additions and 135 deletions

View File

@@ -0,0 +1,4 @@
/// This crate provides the network server for Lighthouse.
mod network_configuration;
pub use network_configuration::NetworkConfiguration;

View File

@@ -0,0 +1,39 @@
use libp2p::gossipsub::{GossipsubConfig, GossipsubConfigBuilder};
use std::net::IpAddr;
use version;
#[derive(Debug, Clone)]
/// Network configuration for lighthouse.
pub struct NetworkConfiguration {
//TODO: stubbing networking initial params, change in the future
/// IP address to listen on.
pub listen_address: Option<IpAddr>,
/// Listen port UDP/TCP.
pub listen_port: Option<u16>,
/// Gossipsub configuration parameters.
pub gs_config: GossipsubConfig,
/// List of nodes to initially connect to.
pub boot_nodes: Vec<String>,
/// Client version
pub client_version: String,
//TODO: more to be added
}
impl Default for NetworkConfiguration {
/// Generate a default network configuration.
fn default() -> Self {
NetworkConfiguration {
listen_address: None,
listen_port: None,
gs_config: GossipsubConfigBuilder::new().build(),
boot_nodes: Vec::new(),
client_version: version::version(),
}
}
}
impl NetworkConfiguration {
pub fn new() -> Self {
NetworkConfiguration::default()
}
}