Skip to content

Commit

Permalink
Expose the bootstrap peer list in NodeConfig
Browse files Browse the repository at this point in the history
This allows the node to be started with a list of known endpoints. It
will be initially used for a static list, but can be extended later for
preserving state between restarts.

Signed-off-by: Stanisław Pitucha <[email protected]>
Signed-off-by: Kim Altintop <[email protected]>
  • Loading branch information
viraptor authored and kim committed Feb 26, 2021
1 parent 18a4bd0 commit cadaf46
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion seed/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ pub struct NodeConfig {
pub root: Option<PathBuf>,
/// The radicle network to connect to.
pub network: Network,
/// List of bootstrap peers
pub bootstrap: Vec<(PeerId, SocketAddr)>,
}

impl Default for NodeConfig {
Expand All @@ -113,6 +115,7 @@ impl Default for NodeConfig {
mode: Mode::TrackEverything,
root: None,
network: Network::default(),
bootstrap: vec![],
}
}
}
Expand Down Expand Up @@ -179,7 +182,7 @@ impl Node {
// Spawn the background peer thread.
tokio::spawn({
let peer = peer.clone();
let disco = discovery::Static::default();
let disco = discovery::Static::resolve(self.config.bootstrap.clone())?;
async move {
loop {
match peer.bind().await {
Expand Down

0 comments on commit cadaf46

Please sign in to comment.