diff --git a/mixnode/src/node/mod.rs b/mixnode/src/node/mod.rs index e7ac5b1c65..99f4e9646e 100644 --- a/mixnode/src/node/mod.rs +++ b/mixnode/src/node/mod.rs @@ -19,7 +19,7 @@ mod presence; pub mod runner; pub struct Config { - announce_socket_address: SocketAddr, + announce_address: String, directory_server: String, layer: usize, public_key: MontgomeryPoint, diff --git a/mixnode/src/node/presence.rs b/mixnode/src/node/presence.rs index f10d697087..283a6a3afe 100644 --- a/mixnode/src/node/presence.rs +++ b/mixnode/src/node/presence.rs @@ -17,7 +17,7 @@ impl Notifier { }; let net_client = directory_client::Client::new(config); let presence = MixNodePresence { - host: node_config.announce_socket_address.to_string(), + host: node_config.announce_address.clone(), pub_key: node_config.public_key_string(), layer: node_config.layer as u64, last_seen: 0, diff --git a/mixnode/src/node/runner.rs b/mixnode/src/node/runner.rs index 19640765e5..a403e02036 100644 --- a/mixnode/src/node/runner.rs +++ b/mixnode/src/node/runner.rs @@ -24,6 +24,10 @@ pub fn start(matches: &ArgMatches) { "Listening for incoming packets on {}", config.socket_address ); + println!( + "Announcing the following socket address: {}", + config.announce_address + ); let mix = MixNode::new(&config); mix.start(config).unwrap(); @@ -51,18 +55,20 @@ fn new_config(matches: &ArgMatches) -> node::Config { .next() .expect("Failed to extract the socket address from the iterator"); - let announce_host = matches.value_of("announce-host").unwrap_or(host); + let announce_host = matches.value_of("announce_host").unwrap_or(host); let announce_port = matches - .value_of("announce-port") + .value_of("announce_port") .map(|port| port.parse::().unwrap()) .unwrap_or(port); - let announce_socket_address = (announce_host, announce_port) + let _ = (announce_host, announce_port) .to_socket_addrs() .expect("Failed to combine announce host and port") .next() .expect("Failed to extract the announce socket address from the iterator"); + let announce_address = format!("{}:{}", announce_host, announce_port); + let (secret_key, public_key) = sphinx::crypto::keygen(); let directory_server = matches @@ -75,7 +81,7 @@ fn new_config(matches: &ArgMatches) -> node::Config { layer, public_key, socket_address, - announce_socket_address, + announce_address, secret_key, } }