diff options
Diffstat (limited to 'examples/fullmesh.rs')
-rw-r--r-- | examples/fullmesh.rs | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/examples/fullmesh.rs b/examples/fullmesh.rs index 67861a7..f5b307b 100644 --- a/examples/fullmesh.rs +++ b/examples/fullmesh.rs @@ -1,5 +1,4 @@ use std::io::Write; -use std::net::SocketAddr; use log::info; @@ -9,8 +8,8 @@ use sodiumoxide::crypto::auth; use sodiumoxide::crypto::sign::ed25519; use netapp::peering::fullmesh::*; +use netapp::util::*; use netapp::NetApp; -use netapp::NodeID; #[derive(StructOpt, Debug)] #[structopt(name = "netapp")] @@ -70,12 +69,7 @@ async fn main() { 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 = NodeID::from_slice(&hex::decode(&key).unwrap()).unwrap(); - let ip = ip[1..].parse::<SocketAddr>().unwrap(); - bootstrap_peers.push((pubkey, ip)); - } + bootstrap_peers.push(parse_peer_addr(peer).expect("Invalid peer address")); } let peering = FullMeshPeeringStrategy::new(netapp.clone(), bootstrap_peers); |