aboutsummaryrefslogtreecommitdiff
path: root/examples/fullmesh.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-12-14 11:22:29 +0100
committerAlex Auvolat <alex@adnab.me>2020-12-14 11:22:29 +0100
commite761f2f6efe6ce3fd6080eac85de511a3073959b (patch)
treea658976126b132c9c8361ee135b12bbe41346745 /examples/fullmesh.rs
parent3aa46dfe9599105918420a9fa807511e01f483c5 (diff)
parent6742638c81f8bda2ba3e3ab72ec520ab22b314e2 (diff)
downloadnetapp-e761f2f6efe6ce3fd6080eac85de511a3073959b.tar.gz
netapp-e761f2f6efe6ce3fd6080eac85de511a3073959b.zip
Merge branch 'master' of git.deuxfleurs.fr:lx/netapp
Diffstat (limited to 'examples/fullmesh.rs')
-rw-r--r--examples/fullmesh.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/examples/fullmesh.rs b/examples/fullmesh.rs
index 88784c1..acc0a7b 100644
--- a/examples/fullmesh.rs
+++ b/examples/fullmesh.rs
@@ -10,6 +10,7 @@ use sodiumoxide::crypto::sign::ed25519;
use netapp::peering::fullmesh::*;
use netapp::NetApp;
+use netapp::NodeID;
#[derive(StructOpt, Debug)]
#[structopt(name = "netapp")]
@@ -65,15 +66,13 @@ async fn main() {
info!("Node private key: {}", hex::encode(&privkey));
info!("Node public key: {}", hex::encode(&privkey.public_key()));
- let listen_addr = opt.listen_addr.parse().unwrap();
- let public_addr = opt.public_addr.map(|x| x.parse().unwrap());
- let netapp = NetApp::new(listen_addr, public_addr, netid, privkey);
+ let netapp = NetApp::new(netid, privkey);
let mut bootstrap_peers = vec![];
for peer in opt.bootstrap_peers.iter() {
if let Some(delim) = peer.find('@') {
let (key, ip) = peer.split_at(delim);
- let pubkey = ed25519::PublicKey::from_slice(&hex::decode(&key).unwrap()).unwrap();
+ let pubkey = NodeID::from_slice(&hex::decode(&key).unwrap()).unwrap();
let ip = ip[1..].parse::<SocketAddr>().unwrap();
bootstrap_peers.push((pubkey, ip));
}
@@ -81,5 +80,7 @@ async fn main() {
let peering = FullMeshPeeringStrategy::new(netapp.clone(), bootstrap_peers);
- tokio::join!(netapp.listen(), peering.run(),);
+ let listen_addr = opt.listen_addr.parse().unwrap();
+ let public_addr = opt.public_addr.map(|x| x.parse().unwrap());
+ tokio::join!(netapp.listen(listen_addr, public_addr), peering.run(),);
}