Merge branch 'develop' into feature/add-http-interface

This commit is contained in:
Dave Hrycyszyn
2020-03-16 13:54:38 +00:00
31 changed files with 172 additions and 4 deletions
+3 -3
View File
@@ -4,10 +4,10 @@ This repository contains the full Nym platform, written in Rust.
The platform is composed of multiple Rust crates. Top-level executable binary crates include:
* mixnode - shuffles [Sphinx](https://github.com/nymtech/sphinx) packets together to provide privacy against network-level attackers.
* nym-mixnode - shuffles [Sphinx](https://github.com/nymtech/sphinx) packets together to provide privacy against network-level attackers.
* nym-client - an executable which you can build into your own applications. Use it for interacting with Nym nodes.
* sfw-provider - a store-and-forward service provider. The provider acts sort of like a mailbox for mixnet messages.
* validator - currently just starting development. Handles consensus ordering of transactions, mixmining, and coconut credential generation and validation.
* nym-sfw-provider - a store-and-forward service provider. The provider acts sort of like a mailbox for mixnet messages.
* nym-validator - currently just starting development. Handles consensus ordering of transactions, mixmining, and coconut credential generation and validation.
[![Build Status](https://travis-ci.com/nymtech/nym.svg?branch=develop)](https://travis-ci.com/nymtech/nym)
@@ -4,6 +4,7 @@ use topology::coco;
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct CocoPresence {
pub location: String,
pub host: String,
pub pub_key: String,
pub last_seen: u64,
@@ -13,6 +14,7 @@ pub struct CocoPresence {
impl Into<topology::coco::Node> for CocoPresence {
fn into(self) -> topology::coco::Node {
topology::coco::Node {
location: self.location,
host: self.host,
pub_key: self.pub_key,
last_seen: self.last_seen,
@@ -24,6 +26,7 @@ impl Into<topology::coco::Node> for CocoPresence {
impl From<topology::coco::Node> for CocoPresence {
fn from(cn: coco::Node) -> Self {
CocoPresence {
location: cn.location,
host: cn.host,
pub_key: cn.pub_key,
last_seen: cn.last_seen,
@@ -7,6 +7,7 @@ use topology::mix;
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct MixNodePresence {
pub location: String,
pub host: String,
pub pub_key: String,
pub layer: u64,
@@ -27,6 +28,7 @@ impl TryInto<topology::mix::Node> for MixNodePresence {
}
Ok(topology::mix::Node {
location: self.location,
host: resolved_hostname.unwrap(),
pub_key: self.pub_key,
layer: self.layer,
@@ -39,6 +41,7 @@ impl TryInto<topology::mix::Node> for MixNodePresence {
impl From<topology::mix::Node> for MixNodePresence {
fn from(mn: mix::Node) -> Self {
MixNodePresence {
location: mn.location,
host: mn.host.to_string(),
pub_key: mn.pub_key,
layer: mn.layer,
@@ -78,6 +78,7 @@ mod converting_mixnode_presence_into_topology_mixnode {
let unresolvable_hostname = "foomp.foomp.foomp:1234";
let mix_presence = mixnodes::MixNodePresence {
location: "".to_string(),
host: unresolvable_hostname.to_string(),
pub_key: "".to_string(),
layer: 0,
@@ -94,6 +95,7 @@ mod converting_mixnode_presence_into_topology_mixnode {
let resolvable_hostname = "nymtech.net:1234";
let mix_presence = mixnodes::MixNodePresence {
location: "".to_string(),
host: resolvable_hostname.to_string(),
pub_key: "".to_string(),
layer: 0,
@@ -4,6 +4,7 @@ use topology::provider;
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct MixProviderPresence {
pub location: String,
pub client_listener: String,
pub mixnet_listener: String,
pub pub_key: String,
@@ -15,6 +16,7 @@ pub struct MixProviderPresence {
impl Into<topology::provider::Node> for MixProviderPresence {
fn into(self) -> topology::provider::Node {
topology::provider::Node {
location: self.location,
client_listener: self.client_listener.parse().unwrap(),
mixnet_listener: self.mixnet_listener.parse().unwrap(),
pub_key: self.pub_key,
@@ -32,6 +34,7 @@ impl Into<topology::provider::Node> for MixProviderPresence {
impl From<topology::provider::Node> for MixProviderPresence {
fn from(mpn: provider::Node) -> Self {
MixProviderPresence {
location: mpn.location,
client_listener: mpn.client_listener.to_string(),
mixnet_listener: mpn.mixnet_listener.to_string(),
pub_key: mpn.pub_key,
@@ -77,6 +77,7 @@ mod metrics_get_request {
pub fn new_presence() -> CocoPresence {
CocoPresence {
location: "foomp".to_string(),
host: "foo.com".to_string(),
pub_key: "abc".to_string(),
last_seen: 666,
@@ -77,6 +77,7 @@ mod metrics_get_request {
pub fn new_presence() -> MixNodePresence {
MixNodePresence {
location: "foomp".to_string(),
host: "foo.com".to_string(),
pub_key: "abc".to_string(),
layer: 1,
@@ -76,6 +76,7 @@ mod metrics_get_request {
pub fn new_presence() -> MixProviderPresence {
MixProviderPresence {
location: "foomp".to_string(),
client_listener: "foo.com".to_string(),
mixnet_listener: "foo.com".to_string(),
pub_key: "abc".to_string(),
@@ -72,6 +72,7 @@ mod topology_requests {
r#"{
"cocoNodes": [
{
"location": "unknown",
"host": "3.8.244.109:4000",
"pubKey": "AAAAAAAAAAEKwAECSqKy8I8KkSYIBSctxRBRxuR61PpAOwK0UQtkeuPRdwusAyaoBbvv1IBWyMEhvbgT4CtgUnGfYH2s06CIJ09lWWvQ0Jkgthq12mG73H9QSTNM8RITlF1X5ax9BV0EK34M5dUncn1uEYzJzcbaLjUarf2bqoy906dtQpppUWDRLJI6ycw7rKKJ4ZNUhgi4KAEGBsSgLqc0zDKs0rArwouZyz4ofoWnY68mdJKrVy6Zqz83DSdc7B2hqqkHX_Bfeb4SwAEFuhRpy4HfcuxwcRI9sIWMo_LVmbk19g1gfMRlBrmZqoEQL6rDApVLZ9eMp-5IQK8WLlZpWf4Zjy7kZolARAyp_rHUQkH4PrDjgoPrKbm6qK_iejYpL7qx28Q3VeInMpwMIMaSbbW9y36sEVtGc2I0Iu5vS0sp8ESiVlQ5NaBz72deZ8oKJJ4IEPPHP99-b0UQX80fVIrNM88mMzKy0bHri9NFlmIG-e0G1cqmw_ry3XWGQkcr1M5RuNa6oX50w5QawAEVxd5FP5bE8bS4x54Csof11sQWUTwMp6Q7_3H7ZCTSlKSqujlOhmfqSHfGPO2sDIYPHDhDzjakZpKAZWWhn_hiR6DfPpomQ01ZYUhVKKSMxz7_VPjsQplP0bZXA2gfnkADUN8UQ0N9g_usIw73r4aZsOviMsRM8oByvsjVfUWc4_HTLSdnQyImFkHz9CiCmrIYL2dYQRePRatWggvBA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CzM=",
"type": "validator",
@@ -79,6 +80,7 @@ mod topology_requests {
"version": "0.1.0"
},
{
"location": "unknown",
"host": "3.9.129.61:4000",
"pubKey": "AAAAAAAAAAMKwAECSqKy8I8KkSYIBSctxRBRxuR61PpAOwK0UQtkeuPRdwusAyaoBbvv1IBWyMEhvbgT4CtgUnGfYH2s06CIJ09lWWvQ0Jkgthq12mG73H9QSTNM8RITlF1X5ax9BV0EK34M5dUncn1uEYzJzcbaLjUarf2bqoy906dtQpppUWDRLJI6ycw7rKKJ4ZNUhgi4KAEGBsSgLqc0zDKs0rArwouZyz4ofoWnY68mdJKrVy6Zqz83DSdc7B2hqqkHX_Bfeb4SwAEEv6RMevAQmLGkeK0uJKnMPPAtm8GgXjWSQijYdnxlPh5SJSNeJUbPZKWFFWdk8yIFXKa8jnzETtdGFKgUUt5AVUDpTBmEdwaHCzlFhXrttshy0V5OhPUlV8cGABmxbagMYm0bFPg0r-snSkrB9YG6wqJYQVeIMOCGYCPbHmDA8R_0-h8VkRKWs1d9KvQOK4kShqgZtYN71KJW8uDE4q2jsGDVvxFt1AgmU9b93xsXF17KrpZy5WxlLZ73HtnTD_oawAED4vd_rK-Kx_n8x_OdDiiEOPUlYDlDCQUqenU9XHKH3B6ijfkJ368wd3LDDVStjDwNORrAyUSw_VlSNUpd1XLC8d17gTaIq5ZI2fWuwwZaoN1JCsYU8fQ6USgtIehQX7IPP8EkFuNmuCBCmpr4schtYniGe9J8Q4dsV-TYPr2uLJkdx1r7luzF--I22k7NfQQM14QDci_0kgrgmZ54CJGkjXyOhCppBXg3fqLC6aFvT3ZocfiiXBJt0huGgPMDtYsawAECLh8KUdNsDolERwJ8v04bS5jI_KKf7uUnCHWuCELwbJSUI3OK1ufS1qSpauvSzVQSbrhEzrEfwQn4VtxQxJlX4UdDU-R-hafiZvVC6DLLAbuORBAC3FScn9W58CnezH4DvCp_w7nftDfdxeuungbZT9XaxS3iNC6PnFsWF6WM3DxMwrzOrFe6wEEoTSPe1mcUDrtw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ytPK7K-yRgT1PxFgm3rZqrG0Tjbrpsg2PUL5S5fuXfMhUosP0uoLj0D1guWAR9Y7kfFBIXaTSFMoa8fghVBUTRNhK9f72a8SxQawAEOiv71taLjKqaaWQ_QjcDhWbvjG1EnsCyI0toNjGkcF19x4Vk-5NC96_4ioUGz404IC0XN03roRnibRT_78D9vZFVCWCqve9EjdF5TcApx03zIP4JT2g2q0MKIGgGrwt4Pz6LO6yOfMm7B8Yraps8IV-nP1w7K1m9XKP_FvH8egl5GHJe-_omlC2YyL_b28jMLENbxDFD-3KPjZFBhSLrRukX2PlayYTwEiTtokA2R9_11vQvJgP8KFEjGHg6zsAMawAEBn2H_hz2knb8ltnpEA5YSKVcV3nUtojkCNi_WUz7xUKd7efw1oI_lbnKrS7HkyC0JkQUZ1pCWUlSXNmgjMEhsn823a1LFzpV7rOv4vayYvvFX61hB9R78VjpyxJiYpDwRZLiUY3AK4WY8NqFDbjXR7rT4CkFHEf-VhSQQ8ZNvlpod1nmeVQVizHH9e7Tq7wsWz-LWEk3Hx6LmcrgDsL79LZYG9JXU5IdvG8RvLNx9cSwEI8yxcchpISAaot7UoYQ=",
"type": "validator",
@@ -93,6 +96,7 @@ mod topology_requests {
"version": "0.1.0"
},
{
"location": "unknown",
"host": "3.9.102.214:4000",
"pubKey": "AAAAAAAAAAIKwAECSqKy8I8KkSYIBSctxRBRxuR61PpAOwK0UQtkeuPRdwusAyaoBbvv1IBWyMEhvbgT4CtgUnGfYH2s06CIJ09lWWvQ0Jkgthq12mG73H9QSTNM8RITlF1X5ax9BV0EK34M5dUncn1uEYzJzcbaLjUarf2bqoy906dtQpppUWDRLJI6ycw7rKKJ4ZNUhgi4KAEGBsSgLqc0zDKs0rArwouZyz4ofoWnY68mdJKrVy6Zqz83DSdc7B2hqqkHX_Bfeb4SwAEOVCUN3EwiVroS5-TOq2o7hYSxphK9X0G23N-IBZ0Tr1Rl8XEiJ-OEy0rqnAKwmhAZJWnx3u8oXqbZtOWIZmzQSpcoxhgw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PFyAtrWjmy_d9WLHuZt6VIOKunTs8cf0FwNUiMcvZsruqIFJcP7iWxdiFdUkh65P_iCz1ZEjJcj2GEZoq4v3a3by1aizGPaaiKc1jd_T-XJg_YpncawAEWnstu5b9WiZv0x8xfsiMk6YRlU0Cnj5svxLLXz_8drvwAa--GBY5yH0ke2EM6udMEi2EPeFcGTe6Sjs0YEhSbY7Uad_8suD2J4tIWJSWBbiyvh7rSqzv57m7BlsVcHfQJn_wNH-UlC9xkx8vg-LwfN8_FlxvHNPTc7XZG3lKYbwpUWlZxAziOYT1VQ-2K2bQQBBMdix-ht_SjccL1Dc2dP5kDazQ8yZV_8xnyeheazEedWe63uutfkHlZRg9YwP8=",
"type": "validator",
@@ -102,6 +106,7 @@ mod topology_requests {
],
"mixNodes": [
{
"location": "unknown",
"host": "35.176.155.107:1789",
"pubKey": "zSob16499jT7C3S3ky4GihNOjlU6aLfSRkf1xAxOwV0=",
"layer": 3,
@@ -109,6 +114,7 @@ mod topology_requests {
"version": "0.1.0"
},
{
"location": "unknown",
"host": "18.130.86.190:1789",
"pubKey": "vCdpFc0NvW0NSqsuTxtjFtiSY35aXesgT3JNA8sSIXk=",
"layer": 1,
@@ -116,6 +122,7 @@ mod topology_requests {
"version": "0.1.0"
},
{
"location": "unknown",
"host": "3.10.22.152:1789",
"pubKey": "OwOqwWjh_IlnaWS2PxO6odnhNahOYpRCkju50beQCTA=",
"layer": 1,
@@ -123,6 +130,7 @@ mod topology_requests {
"version": "0.1.0"
},
{
"location": "unknown",
"host": "35.178.213.77:1789",
"pubKey": "nkkrUjgL8UJk05QydvWvFSvtRB6nmeV8RMvH5540J3s=",
"layer": 2,
@@ -130,6 +138,7 @@ mod topology_requests {
"version": "0.1.0"
},
{
"location": "unknown",
"host": "52.56.99.196:1789",
"pubKey": "whHuBuEc6zyOZOquKbuATaH4Crml61V_3Y-MztpWhF4=",
"layer": 2,
@@ -137,6 +146,7 @@ mod topology_requests {
"version": "0.1.0"
},
{
"location": "unknown",
"host": "3.9.12.238:1789",
"pubKey": "vk5Sr-Xyi0cTbugACv8U42ZJ6hs6cGDox0rpmXY94Fc=",
"layer": 3,
@@ -146,6 +156,7 @@ mod topology_requests {
],
"mixProviderNodes": [
{
"location": "unknown",
"clientListener": "3.8.176.11:8888",
"mixnetListener": "3.8.176.11:9999",
"pubKey": "54U6krAr-j9nQXFlsHk3io04_p0tctuqH71t7w_usgI=",
@@ -263,6 +274,7 @@ mod topology_requests {
"version": "0.1.0"
},
{
"location": "unknown",
"clientListener": "3.8.176.12:8888",
"mixnetListener": "3.8.176.12:9999",
"pubKey": "sA-sxi038pEbGy4lgZWG-RdHHDkA6kZzu44G0LUxFSc=",
+1
View File
@@ -2,6 +2,7 @@ use crate::filter;
#[derive(Debug, Clone)]
pub struct Node {
pub location: String,
pub host: String,
pub pub_key: String,
pub last_seen: u64,
+1
View File
@@ -5,6 +5,7 @@ use std::net::SocketAddr;
#[derive(Debug, Clone)]
pub struct Node {
pub location: String,
pub host: SocketAddr,
pub pub_key: String,
pub layer: u64,
+1
View File
@@ -10,6 +10,7 @@ pub struct Client {
#[derive(Debug, Clone)]
pub struct Node {
pub location: String,
pub client_listener: SocketAddr,
pub mixnet_listener: SocketAddr,
pub pub_key: String,
+6
View File
@@ -15,6 +15,12 @@ pub fn command_args<'a, 'b>() -> clap::App<'a, 'b> {
.takes_value(true)
.required(true),
)
.arg(
Arg::with_name("location")
.long("location")
.help("Optional geographical location of this node")
.takes_value(true),
)
.arg(
Arg::with_name("layer")
.long("layer")
+4
View File
@@ -41,5 +41,9 @@ pub(crate) fn override_config(mut config: Config, matches: &ArgMatches) -> Confi
config = config.with_announce_port(announce_port.unwrap());
}
if let Some(location) = matches.value_of("location") {
config = config.with_location(location);
}
config
}
+6
View File
@@ -15,6 +15,12 @@ pub fn command_args<'a, 'b>() -> App<'a, 'b> {
.required(true),
)
// the rest of arguments are optional, they are used to override settings in config file
.arg(
Arg::with_name("location")
.long("location")
.help("Optional geographical location of this node")
.takes_value(true),
)
.arg(
Arg::with_name("config")
.long("config")
+20
View File
@@ -91,6 +91,11 @@ impl Config {
self
}
pub fn with_location<S: Into<String>>(mut self, location: S) -> Self {
self.mixnode.location = location.into();
self
}
// if you want to use distinct servers for metrics and presence
// you need to do so in the config.toml file.
pub fn with_custom_directory<S: Into<String>>(mut self, directory_server: S) -> Self {
@@ -180,6 +185,10 @@ impl Config {
self.config_directory().join(Self::config_file_name())
}
pub fn get_location(&self) -> String {
self.mixnode.location.clone()
}
pub fn get_private_sphinx_key_file(&self) -> PathBuf {
self.mixnode.private_sphinx_key_file.clone()
}
@@ -231,6 +240,12 @@ pub struct MixNode {
/// ID specifies the human readable ID of this particular mixnode.
id: String,
/// Completely optional value specifying geographical location of this particular node.
/// Currently it's used entirely for debug purposes, as there are no mechanisms implemented
/// to verify correctness of the information provided. However, feel free to fill in
/// this field with as much accuracy as you wish to share.
location: String,
/// Layer of this particular mixnode determining its position in the network.
layer: u64,
@@ -264,12 +279,17 @@ impl MixNode {
fn default_public_sphinx_key_file(id: &str) -> PathBuf {
Config::default_data_directory(Some(id)).join("public_sphinx.pem")
}
fn default_location() -> String {
"unknown".into()
}
}
impl Default for MixNode {
fn default() -> Self {
MixNode {
id: "".to_string(),
location: Self::default_location(),
layer: 0,
listening_address: format!("0.0.0.0:{}", DEFAULT_LISTENING_PORT)
.parse()
+6
View File
@@ -13,6 +13,12 @@ pub(crate) fn config_template() -> &'static str {
# Human readable ID of this particular mixnode.
id = "{{ mixnode.id }}"
# Completely optional value specifying geographical location of this particular node.
# Currently it's used entirely for debug purposes, as there are no mechanisms implemented
# to verify correctness of the information provided. However, feel free to fill in
# this field with as much accuracy as you wish to share.
location = "{{ mixnode.location }}"
# Layer of this particular mixnode determining its position in the network.
layer = {{ mixnode.layer }}
+1
View File
@@ -46,6 +46,7 @@ impl MixNode {
fn start_presence_notifier(&self) {
info!("Starting presence notifier...");
let notifier_config = presence::NotifierConfig::new(
self.config.get_location(),
self.config.get_presence_directory_server(),
self.config.get_announce_address(),
self.sphinx_keypair.public_key().to_base58_string(),
+4
View File
@@ -8,6 +8,7 @@ use tokio::runtime::Handle;
use tokio::task::JoinHandle;
pub struct NotifierConfig {
location: String,
directory_server: String,
announce_host: String,
pub_key_string: String,
@@ -17,6 +18,7 @@ pub struct NotifierConfig {
impl NotifierConfig {
pub fn new(
location: String,
directory_server: String,
announce_host: String,
pub_key_string: String,
@@ -24,6 +26,7 @@ impl NotifierConfig {
sending_delay: Duration,
) -> Self {
NotifierConfig {
location,
directory_server,
announce_host,
pub_key_string,
@@ -46,6 +49,7 @@ impl Notifier {
};
let net_client = directory_client::Client::new(directory_client_cfg);
let presence = MixNodePresence {
location: config.location,
host: config.announce_host,
pub_key: config.pub_key_string,
layer: config.layer,
+6
View File
@@ -15,6 +15,12 @@ pub fn command_args<'a, 'b>() -> clap::App<'a, 'b> {
.takes_value(true)
.required(true),
)
.arg(
Arg::with_name("location")
.long("location")
.help("Optional geographical location of this provider")
.takes_value(true),
)
.arg(
Arg::with_name("mix-host")
.long("mix-host")
+4
View File
@@ -83,5 +83,9 @@ pub(crate) fn override_config(mut config: Config, matches: &ArgMatches) -> Confi
config = config.with_custom_clients_ledger(clients_ledger);
}
if let Some(location) = matches.value_of("location") {
config = config.with_location(location);
}
config
}
+6
View File
@@ -15,6 +15,12 @@ pub fn command_args<'a, 'b>() -> clap::App<'a, 'b> {
.required(true),
)
// the rest of arguments are optional, they are used to override settings in config file
.arg(
Arg::with_name("location")
.long("location")
.help("Optional geographical location of this node")
.takes_value(true),
)
.arg(
Arg::with_name("config")
.long("config")
+20
View File
@@ -108,6 +108,11 @@ impl Config {
self
}
pub fn with_location<S: Into<String>>(mut self, location: S) -> Self {
self.provider.location = location.into();
self
}
pub fn with_mix_listening_host<S: Into<String>>(mut self, host: S) -> Self {
// see if the provided `host` is just an ip address or ip:port
let host = host.into();
@@ -277,6 +282,10 @@ impl Config {
self.config_directory().join(Self::config_file_name())
}
pub fn get_location(&self) -> String {
self.provider.location.clone()
}
pub fn get_private_sphinx_key_file(&self) -> PathBuf {
self.provider.private_sphinx_key_file.clone()
}
@@ -332,6 +341,12 @@ pub struct Provider {
/// ID specifies the human readable ID of this particular provider.
id: String,
/// Completely optional value specifying geographical location of this particular provider.
/// Currently it's used entirely for debug purposes, as there are no mechanisms implemented
/// to verify correctness of the information provided. However, feel free to fill in
/// this field with as much accuracy as you wish to share.
location: String,
/// Path to file containing private sphinx key.
private_sphinx_key_file: PathBuf,
@@ -351,12 +366,17 @@ impl Provider {
fn default_public_sphinx_key_file(id: &str) -> PathBuf {
Config::default_data_directory(Some(id)).join("public_sphinx.pem")
}
fn default_location() -> String {
"unknown".into()
}
}
impl Default for Provider {
fn default() -> Self {
Provider {
id: "".to_string(),
location: Self::default_location(),
private_sphinx_key_file: Default::default(),
public_sphinx_key_file: Default::default(),
nym_root_directory: Config::default_root_directory(),
+6
View File
@@ -13,6 +13,12 @@ pub(crate) fn config_template() -> &'static str {
# Human readable ID of this particular service provider.
id = "{{ provider.id }}"
# Completely optional value specifying geographical location of this particular node.
# Currently it's used entirely for debug purposes, as there are no mechanisms implemented
# to verify correctness of the information provided. However, feel free to fill in
# this field with as much accuracy as you wish to share.
location = "{{ provider.location }}"
# Path to file containing private sphinx key.
private_sphinx_key_file = "{{ provider.private_sphinx_key_file }}"
+1
View File
@@ -45,6 +45,7 @@ impl ServiceProvider {
fn start_presence_notifier(&self) {
info!("Starting presence notifier...");
let notifier_config = presence::NotifierConfig::new(
self.config.get_location(),
self.config.get_presence_directory_server(),
self.config.get_mix_announce_address(),
self.config.get_clients_announce_address(),
+6
View File
@@ -9,6 +9,7 @@ use tokio::runtime::Handle;
use tokio::task::JoinHandle;
pub struct NotifierConfig {
location: String,
directory_server: String,
mix_announce_host: String,
clients_announce_host: String,
@@ -18,6 +19,7 @@ pub struct NotifierConfig {
impl NotifierConfig {
pub fn new(
location: String,
directory_server: String,
mix_announce_host: String,
clients_announce_host: String,
@@ -25,6 +27,7 @@ impl NotifierConfig {
sending_delay: Duration,
) -> Self {
NotifierConfig {
location,
directory_server,
mix_announce_host,
clients_announce_host,
@@ -35,6 +38,7 @@ impl NotifierConfig {
}
pub struct Notifier {
location: String,
net_client: directory_client::Client,
client_ledger: ClientLedger,
sending_delay: Duration,
@@ -53,6 +57,7 @@ impl Notifier {
Notifier {
client_ledger,
net_client,
location: config.location,
client_listener: config.clients_announce_host,
mixnet_listener: config.mix_announce_host,
pub_key_string: config.pub_key_string,
@@ -62,6 +67,7 @@ impl Notifier {
async fn make_presence(&self) -> MixProviderPresence {
MixProviderPresence {
location: self.location.clone(),
client_listener: self.client_listener.clone(),
mixnet_listener: self.mixnet_listener.clone(),
pub_key: self.pub_key_string.clone(),
+6
View File
@@ -12,6 +12,12 @@ pub fn command_args<'a, 'b>() -> clap::App<'a, 'b> {
.takes_value(true)
.required(true),
)
.arg(
Arg::with_name("location")
.long("location")
.help("Optional geographical location of this node")
.takes_value(true),
)
.arg(
Arg::with_name("directory")
.long("directory")
+4
View File
@@ -9,5 +9,9 @@ pub(crate) fn override_config(mut config: Config, matches: &ArgMatches) -> Confi
config = config.with_custom_directory(directory);
}
if let Some(location) = matches.value_of("location") {
config = config.with_location(location);
}
config
}
+6
View File
@@ -15,6 +15,12 @@ pub fn command_args<'a, 'b>() -> clap::App<'a, 'b> {
.required(true),
)
// the rest of arguments are optional, they are used to override settings in config file
.arg(
Arg::with_name("location")
.long("location")
.help("Optional geographical location of this node")
.takes_value(true),
)
.arg(
Arg::with_name("config")
.long("config")
+22 -1
View File
@@ -98,11 +98,21 @@ impl Config {
self
}
pub fn with_location<S: Into<String>>(mut self, location: S) -> Self {
self.validator.location = location.into();
self
}
// getters
pub fn get_config_file_save_location(&self) -> PathBuf {
self.config_directory().join(Self::config_file_name())
}
#[allow(dead_code)]
pub fn get_location(&self) -> String {
self.validator.location.clone()
}
pub fn get_mix_mining_directory_server(&self) -> String {
self.mix_mining.directory_server.clone()
}
@@ -137,17 +147,28 @@ pub struct Validator {
/// ID specifies the human readable ID of this particular validator.
id: String,
/// Completely optional value specifying geographical location of this particular node.
/// Currently it's used entirely for debug purposes, as there are no mechanisms implemented
/// to verify correctness of the information provided. However, feel free to fill in
/// this field with as much accuracy as you wish to share.
location: String,
/// nym_home_directory specifies absolute path to the home nym MixNodes directory.
/// It is expected to use default value and hence .toml file should not redefine this field.
nym_root_directory: PathBuf,
}
impl Validator {}
impl Validator {
fn default_location() -> String {
"unknown".into()
}
}
impl Default for Validator {
fn default() -> Self {
Validator {
id: "".to_string(),
location: Self::default_location(),
nym_root_directory: Config::default_root_directory(),
}
}
+6
View File
@@ -13,6 +13,12 @@ pub(crate) fn config_template() -> &'static str {
# Human readable ID of this particular validator.
id = "{{ validator.id }}"
# Completely optional value specifying geographical location of this particular node.
# Currently it's used entirely for debug purposes, as there are no mechanisms implemented
# to verify correctness of the information provided. However, feel free to fill in
# this field with as much accuracy as you wish to share.
location = "{{ validator.location }}"
##### advanced configuration options #####
# nym_home_directory specifies absolute path to the home nym validators directory.