Merge branch 'release/v0.3.2'
This commit is contained in:
Generated
+3
-3
@@ -1339,7 +1339,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nym-client"
|
||||
version = "0.3.1"
|
||||
version = "0.3.2"
|
||||
dependencies = [
|
||||
"addressing",
|
||||
"base64 0.11.0",
|
||||
@@ -1372,7 +1372,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nym-mixnode"
|
||||
version = "0.3.1"
|
||||
version = "0.3.2"
|
||||
dependencies = [
|
||||
"addressing",
|
||||
"base64 0.11.0",
|
||||
@@ -1388,7 +1388,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nym-sfw-provider"
|
||||
version = "0.3.1"
|
||||
version = "0.3.2"
|
||||
dependencies = [
|
||||
"base64 0.11.0",
|
||||
"built",
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
use crate::requests::presence_topology_get::PresenceTopologyGetRequester;
|
||||
use crate::{Client, Config, DirectoryClient};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::convert::TryInto;
|
||||
use std::io;
|
||||
use std::net::ToSocketAddrs;
|
||||
use topology::{CocoNode, MixNode, MixProviderNode, NymTopology};
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
@@ -44,15 +47,25 @@ pub struct MixNodePresence {
|
||||
pub version: String,
|
||||
}
|
||||
|
||||
impl Into<topology::MixNode> for MixNodePresence {
|
||||
fn into(self) -> topology::MixNode {
|
||||
topology::MixNode {
|
||||
host: self.host.parse().unwrap(),
|
||||
impl TryInto<topology::MixNode> for MixNodePresence {
|
||||
type Error = io::Error;
|
||||
|
||||
fn try_into(self) -> Result<MixNode, Self::Error> {
|
||||
let resolved_hostname = self.host.to_socket_addrs()?.next();
|
||||
if resolved_hostname.is_none() {
|
||||
return Err(io::Error::new(
|
||||
io::ErrorKind::Other,
|
||||
"no valid socket address",
|
||||
));
|
||||
}
|
||||
|
||||
Ok(topology::MixNode {
|
||||
host: resolved_hostname.unwrap(),
|
||||
pub_key: self.pub_key,
|
||||
layer: self.layer,
|
||||
last_seen: self.last_seen,
|
||||
version: self.version,
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,7 +188,10 @@ impl NymTopology for Topology {
|
||||
}
|
||||
|
||||
fn get_mix_nodes(&self) -> Vec<topology::MixNode> {
|
||||
self.mix_nodes.iter().map(|x| x.clone().into()).collect()
|
||||
self.mix_nodes
|
||||
.iter()
|
||||
.filter_map(|x| x.clone().try_into().ok())
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn get_mix_provider_nodes(&self) -> Vec<topology::MixProviderNode> {
|
||||
@@ -189,3 +205,40 @@ impl NymTopology for Topology {
|
||||
self.coco_nodes.iter().map(|x| x.clone().into()).collect()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod converting_mixnode_presence_into_topology_mixnode {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn it_returns_error_on_unresolvable_hostname() {
|
||||
let unresolvable_hostname = "foomp.foomp.foomp:1234";
|
||||
|
||||
let mix_presence = MixNodePresence {
|
||||
host: unresolvable_hostname.to_string(),
|
||||
pub_key: "".to_string(),
|
||||
layer: 0,
|
||||
last_seen: 0,
|
||||
version: "".to_string(),
|
||||
};
|
||||
|
||||
let result: Result<topology::MixNode, io::Error> = mix_presence.try_into();
|
||||
assert!(result.is_err())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn it_returns_resolved_ip_on_resolvable_hostname() {
|
||||
let resolvable_hostname = "nymtech.net:1234";
|
||||
|
||||
let mix_presence = MixNodePresence {
|
||||
host: resolvable_hostname.to_string(),
|
||||
pub_key: "".to_string(),
|
||||
layer: 0,
|
||||
last_seen: 0,
|
||||
version: "".to_string(),
|
||||
};
|
||||
|
||||
let result: Result<topology::MixNode, io::Error> = mix_presence.try_into();
|
||||
assert!(result.is_ok())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crypto::identity::{DummyMixIdentityKeyPair, MixnetIdentityKeyPair, MixnetIdentityPublicKey};
|
||||
use itertools::Itertools;
|
||||
use log::{debug, error, warn};
|
||||
use log::{debug, error, trace, warn};
|
||||
use mix_client::MixClient;
|
||||
use provider_client::ProviderClient;
|
||||
use sphinx::header::delays::Delay;
|
||||
@@ -131,6 +131,7 @@ impl PathChecker {
|
||||
Ok(messages) => {
|
||||
let mut should_stop = false;
|
||||
for msg in messages.into_iter() {
|
||||
trace!("received provider response: {:?}", msg);
|
||||
if msg == sfw_provider_requests::DUMMY_MESSAGE_CONTENT {
|
||||
// finish iterating the loop as the messages might not be ordered
|
||||
should_stop = true;
|
||||
@@ -175,9 +176,13 @@ impl PathChecker {
|
||||
|
||||
if provider_client.is_none() {
|
||||
debug!("we can ignore this path as provider itself is inaccessible");
|
||||
self.paths_status
|
||||
if self
|
||||
.paths_status
|
||||
.insert(path_identifier, PathStatus::Unhealthy)
|
||||
.unwrap();
|
||||
.is_some()
|
||||
{
|
||||
panic!("Overwriting path checks!")
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -193,9 +198,13 @@ impl PathChecker {
|
||||
|
||||
if first_node_client.is_none() {
|
||||
debug!("we can ignore this path as layer one mix is inaccessible");
|
||||
self.paths_status
|
||||
if self
|
||||
.paths_status
|
||||
.insert(path_identifier, PathStatus::Unhealthy)
|
||||
.unwrap();
|
||||
.is_some()
|
||||
{
|
||||
panic!("Overwriting path checks!")
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
# nym-mixnode Changelog
|
||||
|
||||
## 0.3.2
|
||||
|
||||
* added separate announce address
|
||||
* allows announcing dns hostname instead of an ip address
|
||||
|
||||
## 0.3.1
|
||||
|
||||
* Fixed crash when directory server goes down
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
build = "build.rs"
|
||||
name = "nym-mixnode"
|
||||
version = "0.3.1"
|
||||
version = "0.3.2"
|
||||
authors = ["Dave Hrycyszyn <futurechimp@users.noreply.github.com>", "Jędrzej Stuczyński <andrew@nymtech.net>"]
|
||||
edition = "2018"
|
||||
|
||||
|
||||
@@ -32,6 +32,18 @@ fn main() {
|
||||
.takes_value(true)
|
||||
.required(true),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("announce_host")
|
||||
.long("announce-host")
|
||||
.help("The host that will be reported to the directory server")
|
||||
.takes_value(true)
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("announce_port")
|
||||
.long("announce-port")
|
||||
.help("The port that will be reported to the directory server")
|
||||
.takes_value(true)
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("directory")
|
||||
.long("directory")
|
||||
|
||||
@@ -19,6 +19,7 @@ mod presence;
|
||||
pub mod runner;
|
||||
|
||||
pub struct Config {
|
||||
announce_address: String,
|
||||
directory_server: String,
|
||||
layer: usize,
|
||||
public_key: MontgomeryPoint,
|
||||
|
||||
@@ -17,7 +17,7 @@ impl Notifier {
|
||||
};
|
||||
let net_client = directory_client::Client::new(config);
|
||||
let presence = MixNodePresence {
|
||||
host: node_config.socket_address.to_string(), // note: the directory server determines the real incoming IP itself, but uses the socket. Host here is just a placeholder.
|
||||
host: node_config.announce_address.clone(),
|
||||
pub_key: node_config.public_key_string(),
|
||||
layer: node_config.layer as u64,
|
||||
last_seen: 0,
|
||||
|
||||
@@ -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,6 +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_port = matches
|
||||
.value_of("announce_port")
|
||||
.map(|port| port.parse::<u16>().unwrap())
|
||||
.unwrap_or(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
|
||||
@@ -63,6 +81,7 @@ fn new_config(matches: &ArgMatches) -> node::Config {
|
||||
layer,
|
||||
public_key,
|
||||
socket_address,
|
||||
announce_address,
|
||||
secret_key,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# nym-client Changelog
|
||||
|
||||
## 0.3.2
|
||||
|
||||
* allows receiving topology with dns hostname instead of an ip address
|
||||
|
||||
## 0.3.1
|
||||
|
||||
* Version increase for consistency with `nym-mixnode` and `nym-sfw-provider`
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
build = "build.rs"
|
||||
name = "nym-client"
|
||||
version = "0.3.1"
|
||||
version = "0.3.2"
|
||||
authors = ["Dave Hrycyszyn <futurechimp@users.noreply.github.com>", "Jędrzej Stuczyński <andrew@nymtech.net>"]
|
||||
edition = "2018"
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
#// Copyright 2020 The Nym Mixnet Authors
|
||||
#//
|
||||
#// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -12,7 +14,6 @@
|
||||
#// See the License for the specific language governing permissions and
|
||||
#// limitations under the License.
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
echo "Killing old testnet processes..."
|
||||
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# nym-sfw-provider Changelog
|
||||
|
||||
## 0.3.2
|
||||
|
||||
* Version increase for consistency with `nym-mixnode` and `nym-client`
|
||||
|
||||
## 0.3.1
|
||||
|
||||
* Fixed crash when directory server goes down
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
build = "build.rs"
|
||||
name = "nym-sfw-provider"
|
||||
version = "0.3.1"
|
||||
version = "0.3.2"
|
||||
authors = ["Dave Hrycyszyn <futurechimp@users.noreply.github.com>", "Jędrzej Stuczyński <andrew@nymtech.net>"]
|
||||
edition = "2018"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user