diff options
Diffstat (limited to 'examples/basalt.rs')
-rw-r--r-- | examples/basalt.rs | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/examples/basalt.rs b/examples/basalt.rs index 4ea4f71..4d7887d 100644 --- a/examples/basalt.rs +++ b/examples/basalt.rs @@ -15,6 +15,7 @@ use netapp::message::*; use netapp::peering::basalt::*; use netapp::proto::*; use netapp::NetApp; +use netapp::NodeID; #[derive(StructOpt, Debug)] #[structopt(name = "netapp")] @@ -91,7 +92,7 @@ async fn main() { 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)); } @@ -106,16 +107,14 @@ async fn main() { }; let peering = Basalt::new(netapp.clone(), bootstrap_peers, basalt_params); - netapp.add_msg_handler::<ExampleMessage, _, _>( - |_from: ed25519::PublicKey, msg: ExampleMessage| { - debug!("Got example message: {:?}, sending example response", msg); - async { - ExampleResponse { - example_field: false, - } + netapp.add_msg_handler::<ExampleMessage, _, _>(|_from: NodeID, msg: ExampleMessage| { + debug!("Got example message: {:?}, sending example response", msg); + async { + ExampleResponse { + example_field: false, } - }, - ); + } + }); let listen_addr = opt.listen_addr.parse().unwrap(); let public_addr = opt.public_addr.map(|x| x.parse().unwrap()); |