Removed unused imports

This commit is contained in:
Jedrzej Stuczynski
2020-02-05 16:52:17 +00:00
parent 1fa599dd63
commit 800c41ce97
17 changed files with 19 additions and 62 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
use handlebars::Handlebars;
use serde::de::DeserializeOwned;
use serde::Serialize;
use std::path::{Path, PathBuf};
use std::path::PathBuf;
use std::{fs, io};
pub trait NymConfig: Default + Serialize + DeserializeOwned {
+1 -1
View File
@@ -1,7 +1,7 @@
use crate::path_check::{PathChecker, PathStatus};
use crate::score::NodeScore;
use crypto::identity::MixIdentityKeyPair;
use log::{debug, error, info, warn};
use log::{debug, error, warn};
use rand_os::rand_core::RngCore;
use sphinx::route::NodeAddressBytes;
use std::collections::HashMap;
+1
View File
@@ -10,6 +10,7 @@ use std::io::prelude::*;
use std::path::PathBuf;
pub struct PemStore {
#[allow(dead_code)]
config_dir: PathBuf,
private_mix_key_file: PathBuf,
public_mix_key_file: PathBuf,
-1
View File
@@ -3,7 +3,6 @@ use crate::config::persistance::pathfinder::MixNodePathfinder;
use clap::{App, Arg, ArgMatches};
use config::NymConfig;
use crypto::encryption;
use crypto::identity::MixIdentityKeyPair;
use pemstore::pemstore::PemStore;
pub fn command_args<'a, 'b>() -> clap::App<'a, 'b> {
-3
View File
@@ -1,11 +1,8 @@
use crate::commands::override_config;
use crate::config::persistance::pathfinder::MixNodePathfinder;
use crate::config::Config;
use crate::node;
use crate::node::MixNode;
use clap::{App, Arg, ArgMatches};
use config::NymConfig;
use pemstore::pemstore::PemStore;
pub fn command_args<'a, 'b>() -> App<'a, 'b> {
App::new("run")
@@ -10,18 +10,6 @@ pub struct MixNodePathfinder {
}
impl MixNodePathfinder {
pub fn new(id: String) -> Self {
let os_config_dir = dirs::config_dir().unwrap(); // grabs the OS default config dir
let config_dir = os_config_dir.join("nym").join("mixnodes").join(id);
let private_sphinx_key = config_dir.join("private.pem");
let public_sphinx_key = config_dir.join("public.pem");
MixNodePathfinder {
config_dir,
private_sphinx_key,
public_sphinx_key,
}
}
pub fn new_from_config(config: &Config) -> Self {
MixNodePathfinder {
config_dir: config.get_config_file_save_location(),
-2
View File
@@ -1,6 +1,4 @@
use clap::{App, ArgMatches};
use log::*;
use std::process;
pub mod built_info;
mod commands;
-2
View File
@@ -9,8 +9,6 @@ use std::collections::HashMap;
use std::sync::Arc;
use std::time::Duration;
const METRICS_INTERVAL: u64 = 3;
#[derive(Debug)]
pub struct MetricsReporter {
received: u64,
-2
View File
@@ -1,7 +1,6 @@
use crate::config::persistance::pathfinder::MixNodePathfinder;
use crate::config::Config;
use crate::mix_peer::MixPeer;
use crate::node;
use crate::node::metrics::MetricsReporter;
use crypto::encryption;
use futures::channel::mpsc;
@@ -11,7 +10,6 @@ use log::*;
use pemstore::pemstore::PemStore;
use sphinx::header::delays::Delay as SphinxDelay;
use sphinx::{ProcessedPacket, SphinxPacket};
use std::net::SocketAddr;
use std::sync::Arc;
use std::time::Duration;
use tokio::prelude::*;
-2
View File
@@ -1,10 +1,8 @@
use crate::client::NymClient;
use crate::commands::override_config;
use crate::config::persistance::pathfinder::ClientPathfinder;
use crate::config::Config;
use clap::{App, Arg, ArgMatches};
use config::NymConfig;
use pemstore::pemstore::PemStore;
pub fn command_args<'a, 'b>() -> clap::App<'a, 'b> {
App::new("run")
-4
View File
@@ -1,12 +1,8 @@
use crate::commands::override_config;
use crate::config::Config;
use crate::provider;
use crate::provider::ServiceProvider;
use clap::{App, Arg, ArgMatches};
use config::NymConfig;
use crypto::identity::{MixIdentityPrivateKey, MixIdentityPublicKey};
use std::net::ToSocketAddrs;
use std::path::PathBuf;
pub fn command_args<'a, 'b>() -> clap::App<'a, 'b> {
App::new("run")
@@ -10,18 +10,6 @@ pub struct ProviderPathfinder {
}
impl ProviderPathfinder {
pub fn new(id: String) -> Self {
let os_config_dir = dirs::config_dir().unwrap(); // grabs the OS default config dir
let config_dir = os_config_dir.join("nym").join("mixnodes").join(id);
let private_sphinx_key = config_dir.join("private.pem");
let public_sphinx_key = config_dir.join("public.pem");
ProviderPathfinder {
config_dir,
private_sphinx_key,
public_sphinx_key,
}
}
pub fn new_from_config(config: &Config) -> Self {
ProviderPathfinder {
config_dir: config.get_config_file_save_location(),
+1 -1
View File
@@ -1,4 +1,4 @@
use clap::{App, ArgMatches, SubCommand};
use clap::{App, ArgMatches};
pub mod built_info;
mod commands;
@@ -1,7 +1,6 @@
use crate::provider::storage::{ClientStorage, StoreError};
use crate::provider::ClientLedger;
use crypto::encryption;
use crypto::identity::MixIdentityPrivateKey;
use futures::lock::Mutex as FMutex;
use hmac::{Hmac, Mac};
use log::*;
@@ -1,6 +1,5 @@
use crate::provider::storage::StoreData;
use crypto::encryption;
use crypto::identity::MixIdentityPrivateKey;
use log::{error, warn};
use sphinx::{ProcessedPacket, SphinxPacket};
use std::path::PathBuf;
+1 -1
View File
@@ -4,7 +4,7 @@ use crate::provider::client_handling::{ClientProcessingData, ClientRequestProces
use crate::provider::mix_handling::{MixPacketProcessor, MixProcessingData};
use crate::provider::storage::ClientStorage;
use crypto::encryption;
use crypto::identity::{MixIdentityPrivateKey, MixIdentityPublicKey};
use crypto::identity::MixIdentityPublicKey;
use directory_client::presence::providers::MixProviderClient;
use futures::io::Error;
use futures::lock::Mutex as FMutex;
+14 -16
View File
@@ -1,10 +1,7 @@
use crate::config::template::config_template;
use config::NymConfig;
use log::*;
use serde::{Deserialize, Serialize};
use std::net::{IpAddr, SocketAddr};
use std::path::PathBuf;
use std::str::FromStr;
use std::time;
mod template;
@@ -73,13 +70,13 @@ impl NymConfig for Config {
impl Config {
fn default_directory_server() -> String {
#[cfg(feature = "qa")]
return "https://qa-directory.nymtech.net".to_string();
return "https://qa-directory.nymtech.net".to_string();
#[cfg(feature = "local")]
return "http://localhost:8080".to_string();
return "http://localhost:8080".to_string();
"https://directory.nymtech.net".to_string()
}
pub fn new<S: Into<String>>(id: S) -> Self {
Config::default().with_id(id)
}
@@ -105,28 +102,31 @@ impl Config {
pub fn get_config_file_save_location(&self) -> PathBuf {
self.config_directory().join(Self::config_file_name())
}
pub fn get_mix_mining_directory_server(&self) -> String {
self.mix_mining.directory_server.clone()
}
// dead_code until validator actually sends the presence data
#[allow(dead_code)]
pub fn get_presence_directory_server(&self) -> String {
self.debug.presence_directory_server.clone()
}
#[allow(dead_code)]
pub fn get_presence_sending_delay(&self) -> time::Duration {
time::Duration::from_millis(self.debug.presence_sending_delay)
}
pub fn get_mix_mining_run_delay(&self) -> time::Duration {
time::Duration::from_millis(self.mix_mining.run_delay)
}
pub fn get_mix_mining_resolution_timeout(&self) -> time::Duration {
time::Duration::from_millis(self.mix_mining.resolution_timeout)
}
pub fn get_mix_mining_number_of_test_packets(&self) -> u64 {
pub fn get_mix_mining_number_of_test_packets(&self) -> u64 {
self.mix_mining.number_of_test_packets
}
}
@@ -214,9 +214,7 @@ pub struct Debug {
presence_sending_delay: u64,
}
impl Debug {
}
impl Debug {}
impl Default for Debug {
fn default() -> Self {