From 44089ed558b5fefca7e4c254cdd0103490955e43 Mon Sep 17 00:00:00 2001 From: Dave Hrycyszyn Date: Wed, 11 Dec 2019 00:33:27 +0000 Subject: [PATCH] Re-enabling directory requests in `run` --- src/main.rs | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/src/main.rs b/src/main.rs index db854f5e2e..600a9efb2c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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], + } +} \ No newline at end of file