mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-15 02:42:38 +00:00
Initial beacon node setup.
- Add network crate. - Add sync crate. - Add version crate. - Add lighthouse configuration. - Add network configuration.
This commit is contained in:
4
beacon_node/network/src/lib.rs
Normal file
4
beacon_node/network/src/lib.rs
Normal file
@@ -0,0 +1,4 @@
|
||||
/// This crate provides the network server for Lighthouse.
|
||||
mod network_configuration;
|
||||
|
||||
pub use network_configuration::NetworkConfiguration;
|
||||
39
beacon_node/network/src/network_configuration.rs
Normal file
39
beacon_node/network/src/network_configuration.rs
Normal 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()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user