From b59b9fa4a5b3620814cd25fc2800bd59684c692b Mon Sep 17 00:00:00 2001 From: 0xjac Date: Sun, 29 Dec 2019 16:13:32 +0100 Subject: [PATCH 01/10] runner: print public key on startup Closes #19 --- src/node/runner.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/node/runner.rs b/src/node/runner.rs index c33dfa453c..372dcccd74 100644 --- a/src/node/runner.rs +++ b/src/node/runner.rs @@ -12,6 +12,7 @@ pub fn start(matches: &ArgMatches) { println!("Starting mixnode..."); let config = new_config(matches); + println!("Public key: {}", config.public_key_string()); // println!("Startup on: {}", config.socket_address); println!("Listening for incoming packets..."); From cddc61fe578356c223217424ae6a825c1d663b7d Mon Sep 17 00:00:00 2001 From: mileschet Date: Sun, 29 Dec 2019 17:07:41 +0100 Subject: [PATCH 02/10] updated readme with dependencies instructions added some information about the dependencies until we fix cargo dependencies. --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 633c7cda48..bcb89473ea 100644 --- a/README.md +++ b/README.md @@ -17,3 +17,11 @@ The built binary can be found at `target/release/nym-mixnode` * `nym-mixnode run --layer 1` will start the mixnode in layer 1 (coordinate with other people to find out which layer you need to start yours in) By default, the Nym Mixnode will start on port 1789. If desired, you can change the port using the `--port` option. + +### Dependencies + +It's important to download the following repositories before building the mixnode: + +* https://github.com/nymtech/nym-client +* https://github.com/nymtech/nym-sfw-provider +* https://github.com/nymtech/sphinx From 27c61cb194de28fe0fba426944847d0f2573f935 Mon Sep 17 00:00:00 2001 From: Jedrzej Stuczynski Date: Mon, 6 Jan 2020 12:04:45 +0000 Subject: [PATCH 03/10] Printing node version number on startup --- Cargo.lock | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 5 +++ build.rs | 5 +++ src/main.rs | 26 ++++++++----- 4 files changed, 131 insertions(+), 9 deletions(-) create mode 100644 build.rs diff --git a/Cargo.lock b/Cargo.lock index ebff5ed59e..5b16669dec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -167,6 +167,17 @@ dependencies = [ "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "built" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "git2 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "byte-tools" version = "0.3.1" @@ -204,6 +215,10 @@ dependencies = [ name = "cc" version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "jobserver 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "cfg-if" @@ -219,6 +234,16 @@ dependencies = [ "keystream 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "chrono" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "clap" version = "2.33.0" @@ -622,6 +647,18 @@ dependencies = [ "wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "git2" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "libgit2-sys 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "h2" version = "0.1.26" @@ -786,6 +823,16 @@ name = "itoa" version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "jobserver" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "kernel32-sys" version = "0.2.2" @@ -810,6 +857,28 @@ name = "libc" version = "0.2.65" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "libgit2-sys" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libz-sys" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)", + "vcpkg 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "lioness" version = "0.1.2" @@ -968,6 +1037,23 @@ dependencies = [ "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "num-integer" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-traits" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "num_cpus" version = "1.11.1" @@ -1005,6 +1091,7 @@ name = "nym-mixnode" version = "0.1.0" dependencies = [ "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "built 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "curve25519-dalek 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1851,6 +1938,14 @@ dependencies = [ "tungstenite 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "toml" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "try-lock" version = "0.2.2" @@ -2058,6 +2153,7 @@ dependencies = [ "checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" "checksum block-cipher-trait 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1c924d49bd09e7c06003acda26cd9742e796e34282ec6c1189404dee0c1f4774" "checksum block-padding 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" +"checksum built 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3d2315cfb416f86e05360edc950b1d7d25ecfb00f7f8eba60dbd7882a0f2e944" "checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" "checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" "checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" @@ -2066,6 +2162,7 @@ dependencies = [ "checksum cc 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)" = "aa87058dce70a3ff5621797f1506cb837edd02ac4c0ae642b4542dce802908b8" "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" "checksum chacha 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddf3c081b5fba1e5615640aae998e0fbd10c24cbd897ee39ed754a77601a4862" +"checksum chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "31850b4a4d6bae316f7a09e691c944c28299298837edc0a03f755618c23cbc01" "checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" "checksum clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "97276801e127ffb46b66ce23f35cc96bd454fa311294bced4bbace7baa8b1d17" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" @@ -2113,6 +2210,7 @@ dependencies = [ "checksum futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c0d66274fb76985d3c62c886d1da7ac4c0903a8c9f754e8fe0f35a6a6cc39e76" "checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" "checksum getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "e7db7ca94ed4cd01190ceee0d8a8052f08a247aa1b469a7f68c6a3b71afcf407" +"checksum git2 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c1af51ea8a906616af45a4ce78eacf25860f7a13ae7bf8a814693f0f4037a26" "checksum h2 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)" = "a5b34c246847f938a410a03c5458c7fee2274436675e76d8b903c08efc29c462" "checksum hermit-abi 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "307c3c9f937f38e3534b1d6447ecf090cafcc9744e4a6360e8b037b2cf5af120" "checksum hex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "023b39be39e3a2da62a94feb433e91e8bcd37676fbc8bea371daf52b7a769a3e" @@ -2129,10 +2227,13 @@ dependencies = [ "checksum input_buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8e1b822cc844905551931d6f81608ed5f50a79c1078a4e2b4d42dbc7c1eedfbf" "checksum iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" "checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" +"checksum jobserver 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b1d42ef453b30b7387e113da1c83ab1605d90c5b4e0eb8e96d016ed3b8c160" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum keystream 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c33070833c9ee02266356de0c43f723152bd38bd96ddf52c82b3af10c9138b28" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" "checksum libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "1a31a0627fdf1f6a39ec0dd577e101440b7db22672c0901fe00a9a6fbb5c24e8" +"checksum libgit2-sys 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4870c781f6063efb83150cd22c1ddf6ecf58531419e7570cdcced46970f64a16" +"checksum libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe" "checksum lioness 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4ae926706ba42c425c9457121178330d75e273df2e82e28b758faf3de3a9acb9" "checksum lock_api 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e57b3997725d2b60dbec1297f6c2e2957cc383db1cebd6be812163f969c7d586" "checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" @@ -2150,6 +2251,8 @@ dependencies = [ "checksum miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "396aa0f2003d7df8395cb93e09871561ccc3e785f0acb369170e8cc74ddf9226" "checksum native-tls 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b2df1a4c22fd44a62147fd8f13dd0f95c9d8ca7b2610299b2a2f9cf8964274e" "checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" +"checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09" +"checksum num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c81ffc11c212fa327657cb19dd85eb7419e163b5b076bede2bdb5c974c07e4" "checksum num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "76dac5ed2a876980778b8b85f75a71b6cbf0db0b1232ee12f826bccb00d09d72" "checksum opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" "checksum openssl 0.10.26 (registry+https://github.com/rust-lang/crates.io-index)" = "3a3cc5799d98e1088141b8e01ff760112bbd9f19d850c124500566ca6901a585" @@ -2238,6 +2341,7 @@ dependencies = [ "checksum tokio-threadpool 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "f0c32ffea4827978e9aa392d2f743d973c1dfa3730a2ed3f22ce1e6984da848c" "checksum tokio-timer 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "1739638e364e558128461fc1ad84d997702c8e31c2e6b18fb99842268199e827" "checksum tokio-tungstenite 0.10.0 (git+https://github.com/dbcfd/tokio-tungstenite?rev=6dc2018cbfe8fe7ddd75ff977343086503135b38)" = "" +"checksum toml 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "01d1404644c8b12b16bfcffa4322403a91a451584daaaa7c28d3152e6cbc98cf" "checksum try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" "checksum try_from 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "283d3b89e1368717881a9d51dad843cc435380d8109c9e47d38780a324698d8b" "checksum tungstenite 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8a0c2bd5aeb7dcd2bb32e472c8872759308495e5eccc942e929a513cd8d36110" diff --git a/Cargo.toml b/Cargo.toml index 0adfb88178..4eef4205d4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,5 @@ [package] +build = "build.rs" name = "nym-mixnode" version = "0.1.0" authors = ["Dave Hrycyszyn "] @@ -14,3 +15,7 @@ futures = "0.3.1" nym-client = { path = "../nym-client" } sphinx = { path = "../sphinx" } tokio = { version = "0.2", features = ["full"] } + + +[build-dependencies] +built = "0.3.2" \ No newline at end of file diff --git a/build.rs b/build.rs new file mode 100644 index 0000000000..71d5c82762 --- /dev/null +++ b/build.rs @@ -0,0 +1,5 @@ +use built; + +fn main() { + built::write_built_file().expect("Failed to acquire build-time information"); +} diff --git a/src/main.rs b/src/main.rs index e3b9d32ee4..e652fc9ae4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,13 +16,14 @@ fn main() { Arg::with_name("host") .long("host") .help("The custom host on which the mixnode will be running") - .takes_value(true), + .takes_value(true) + .required(true), ) .arg( Arg::with_name("port") .long("port") .help("The port on which the mixnode will be listening") - .takes_value(true) + .takes_value(true), ) .arg( Arg::with_name("layer") @@ -32,9 +33,9 @@ fn main() { .required(true), ) .arg( - Arg::with_name("local") - .long("local") - .help("Flag to indicate whether the client is expected to run on a local deployment.") + Arg::with_name("directory") + .long("directory") + .help("Address of the directory server the node is sending presence and metrics to") .takes_value(false), ), ) @@ -46,6 +47,11 @@ fn main() { } } +pub mod built_info { + // The file has been placed there by the build script. + include!(concat!(env!("OUT_DIR"), "/built.rs")); +} + fn execute(matches: ArgMatches) -> Result<(), String> { match matches.subcommand() { ("run", Some(m)) => Ok(node::runner::start(m)), @@ -58,7 +64,8 @@ fn usage() -> String { } fn banner() -> String { - return r#" + format!( + r#" _ __ _ _ _ __ ___ | '_ \| | | | '_ \ _ \ @@ -66,8 +73,9 @@ fn banner() -> String { |_| |_|\__, |_| |_| |_| |___/ - (mixnode) + (mixnode - version {:}) - "# - .to_string(); + "#, + built_info::PKG_VERSION + ) } From efb4660fe7e4998354130973c5da10fd26009a9b Mon Sep 17 00:00:00 2001 From: Jedrzej Stuczynski Date: Mon, 6 Jan 2020 12:12:40 +0000 Subject: [PATCH 04/10] Requiring explicit host + printing bound address on startup --- src/node/runner.rs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/node/runner.rs b/src/node/runner.rs index 372dcccd74..00bc6d805f 100644 --- a/src/node/runner.rs +++ b/src/node/runner.rs @@ -14,8 +14,10 @@ pub fn start(matches: &ArgMatches) { let config = new_config(matches); println!("Public key: {}", config.public_key_string()); - // println!("Startup on: {}", config.socket_address); - println!("Listening for incoming packets..."); + println!( + "Listening for incoming packets on {}", + config.socket_address + ); let mix = MixNode::new(&config); thread::spawn(move || { @@ -26,7 +28,7 @@ pub fn start(matches: &ArgMatches) { } fn new_config(matches: &ArgMatches) -> node::Config { - let host = matches.value_of("host").unwrap_or("0.0.0.0"); + let host = matches.value_of("host").unwrap(); let port = match matches.value_of("port").unwrap_or("1789").parse::() { Ok(n) => n, @@ -38,8 +40,6 @@ fn new_config(matches: &ArgMatches) -> node::Config { Err(err) => panic!("Invalid layer value provided - {:?}", err), }; - let is_local = matches.is_present("local"); - let socket_address = (host, port) .to_socket_addrs() .expect("Failed to combine host and port") @@ -48,11 +48,10 @@ fn new_config(matches: &ArgMatches) -> node::Config { let (secret_key, public_key) = sphinx::crypto::keygen(); - let directory_server = if is_local { - "http://localhost:8080".to_string() - } else { - "https://directory.nymtech.net".to_string() - }; + let directory_server = matches + .value_of("directory") + .unwrap_or("https://directory.nymtech.net") + .to_string(); node::Config { directory_server, From 0bb69597554ce485480240618136c4c30d8f7cb9 Mon Sep 17 00:00:00 2001 From: Jedrzej Stuczynski Date: Mon, 6 Jan 2020 12:20:08 +0000 Subject: [PATCH 05/10] Printing directory server on start --- src/main.rs | 2 +- src/node/runner.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index e652fc9ae4..d3ac898c9d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -36,7 +36,7 @@ fn main() { Arg::with_name("directory") .long("directory") .help("Address of the directory server the node is sending presence and metrics to") - .takes_value(false), + .takes_value(true), ), ) .get_matches(); diff --git a/src/node/runner.rs b/src/node/runner.rs index 00bc6d805f..4e55bc7e86 100644 --- a/src/node/runner.rs +++ b/src/node/runner.rs @@ -13,7 +13,7 @@ pub fn start(matches: &ArgMatches) { let config = new_config(matches); println!("Public key: {}", config.public_key_string()); - + println!("Directory server: {}", config.directory_server); println!( "Listening for incoming packets on {}", config.socket_address From d5a0e7d3553a76917edb69beef5f019f40dc308c Mon Sep 17 00:00:00 2001 From: Jedrzej Stuczynski Date: Mon, 6 Jan 2020 14:43:19 +0000 Subject: [PATCH 06/10] ipv6_addressing --- Cargo.lock | 1 + src/mix_peer.rs | 15 ++++++++------- src/node/mod.rs | 4 +++- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5b16669dec..f8a87bb65c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1068,6 +1068,7 @@ name = "nym-client" version = "0.1.0" dependencies = [ "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "built 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "curve25519-dalek 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/src/mix_peer.rs b/src/mix_peer.rs index 64cbe02ed7..b71824ee95 100644 --- a/src/mix_peer.rs +++ b/src/mix_peer.rs @@ -1,21 +1,22 @@ +use curve25519_dalek::digest::Digest; +use nym_client::utils::addressing; +use std::convert::TryInto; use std::error::Error; -use std::net::{Ipv4Addr, SocketAddrV4}; +use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr}; use tokio::prelude::*; #[derive(Debug)] pub struct MixPeer { - connection: SocketAddrV4, + connection: SocketAddr, } impl MixPeer { // note that very soon `next_hop_address` will be changed to `next_hop_metadata` pub fn new(next_hop_address: [u8; 32]) -> MixPeer { - let b = next_hop_address; - let host = Ipv4Addr::new(b[0], b[1], b[2], b[3]); - let port: u16 = u16::from_be_bytes([b[4], b[5]]); - let socket_address = SocketAddrV4::new(host, port); + let next_hop_socket_address = + addressing::socket_address_from_encoded_bytes(next_hop_address); MixPeer { - connection: socket_address, + connection: next_hop_socket_address, } } diff --git a/src/node/mod.rs b/src/node/mod.rs index 9284d346e6..eec733dfbb 100644 --- a/src/node/mod.rs +++ b/src/node/mod.rs @@ -10,6 +10,7 @@ use std::time::Duration; use tokio::prelude::*; use tokio::runtime::Runtime; +use crate::mix_peer; use crate::mix_peer::MixPeer; use crate::node::metrics::MetricsReporter; use futures::SinkExt; @@ -36,6 +37,7 @@ impl Config { #[derive(Debug)] pub enum MixProcessingError { + InvalidPeerAddressError, SphinxRecoveryError, ReceivedFinalHopError, } @@ -98,7 +100,7 @@ impl ProcessingData { } } -struct PacketProcessor {} +struct PacketProcessor; impl PacketProcessor { pub async fn process_sphinx_data_packet( From 7f3ea6af1a832f5c52f355e97ea581473ffdd4da Mon Sep 17 00:00:00 2001 From: Jedrzej Stuczynski Date: Mon, 6 Jan 2020 15:26:43 +0000 Subject: [PATCH 07/10] Changelog file --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000000..9e3a675207 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +# nym-mixnode Changelog + +## 0.1.0 - Initial Release + +* The bare minimum set of features required by a Nym Mixnode \ No newline at end of file From 4fc2e3bc0d60ceb594c515849a3deeeb17bada25 Mon Sep 17 00:00:00 2001 From: Dave Hrycyszyn Date: Mon, 6 Jan 2020 17:42:04 +0000 Subject: [PATCH 08/10] Changelog for 0.2.0 release --- CHANGELOG.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e3a675207..bd38641c87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # nym-mixnode Changelog +## 0.2.0 + +* removed the `--local` flag +* introduced `--directory` argument to support arbitrary directory servers. Leaving it out will point the node at the "https://directory.nymtech.net" alpha testnet server +* the `host` argument is now required +* IPv6 support +* mixnode version number is now shown at node start +* directory server location is now shown at node start + ## 0.1.0 - Initial Release -* The bare minimum set of features required by a Nym Mixnode \ No newline at end of file +* The bare minimum set of features required by a Nym Mixnode From 38e747104eae39ef894556ae592cadc1c3d8ce3b Mon Sep 17 00:00:00 2001 From: Dave Hrycyszyn Date: Mon, 6 Jan 2020 17:42:44 +0000 Subject: [PATCH 09/10] =?UTF-8?q?Added=20the=20glorious=20and=20talented?= =?UTF-8?q?=20J=C4=99drzej=20Stuczy=C5=84ski=20to=20authors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 4eef4205d4..22ca58fad2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ build = "build.rs" name = "nym-mixnode" version = "0.1.0" -authors = ["Dave Hrycyszyn "] +authors = ["Dave Hrycyszyn ", "Jędrzej Stuczyński "] edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html From 220ef1b0ef2552523328178c879a5be97041f904 Mon Sep 17 00:00:00 2001 From: Dave Hrycyszyn Date: Mon, 6 Jan 2020 17:43:12 +0000 Subject: [PATCH 10/10] Version number bump --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 22ca58fad2..43573e6572 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] build = "build.rs" name = "nym-mixnode" -version = "0.1.0" +version = "0.2.0" authors = ["Dave Hrycyszyn ", "Jędrzej Stuczyński "] edition = "2018" @@ -18,4 +18,4 @@ tokio = { version = "0.2", features = ["full"] } [build-dependencies] -built = "0.3.2" \ No newline at end of file +built = "0.3.2"