Re-enabling directory requests in run

This commit is contained in:
Dave Hrycyszyn
2019-12-11 00:33:27 +00:00
parent 04612ca98b
commit 44089ed558
+24 -10
View File
@@ -7,7 +7,10 @@ use tokio::time::{interval_at, Instant};
use crate::clients::directory;
use crate::clients::directory::requests::health_check_get::HealthCheckRequester;
use crate::clients::directory::requests::presence_topology_get::PresenceTopologyGetRequester;
use crate::clients::directory::DirectoryClient;
use sphinx::route::Destination;
use crate::clients::mix::MixClient;
mod clients;
@@ -68,19 +71,22 @@ fn run(matches: &ArgMatches) {
.get()
.expect("Directory health check failed, is the Directory server running?");
// let route = directory.get_mixes();
// let destination = directory.get_destination();
let topology = directory
.presence_topology
.get()
.expect("Failed to retrieve network topology.");
let route = topology.mix_nodes;
let destination = get_destination();
let delays = sphinx::header::delays::generate(2);
// println!("delays: {:?}", delays);
// build the packet
// let packet = sphinx::SphinxPacket::new(message, &route[..], &destination, &delays).unwrap();
//
// // send to mixnet
// let mix_client = MixClient::new();
// let result = mix_client.send(packet, route.first().unwrap()).await;
// println!("packet sent: {:?}", i);
// i += 1;
// let packet = sphinx::SphinxPacket::new(message, &route[..], &destination, &delays).unwrap();
//
// // send to mixnet
// let mix_client = MixClient::new();
// let result = mix_client.send(packet, route.first().unwrap()).await;
// println!("packet sent: {:?}", i);
// i += 1;
}
})
}
@@ -171,3 +177,11 @@ fn main() {
process::exit(1);
}
}
// TODO: where do we retrieve this guy from?
fn get_destination() -> Destination {
Destination {
address: [0u8;32],
identifier: [0u8; 16],
}
}