diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000000..0c4f7337ef --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,12 @@ +# nym-client Changelog + +* 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 +* IPv6 support +* client version number is now shown at node start +* directory server location is now shown at node start +* decrease default delays + +## 0.1.0 - Initial Release + +* The bare minimum set of features required by a Nym Client diff --git a/Cargo.lock b/Cargo.lock index 65f9a99d86..843b1a0f44 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,10 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +[[package]] +name = "adler32" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "aes-ctr" version = "0.3.0" @@ -31,11 +36,93 @@ dependencies = [ "stream-cipher 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "aho-corasick" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ansi_term" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "arc-swap" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "arrayref" version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "arrayvec" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "assert-json-diff" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "atty" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "autocfg" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "backtrace" +version = "0.3.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace-sys 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "backtrace-sys" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "base64" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "base64" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "bitflags" version = "1.2.1" @@ -52,6 +139,16 @@ dependencies = [ "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "blake2b_simd" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "constant_time_eq 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "block-buffer" version = "0.7.3" @@ -79,6 +176,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" @@ -89,6 +197,21 @@ name = "byteorder" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "bytes" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bytes" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "c2-chacha" version = "0.2.3" @@ -99,8 +222,12 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.47" +version = "1.0.48" 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" @@ -116,12 +243,36 @@ 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" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "clear_on_drop" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -132,6 +283,118 @@ dependencies = [ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "colored" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "constant_time_eq" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cookie" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cookie_store" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cookie 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "publicsuffix 1.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "try_from 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-foundation" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-foundation-sys" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "crc32fast" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-deque" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-epoch 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memoffset 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-queue" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-utils" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-utils" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "crypto-mac" version = "0.7.0" @@ -159,9 +422,14 @@ dependencies = [ "clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "subtle 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "subtle 2.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "difference" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "digest" version = "0.8.1" @@ -170,16 +438,221 @@ dependencies = [ "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "dirs" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "dirs-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "dirs-sys" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_users 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "dtoa" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "either" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "encoding_rs" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "error-chain" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "failure" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "failure_derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "fake-simd" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "flate2" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz_oxide 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fnv" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "fuchsia-cprng" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "futures" +version = "0.1.29" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "futures" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures-channel 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-executor 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-io 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "futures-channel" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "futures-core" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "futures-cpupool" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.29 (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 = "futures-executor" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "futures-io" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "futures-macro" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "futures-sink" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "futures-task" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "futures-util" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures-channel 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-io 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-macro 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-nested 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "generic-array" version = "0.12.3" @@ -194,10 +667,52 @@ version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "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.66 (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" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "indexmap 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "string 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "hermit-abi" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "hex" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "hkdf" version = "0.8.0" @@ -216,16 +731,178 @@ dependencies = [ "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "http" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "http-body" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-buf 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "httparse" +version = "1.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "hyper" +version = "0.12.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "h2 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "http-body 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-buf 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "want 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "hyper-tls" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.12.35 (registry+https://github.com/rust-lang/crates.io-index)", + "native-tls 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "idna" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-normalization 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "idna" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-normalization 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "indexmap" +version = "1.3.0" +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 = "input_buffer" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "iovec" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +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.66 (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" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "keystream" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "libc" -version = "0.2.65" +name = "lazy_static" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "libc" +version = "0.2.66" +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.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (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.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (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" @@ -238,10 +915,218 @@ dependencies = [ ] [[package]] -name = "nym-client" -version = "0.1.0" +name = "lock_api" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "log" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "matches" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "maybe-uninit" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "memchr" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "memoffset" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "mime" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "mime_guess" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "mime 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "unicase 2.6.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miniz_oxide" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "mio" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "mio-named-pipes" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", + "miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "mio-uds" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miow" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miow" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "mockito" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "assert-json-diff 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "colored 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "native-tls" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.10.26 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.53 (registry+https://github.com/rust-lang/crates.io-index)", + "schannel 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "security-framework 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "security-framework-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "net2" +version = "0.2.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "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" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "hermit-abi 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "nym-client" +version = "0.2.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)", + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "hex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "mockito 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pem 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_distr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "reqwest 0.9.22 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", + "sfw-provider-requests 0.1.0", "sphinx 0.1.0", + "tokio 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tungstenite 0.10.0 (git+https://github.com/dbcfd/tokio-tungstenite?rev=6dc2018cbfe8fe7ddd75ff977343086503135b38)", + "tungstenite 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -249,23 +1134,200 @@ name = "opaque-debug" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "openssl" +version = "0.10.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.53 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "openssl-probe" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "openssl-sys" +version = "0.9.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (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 = "parking_lot" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lock_api 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parking_lot_core" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pem" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "percent-encoding" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "percent-encoding" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "pin-project" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "pin-project-internal 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pin-project-internal" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pin-project-lite" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "pin-utils" +version = "0.1.0-alpha.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "pkg-config" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "ppv-lite86" version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "proc-macro-hack" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "proc-macro-nested" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "proc-macro2" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "publicsuffix" +version = "1.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "error-chain 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "quote" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand" version = "0.7.2" 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)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand_chacha" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_chacha" version = "0.2.1" @@ -304,6 +1366,14 @@ dependencies = [ "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand_hc" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_hc" version = "0.2.0" @@ -312,6 +1382,24 @@ dependencies = [ "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand_isaac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_jitter" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_os" version = "0.1.3" @@ -319,12 +1407,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand_pcg" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_xorshift" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rdrand" version = "0.4.0" @@ -333,6 +1438,210 @@ dependencies = [ "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "redox_syscall" +version = "0.1.56" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "redox_users" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex-syntax" +version = "0.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "remove_dir_all" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "reqwest" +version = "0.9.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "cookie 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cookie_store 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding_rs 0.8.20 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.12.35 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper-tls 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "mime 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "mime_guess 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "native-tls 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_urlencoded 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", + "winreg 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rust-argon2" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "blake2b_simd 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ryu" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "schannel" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "scopeguard" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "security-framework" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "security-framework-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "security-framework-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_derive" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_json" +version = "1.0.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_urlencoded" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "sfw-provider-requests" +version = "0.1.0" +dependencies = [ + "sphinx 0.1.0", +] + +[[package]] +name = "sha-1" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "sha2" version = "0.8.0" @@ -344,6 +1653,44 @@ dependencies = [ "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "signal-hook-registry" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arc-swap 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "slab" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "smallvec" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "smallvec" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "socket2" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "sphinx" version = "0.1.0" @@ -351,6 +1698,7 @@ dependencies = [ "aes-ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "blake2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "chacha 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "curve25519-dalek 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "hkdf 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -370,6 +1718,19 @@ dependencies = [ "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "string" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "strsim" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "subtle" version = "1.0.0" @@ -377,19 +1738,387 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "subtle" -version = "2.2.1" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "syn" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "synstructure" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tempfile" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "thread_local" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "time" +version = "0.1.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-current-thread 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", + "mio-named-pipes 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project-lite 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "signal-hook-registry 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-macros 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-buf" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-current-thread" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-executor" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-io" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-macros" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-reactor" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-sync 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-sync" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-tcp" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-threadpool" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-deque 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-timer" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.10.0" +source = "git+https://github.com/dbcfd/tokio-tungstenite?rev=6dc2018cbfe8fe7ddd75ff977343086503135b38#6dc2018cbfe8fe7ddd75ff977343086503135b38" +dependencies = [ + "futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "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" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "try_from" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tungstenite" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "input_buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "native-tls 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "utf-8 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "typenum" version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "unicase" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "unicode-normalization" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "smallvec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "unicode-width" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-xid" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "url" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "url" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "utf-8" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "uuid" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "vcpkg" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "vec_map" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "version_check" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "version_check" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "want" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "wasi" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "winapi" version = "0.3.8" @@ -399,6 +2128,11 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -409,54 +2143,261 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "winreg" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ws2_32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [metadata] +"checksum adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2" "checksum aes-ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d2e5b0458ea3beae0d1d8c0f3946564f8e10f90646cf78c06b4351052058d1ee" "checksum aes-soft 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cfd7e7ae3f9a1fb5c03b389fc6bb9a51400d0c13053f0dca698c832bfd893a0d" "checksum aesni 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2f70a6b5f971e473091ab7cfb5ffac6cde81666c4556751d8d5620ead8abf100" +"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" +"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +"checksum arc-swap 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d7b8a9123b8027467bce0099fe556c628a53c8d83df0507084c31e9ba2e39aff" "checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee" +"checksum arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" +"checksum assert-json-diff 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9881d306dee755eccf052d652b774a6b2861e86b4772f555262130e58e4f81d2" +"checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" +"checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" +"checksum backtrace 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)" = "924c76597f0d9ca25d762c25a4d369d51267536465dc5064bdf0eb073ed477ea" +"checksum backtrace-sys 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6575f128516de27e3ce99689419835fce9643a9b215a14d2b5b685be018491" +"checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" +"checksum base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" "checksum blake2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "94cb07b0da6a73955f8fb85d24c466778e70cda767a568229b104f0264089330" +"checksum blake2b_simd 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b83b7baab1e671718d78204225800d6b170e648188ac7dc992e9d6bddf87d0c0" "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" +"checksum bytes 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1c85319f157e4e26c703678e68e26ab71a46c0199286fa670b21cc9fec13d895" "checksum c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb" -"checksum cc 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)" = "aa87058dce70a3ff5621797f1506cb837edd02ac4c0ae642b4542dce802908b8" +"checksum cc 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)" = "f52a465a666ca3d838ebbf08b241383421412fe7ebb463527bba275526d89f76" "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" +"checksum colored 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "433e7ac7d511768127ed85b0c4947f47a254131e37864b2dc13f52aa32cd37e5" +"checksum constant_time_eq 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "995a44c877f9212528ccc74b21a232f66ad69001e40ede5bcee2ac9ef2657120" +"checksum cookie 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "888604f00b3db336d2af898ec3c1d5d0ddf5e6d462220f2ededc33a87ac4bbd5" +"checksum cookie_store 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46750b3f362965f197996c4448e4a0935e791bf7d6631bfce9ee0af3d24c919c" +"checksum core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d" +"checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" +"checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" +"checksum crossbeam-deque 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c3aa945d63861bfe624b55d153a39684da1e8c0bc8fba932f7ee3a3c16cea3ca" +"checksum crossbeam-epoch 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5064ebdbf05ce3cb95e45c8b086f72263f4166b29b97f6baff7ef7fe047b55ac" +"checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b" +"checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6" +"checksum crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ce446db02cdc3165b94ae73111e570793400d0794e46125cc4056c81cbb039f4" "checksum crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" "checksum ctr 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "022cd691704491df67d25d006fe8eca083098253c4d43516c2206479c58c6736" "checksum curve25519-dalek 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8b7dcd30ba50cdf88b55b033456138b7c0ac4afdc436d82e1b79f370f24cc66d" +"checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" "checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +"checksum dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3" +"checksum dirs-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "afa0b23de8fd801745c471deffa6e12d248f962c9fd4b4c33787b055599bde7b" +"checksum dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ea57b42383d091c85abcc2706240b94ab2a8fa1fc81c10ff23c4de06e2a90b5e" +"checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" +"checksum encoding_rs 0.8.20 (registry+https://github.com/rust-lang/crates.io-index)" = "87240518927716f79692c2ed85bfe6e98196d18c6401ec75355760233a7e12e9" +"checksum error-chain 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3ab49e9dcb602294bc42f9a7dfc9bc6e936fca4418ea300dbfb84fe16de0b7d9" +"checksum failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f8273f13c977665c5db7eb2b99ae520952fe5ac831ae4cd09d80c4c7042b5ed9" +"checksum failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0bc225b78e0391e4b8683440bf2e63c2deeeb2ce5189eab46e2b68c6d3725d08" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" +"checksum flate2 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6bd6d6f4752952feb71363cffc9ebac9411b75b87c6ab6058c40c8900cf43c0f" +"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" +"checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +"checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" +"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" +"checksum futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)" = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef" +"checksum futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b6f16056ecbb57525ff698bb955162d0cd03bee84e6241c27ff75c08d8ca5987" +"checksum futures-channel 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fcae98ca17d102fd8a3603727b9259fcf7fa4239b603d2142926189bc8999b86" +"checksum futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "79564c427afefab1dfb3298535b21eda083ef7935b4f0ecbfcb121f0aec10866" +"checksum futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4" +"checksum futures-executor 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e274736563f686a837a0568b478bdabfeaec2dca794b5649b04e2fe1627c231" +"checksum futures-io 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e676577d229e70952ab25f3945795ba5b16d63ca794ca9d2c860e5595d20b5ff" +"checksum futures-macro 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "52e7c56c15537adb4f76d0b7a76ad131cb4d2f4f32d3b0bcabcbe1c7c5e87764" +"checksum futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "171be33efae63c2d59e6dbba34186fe0d6394fb378069a76dfd80fdcffd43c16" +"checksum futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0bae52d6b29cf440e298856fec3965ee6fa71b06aa7495178615953fd669e5f9" +"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" "checksum hkdf 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3fa08a006102488bd9cd5b8013aabe84955cf5ae22e304c2caf655b633aefae3" "checksum hmac 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695" +"checksum http 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)" = "d6ccf5ede3a895d8856620237b2f02972c1bbc78d2965ad7fe8838d4a0ed41f0" +"checksum http-body 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6741c859c1b2463a423a1dbce98d418e6c3c3fc720fb0d45528657320920292d" +"checksum httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" +"checksum hyper 0.12.35 (registry+https://github.com/rust-lang/crates.io-index)" = "9dbe6ed1438e1f8ad955a4701e9a944938e9519f6888d12d8558b645e247d5f6" +"checksum hyper-tls 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3a800d6aa50af4b5850b2b0f659625ce9504df908e9733b635720483be26174f" +"checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" +"checksum idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" +"checksum indexmap 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712d7b3ea5827fcb9d4fda14bf4da5f136f0db2ae9c8f4bd4e2d1c6fde4e6db2" +"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 libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "1a31a0627fdf1f6a39ec0dd577e101440b7db22672c0901fe00a9a6fbb5c24e8" +"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +"checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558" +"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" +"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" +"checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" +"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" +"checksum memoffset 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "75189eb85871ea5c2e2c15abbdd541185f63b408415e5051f5cac122d8c774b9" +"checksum mime 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "dd1d63acd1b78403cc0c325605908475dd9b9a3acbf65ed8bcab97e27014afcf" +"checksum mime_guess 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1a0ed03949aef72dbdf3116a383d7b38b4768e6f960528cd6a6044aa9ed68599" +"checksum miniz_oxide 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6f3f74f726ae935c3f514300cc6773a0c9492abc5e972d42ba0c0ebb88757625" +"checksum mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)" = "302dec22bcf6bae6dfb69c647187f4b4d0fb6f535521f7bc022430ce8e12008f" +"checksum mio-named-pipes 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f5e374eff525ce1c5b7687c4cef63943e7686524a387933ad27ca7ec43779cb3" +"checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" +"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" +"checksum miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "396aa0f2003d7df8395cb93e09871561ccc3e785f0acb369170e8cc74ddf9226" +"checksum mockito 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4e524e85ea7c80559354217a6470c14abc2411802a9996aed1821559b9e28e3c" +"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" +"checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" +"checksum openssl-sys 0.9.53 (registry+https://github.com/rust-lang/crates.io-index)" = "465d16ae7fc0e313318f7de5cecf57b2fbe7511fd213978b457e1c96ff46736f" +"checksum parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" +"checksum parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" +"checksum pem 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a1581760c757a756a41f0ee3ff01256227bdf64cb752839779b95ffb01c59793" +"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" +"checksum percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" +"checksum pin-project 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "94b90146c7216e4cb534069fb91366de4ea0ea353105ee45ed297e2d1619e469" +"checksum pin-project-internal 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "44ca92f893f0656d3cba8158dd0f2b99b94de256a4a54e870bd6922fcc6c8355" +"checksum pin-project-lite 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f0af6cbca0e6e3ce8692ee19fb8d734b641899e07b68eb73e9bbbd32f1703991" +"checksum pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5894c618ce612a3fa23881b152b608bafb8c56cfc22f434a3ba3120b40f7b587" +"checksum pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" "checksum ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" +"checksum proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5" +"checksum proc-macro-nested 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "369a6ed065f249a159e06c45752c780bda2fb53c995718f9e484d08daa9eb42e" +"checksum proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27" +"checksum publicsuffix 1.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3bbaa49075179162b49acac1c6aa45fb4dafb5f13cf6794276d77bc7fd95757b" +"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" +"checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" "checksum rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3ae1b169243eaf61759b8475a998f0a385e42042370f3a7dbaf35246eacc8412" +"checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" "checksum rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853" "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" "checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" "checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" "checksum rand_distr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "96977acbdd3a6576fb1d27391900035bf3863d4a16422973a409b488cf29ffb2" +"checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" "checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +"checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" +"checksum rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" "checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" +"checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" +"checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" +"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" +"checksum redox_users 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ecedbca3bf205f8d8f5c2b44d83cd0690e39ee84b951ed649e9f1841132b66d" +"checksum regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dc220bd33bdce8f093101afe22a037b8eb0e5af33592e6a9caafff0d4cb81cbd" +"checksum regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "11a7e20d1cce64ef2fed88b66d347f88bd9babb82845b2b858f3edbf59a4f716" +"checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" +"checksum reqwest 0.9.22 (registry+https://github.com/rust-lang/crates.io-index)" = "2c2064233e442ce85c77231ebd67d9eca395207dec2127fe0bbedde4bd29a650" +"checksum rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ca4eaef519b494d1f2848fc602d18816fed808a981aedf4f1f00ceb7c9d32cf" +"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" +"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +"checksum ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8" +"checksum schannel 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "87f550b06b6cba9c8b8be3ee73f391990116bf527450d2556e9b9ce263b9a021" +"checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d" +"checksum security-framework 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8ef2429d7cefe5fd28bd1d2ed41c944547d4ff84776f5935b456da44593a16df" +"checksum security-framework-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e31493fc37615debb8c5090a7aeb4a9730bc61e77ab10b9af59f1a202284f895" +"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +"checksum serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449" +"checksum serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "128f9e303a5a29922045a830221b8f78ec74a5f544944f3d5984f8ec3895ef64" +"checksum serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)" = "48c575e0cc52bdd09b47f330f646cf59afc586e9c4e3ccd6fc1f625b8ea1dad7" +"checksum serde_urlencoded 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "642dd69105886af2efd227f75a520ec9b44a820d65bc133a9131f7d229fd165a" +"checksum sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "23962131a91661d643c98940b20fcaffe62d776a823247be80a48fcb8b6fce68" "checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d" +"checksum signal-hook-registry 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41" +"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" +"checksum smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6" +"checksum smallvec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ecf3b85f68e8abaa7555aa5abdb1153079387e60b718283d732f03897fcfc86" +"checksum socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "e8b74de517221a2cb01a53349cf54182acdc31a074727d3079068448c0676d85" "checksum stream-cipher 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8131256a5896cabcf5eb04f4d6dacbe1aefda854b0d9896e09cb58829ec5638c" +"checksum string 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d24114bfcceb867ca7f71a0d3fe45d45619ec47a6fbfa98cb14e14250bfa5d6d" +"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" -"checksum subtle 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab3af2eb31c42e8f0ccf43548232556c42737e01a96db6e1777b0be108e79799" +"checksum subtle 2.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c65d530b10ccaeac294f349038a597e435b18fb456aadd0840a623f83b9e941" +"checksum syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "dff0acdb207ae2fe6d5976617f887eb1e35a2ba52c13c7234c790960cdad9238" +"checksum synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545" +"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" +"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" +"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" +"checksum tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)" = "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6" +"checksum tokio 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bcced6bb623d4bff3739c176c415f13c418f426395c169c9c3cd9a492c715b16" +"checksum tokio-buf 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8fb220f46c53859a4b7ec083e41dec9778ff0b1851c0942b211edb89e0ccdc46" +"checksum tokio-current-thread 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "d16217cad7f1b840c5a97dfb3c43b0c871fef423a6e8d2118c604e843662a443" +"checksum tokio-executor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ca6df436c42b0c3330a82d855d2ef017cd793090ad550a6bc2184f4b933532ab" +"checksum tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "5090db468dad16e1a7a54c8c67280c5e4b544f3d3e018f0b913b400261f85926" +"checksum tokio-macros 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d5795a71419535c6dcecc9b6ca95bdd3c2d6142f7e8343d7beb9923f129aa87e" +"checksum tokio-reactor 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "6732fe6b53c8d11178dcb77ac6d9682af27fc6d4cb87789449152e5377377146" +"checksum tokio-sync 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "d06554cce1ae4a50f42fba8023918afa931413aded705b560e29600ccf7c6d76" +"checksum tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1d14b10654be682ac43efee27401d792507e30fd8d26389e1da3b185de2e4119" +"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" "checksum typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9" +"checksum unicase 2.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" +"checksum unicode-normalization 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b561e267b2326bb4cebfc0ef9e68355c7abe6c6f522aeac2f5bf95d56c59bdcf" +"checksum unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479" +"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" +"checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" +"checksum url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "75b414f6c464c879d7f9babf951f23bc3743fb7313c081b2e6ca719067ea9d61" +"checksum utf-8 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "05e42f7c18b8f902290b009cde6d651262f956c98bc51bca4cd1d511c9cd85c7" +"checksum uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "90dbc611eb48397705a6b0f6e917da23ae517e4d127123d2cf7674206627d32a" +"checksum vcpkg 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3fc439f2794e98976c88a2a2dafce96b930fe8010b0a256b3c2199a773933168" +"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" +"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" +"checksum version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce" +"checksum want 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b6395efa4784b027708f7451087e647ec73cc74f5d9bc2e418404248d679a230" "checksum wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b89c3ce4ce14bdc6fb6beaf9ec7928ca331de5df7e5ea278375642a2f478570d" +"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" +"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +"checksum winreg 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9" +"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" diff --git a/Cargo.toml b/Cargo.toml index fa5e930d61..3ee49b2004 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,10 +1,39 @@ [package] +build = "build.rs" name = "nym-client" -version = "0.1.0" -authors = ["Dave Hrycyszyn "] +version = "0.2.0" +authors = ["Dave Hrycyszyn ", "Jędrzej Stuczyński "] edition = "2018" +[lib] +name = "nym_client" +path = "src/lib.rs" + # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -sphinx = { path = "../sphinx" } \ No newline at end of file +base64 = "0.11.0" +clap = "2.33.0" +curve25519-dalek = "1.2.3" +dirs = "2.0.2" +futures = "0.3.1" +hex = "0.4.0" +pem = "0.7.0" +rand = "0.7.2" +rand_distr = "0.2.2" +reqwest = "0.9.22" +serde = { version = "1.0.104", features = ["derive"] } +serde_json = "1.0.44" +sphinx = { path = "../sphinx" } +sfw-provider-requests = { path = "../nym-sfw-provider/sfw-provider-requests" } +tokio = { version = "0.2", features = ["full"] } +tungstenite = "0.9.2" + +# putting this explicitly below everything and most likely, the next time we look into it, it will already have a proper release +tokio-tungstenite = { git = "https://github.com/dbcfd/tokio-tungstenite", rev="6dc2018cbfe8fe7ddd75ff977343086503135b38" } + +[build-dependencies] +built = "0.3.2" + +[dev-dependencies] +mockito = "0.22.0" 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/clients/directory/metrics.rs b/src/clients/directory/metrics.rs new file mode 100644 index 0000000000..94d7c909b6 --- /dev/null +++ b/src/clients/directory/metrics.rs @@ -0,0 +1,19 @@ +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +#[derive(Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct PersistedMixMetric { + pub pub_key: String, + pub received: u64, + pub sent: HashMap, + pub timestamp: u64, +} + +#[derive(Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct MixMetric { + pub pub_key: String, + pub received: u64, + pub sent: HashMap, +} diff --git a/src/clients/directory/mod.rs b/src/clients/directory/mod.rs new file mode 100644 index 0000000000..a9ff9e4df8 --- /dev/null +++ b/src/clients/directory/mod.rs @@ -0,0 +1,68 @@ +use crate::clients::directory::requests::health_check_get::{ + HealthCheckRequester, Request as HealthCheckRequest, +}; +use crate::clients::directory::requests::metrics_mixes_get::{ + MetricsMixRequester, Request as MetricsMixRequest, +}; +use crate::clients::directory::requests::metrics_mixes_post::{ + MetricsMixPoster, Request as MetricsMixPost, +}; +use crate::clients::directory::requests::presence_coconodes_post::{ + PresenceCocoNodesPoster, Request as PresenceCocoNodesPost, +}; +use crate::clients::directory::requests::presence_mixnodes_post::{ + PresenceMixNodesPoster, Request as PresenceMixNodesPost, +}; +use crate::clients::directory::requests::presence_providers_post::{ + PresenceMixProviderPoster, Request as PresenceProvidersPost, +}; +use crate::clients::directory::requests::presence_topology_get::{ + PresenceTopologyGetRequester, Request as PresenceTopologyRequest, +}; + +pub mod metrics; +pub mod presence; +pub mod requests; + +pub struct Config { + pub base_url: String, +} + +pub trait DirectoryClient { + fn new(config: Config) -> Self; +} + +pub struct Client { + pub health_check: HealthCheckRequest, + pub metrics_mixes: MetricsMixRequest, + pub metrics_post: MetricsMixPost, + pub presence_coconodes_post: PresenceCocoNodesPost, + pub presence_mix_nodes_post: PresenceMixNodesPost, + pub presence_providers_post: PresenceProvidersPost, + pub presence_topology: PresenceTopologyRequest, +} + +impl DirectoryClient for Client { + fn new(config: Config) -> Client { + let health_check: HealthCheckRequest = HealthCheckRequest::new(config.base_url.clone()); + let metrics_mixes: MetricsMixRequest = MetricsMixRequest::new(config.base_url.clone()); + let metrics_post: MetricsMixPost = MetricsMixPost::new(config.base_url.clone()); + let presence_topology: PresenceTopologyRequest = + PresenceTopologyRequest::new(config.base_url.clone()); + let presence_coconodes_post: PresenceCocoNodesPost = + PresenceCocoNodesPost::new(config.base_url.clone()); + let presence_mix_nodes_post: PresenceMixNodesPost = + PresenceMixNodesPost::new(config.base_url.clone()); + let presence_providers_post: PresenceProvidersPost = + PresenceProvidersPost::new(config.base_url.clone()); + Client { + health_check, + metrics_mixes, + metrics_post, + presence_coconodes_post, + presence_mix_nodes_post, + presence_providers_post, + presence_topology, + } + } +} diff --git a/src/clients/directory/presence.rs b/src/clients/directory/presence.rs new file mode 100644 index 0000000000..d693ff7d7e --- /dev/null +++ b/src/clients/directory/presence.rs @@ -0,0 +1,41 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct CocoPresence { + pub host: String, + pub pub_key: String, + pub last_seen: i64, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct MixNodePresence { + pub host: String, + pub pub_key: String, + pub layer: u64, + pub last_seen: u64, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct MixProviderPresence { + pub host: String, + pub pub_key: String, + pub registered_clients: Vec, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct MixProviderClient { + pub pub_key: String, +} + +// Topology shows us the current state of the overall Nym network +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct Topology { + pub coco_nodes: Vec, + pub mix_nodes: Vec, + pub mix_provider_nodes: Vec, +} diff --git a/src/clients/directory/requests/health_check_get.rs b/src/clients/directory/requests/health_check_get.rs new file mode 100644 index 0000000000..d5eb73644e --- /dev/null +++ b/src/clients/directory/requests/health_check_get.rs @@ -0,0 +1,60 @@ +use reqwest::Response; + +pub struct Request { + base_url: String, + path: String, +} + +pub trait HealthCheckRequester { + fn new(base_url: String) -> Self; + fn get(&self) -> Result; +} + +impl HealthCheckRequester for Request { + fn new(base_url: String) -> Self { + Request { + base_url, + path: "/api/healthcheck".to_string(), + } + } + + fn get(&self) -> Result { + let url = format!("{}{}", self.base_url, self.path); + reqwest::get(&url) + } +} + +#[cfg(test)] +mod healthcheck_requests { + use super::*; + + #[cfg(test)] + use mockito::mock; + + #[cfg(test)] + mod on_a_400_status { + use super::*; + + #[test] + #[should_panic] + fn it_returns_an_error() { + let _m = mock("GET", "/api/healthcheck").with_status(400).create(); + let req = Request::new(mockito::server_url()); + assert!(req.get().is_err()); + _m.assert(); + } + } + + #[cfg(test)] + mod on_a_200 { + use super::*; + + #[test] + fn it_returns_a_response_with_200_status() { + let _m = mock("GET", "/api/healthcheck").with_status(200).create(); + let req = Request::new(mockito::server_url()); + assert!(req.get().is_ok()); + _m.assert(); + } + } +} diff --git a/src/clients/directory/requests/metrics_mixes_get.rs b/src/clients/directory/requests/metrics_mixes_get.rs new file mode 100644 index 0000000000..c43541cdce --- /dev/null +++ b/src/clients/directory/requests/metrics_mixes_get.rs @@ -0,0 +1,239 @@ +use crate::clients::directory::metrics::PersistedMixMetric; + +pub struct Request { + base_url: String, + path: String, +} + +pub trait MetricsMixRequester { + fn new(base_url: String) -> Self; + fn get(&self) -> Result, reqwest::Error>; +} + +impl MetricsMixRequester for Request { + fn new(base_url: String) -> Self { + Request { + base_url, + path: "/api/metrics/mixes".to_string(), + } + } + + fn get(&self) -> Result, reqwest::Error> { + let url = format!("{}{}", self.base_url, self.path); + let mix_metric_vec = reqwest::get(&url)?.json()?; + Ok(mix_metric_vec) + } +} + +#[cfg(test)] +mod metrics_get_request { + use super::*; + + #[cfg(test)] + use mockito::mock; + + #[cfg(test)] + mod on_a_400_status { + use super::*; + + #[test] + #[should_panic] + fn it_returns_an_error() { + let _m = mock("GET", "/api/metrics/mixes").with_status(400).create(); + let req = Request::new(mockito::server_url()); + req.get().unwrap(); + _m.assert(); + } + } + + #[cfg(test)] + mod on_a_200 { + use super::*; + #[test] + fn it_returns_a_response_with_200_status_and_a_correct_topology() { + let json = fixtures::mix_metrics_response_json(); + let _m = mock("GET", "/api/metrics/mixes") + .with_status(200) + .with_body(json) + .create(); + let req = Request::new(mockito::server_url()); + let result = req.get(); + assert_eq!(true, result.is_ok()); + assert_eq!( + 1576061080635800000, + result.unwrap().first().unwrap().timestamp + ); + _m.assert(); + } + } + + #[cfg(test)] + mod fixtures { + #[cfg(test)] + pub fn mix_metrics_response_json() -> String { + r#"[ + { + "pubKey": "OwOqwWjh_IlnaWS2PxO6odnhNahOYpRCkju50beQCTA=", + "sent": { + "35.178.213.77:1789": 1, + "52.56.99.196:1789": 2 + }, + "received": 10, + "timestamp": 1576061080635800000 + }, + { + "pubKey": "zSob16499jT7C3S3ky4GihNOjlU6aLfSRkf1xAxOwV0=", + "sent": { + "3.8.176.11:1789": 2, + "35.178.212.193:1789": 2 + }, + "received": 4, + "timestamp": 1576061080806225700 + }, + { + "pubKey": "nkkrUjgL8UJk05QydvWvFSvtRB6nmeV8RMvH5540J3s=", + "sent": { + "3.9.12.238:1789": 3 + }, + "received": 3, + "timestamp": 1576061080894667300 + }, + { + "pubKey": "whHuBuEc6zyOZOquKbuATaH4Crml61V_3Y-MztpWhF4=", + "sent": { + "3.9.12.238:1789": 5, + "35.176.155.107:1789": 3 + }, + "received": 8, + "timestamp": 1576061081254846500 + }, + { + "pubKey": "vCdpFc0NvW0NSqsuTxtjFtiSY35aXesgT3JNA8sSIXk=", + "sent": { + "35.178.213.77:1789": 4, + "52.56.99.196:1789": 6 + }, + "received": 19, + "timestamp": 1576061081371549000 + }, + { + "pubKey": "vk5Sr-Xyi0cTbugACv8U42ZJ6hs6cGDox0rpmXY94Fc=", + "sent": { + "3.8.176.11:1789": 4, + "35.178.212.193:1789": 2 + }, + "received": 6, + "timestamp": 1576061081498404900 + }, + { + "pubKey": "OwOqwWjh_IlnaWS2PxO6odnhNahOYpRCkju50beQCTA=", + "sent": { + "35.178.213.77:1789": 2, + "52.56.99.196:1789": 3 + }, + "received": 6, + "timestamp": 1576061081637625000 + }, + { + "pubKey": "zSob16499jT7C3S3ky4GihNOjlU6aLfSRkf1xAxOwV0=", + "sent": { + "3.8.176.11:1789": 5, + "35.178.212.193:1789": 4 + }, + "received": 9, + "timestamp": 1576061081805484800 + }, + { + "pubKey": "nkkrUjgL8UJk05QydvWvFSvtRB6nmeV8RMvH5540J3s=", + "sent": { + "3.9.12.238:1789": 4, + "35.176.155.107:1789": 4 + }, + "received": 8, + "timestamp": 1576061081896562400 + }, + { + "pubKey": "whHuBuEc6zyOZOquKbuATaH4Crml61V_3Y-MztpWhF4=", + "sent": { + "3.9.12.238:1789": 2, + "35.176.155.107:1789": 4 + }, + "received": 6, + "timestamp": 1576061079255938600 + }, + { + "pubKey": "vCdpFc0NvW0NSqsuTxtjFtiSY35aXesgT3JNA8sSIXk=", + "sent": { + "35.178.213.77:1789": 6 + }, + "received": 10, + "timestamp": 1576061079370829300 + }, + { + "pubKey": "vk5Sr-Xyi0cTbugACv8U42ZJ6hs6cGDox0rpmXY94Fc=", + "sent": { + "3.8.176.11:1789": 2, + "35.178.212.193:1789": 5 + }, + "received": 7, + "timestamp": 1576061079497993200 + }, + { + "pubKey": "OwOqwWjh_IlnaWS2PxO6odnhNahOYpRCkju50beQCTA=", + "sent": { + "35.178.213.77:1789": 5, + "52.56.99.196:1789": 2 + }, + "received": 13, + "timestamp": 1576061079637208600 + }, + { + "pubKey": "zSob16499jT7C3S3ky4GihNOjlU6aLfSRkf1xAxOwV0=", + "sent": { + "3.8.176.11:1789": 5, + "35.178.212.193:1789": 4 + }, + "received": 9, + "timestamp": 1576061079806557200 + }, + { + "pubKey": "nkkrUjgL8UJk05QydvWvFSvtRB6nmeV8RMvH5540J3s=", + "sent": { + "3.9.12.238:1789": 2, + "35.176.155.107:1789": 7 + }, + "received": 9, + "timestamp": 1576061079895988000 + }, + { + "pubKey": "whHuBuEc6zyOZOquKbuATaH4Crml61V_3Y-MztpWhF4=", + "sent": { + "3.9.12.238:1789": 3, + "35.176.155.107:1789": 2 + }, + "received": 5, + "timestamp": 1576061080255701500 + }, + { + "pubKey": "vCdpFc0NvW0NSqsuTxtjFtiSY35aXesgT3JNA8sSIXk=", + "sent": { + "35.178.213.77:1789": 3, + "52.56.99.196:1789": 3 + }, + "received": 7, + "timestamp": 1576061080370956300 + }, + { + "pubKey": "vk5Sr-Xyi0cTbugACv8U42ZJ6hs6cGDox0rpmXY94Fc=", + "sent": { + "3.8.176.11:1789": 5, + "35.178.212.193:1789": 1 + }, + "received": 6, + "timestamp": 1576061080501732900 + } + ]"# + .to_string() + } + } +} diff --git a/src/clients/directory/requests/metrics_mixes_post.rs b/src/clients/directory/requests/metrics_mixes_post.rs new file mode 100644 index 0000000000..b7d412af81 --- /dev/null +++ b/src/clients/directory/requests/metrics_mixes_post.rs @@ -0,0 +1,98 @@ +use crate::clients::directory::metrics::MixMetric; +use reqwest::Response; + +pub struct Request { + base_url: String, + path: String, +} + +pub trait MetricsMixPoster { + fn new(base_url: String) -> Self; + fn post(&self, metric: &MixMetric) -> Result; +} + +impl MetricsMixPoster for Request { + fn new(base_url: String) -> Self { + Request { + base_url, + path: "/api/metrics/mixes".to_string(), + } + } + + fn post(&self, metric: &MixMetric) -> Result { + let url = format!("{}{}", self.base_url, self.path); + let client = reqwest::Client::new(); + let mix_metric_vec = client.post(&url).json(&metric).send()?; + Ok(mix_metric_vec) + } +} + +#[cfg(test)] +mod metrics_get_request { + use super::*; + + #[cfg(test)] + use mockito::mock; + + #[cfg(test)] + mod on_a_400_status { + use super::*; + + #[test] + fn it_returns_an_error() { + let _m = mock("POST", "/api/metrics/mixes").with_status(400).create(); + let req = Request::new(mockito::server_url()); + let metric = fixtures::new_metric(); + let result = req.post(&metric); + assert_eq!(400, result.unwrap().status()); + _m.assert(); + } + } + + #[cfg(test)] + mod on_a_200 { + use super::*; + #[test] + fn it_returns_a_response_with_200() { + let json = fixtures::mix_metrics_response_json(); + let _m = mock("POST", "/api/metrics/mixes") + .with_status(201) + .with_body(json) + .create(); + let req = Request::new(mockito::server_url()); + let metric = fixtures::new_metric(); + let result = req.post(&metric); + assert_eq!(true, result.is_ok()); + _m.assert(); + } + } + + #[cfg(test)] + mod fixtures { + use crate::clients::directory::metrics::MixMetric; + + pub fn new_metric() -> MixMetric { + MixMetric { + pub_key: "abc".to_string(), + received: 666, + sent: Default::default(), + } + } + + #[cfg(test)] + pub fn mix_metrics_response_json() -> String { + r#" + { + "pubKey": "OwOqwWjh_IlnaWS2PxO6odnhNahOYpRCkju50beQCTA=", + "sent": { + "35.178.213.77:1789": 1, + "52.56.99.196:1789": 2 + }, + "received": 10, + "timestamp": 1576061080635800000 + } + "# + .to_string() + } + } +} diff --git a/src/clients/directory/requests/mod.rs b/src/clients/directory/requests/mod.rs new file mode 100644 index 0000000000..f10a4a415f --- /dev/null +++ b/src/clients/directory/requests/mod.rs @@ -0,0 +1,7 @@ +pub mod health_check_get; +pub mod metrics_mixes_get; +pub mod metrics_mixes_post; +pub mod presence_coconodes_post; +pub mod presence_mixnodes_post; +pub mod presence_providers_post; +pub mod presence_topology_get; diff --git a/src/clients/directory/requests/presence_coconodes_post.rs b/src/clients/directory/requests/presence_coconodes_post.rs new file mode 100644 index 0000000000..bc5f3aaf42 --- /dev/null +++ b/src/clients/directory/requests/presence_coconodes_post.rs @@ -0,0 +1,86 @@ +use crate::clients::directory::presence::CocoPresence; +use reqwest::Response; + +pub struct Request { + base_url: String, + path: String, +} + +pub trait PresenceCocoNodesPoster { + fn new(base_url: String) -> Self; + fn post(&self, presence: &CocoPresence) -> Result; +} + +impl PresenceCocoNodesPoster for Request { + fn new(base_url: String) -> Self { + Request { + base_url, + path: "/api/presence/coconodes".to_string(), + } + } + + fn post(&self, presence: &CocoPresence) -> Result { + let url = format!("{}{}", self.base_url, self.path); + let client = reqwest::Client::new(); + let p = client.post(&url).json(&presence).send()?; + Ok(p) + } +} + +#[cfg(test)] +mod metrics_get_request { + use super::*; + + #[cfg(test)] + use mockito::mock; + + #[cfg(test)] + mod on_a_400_status { + use super::*; + + #[test] + fn it_returns_an_error() { + let _m = mock("POST", "/api/presence/coconodes") + .with_status(400) + .create(); + let req = Request::new(mockito::server_url()); + let presence = fixtures::new_presence(); + let result = req.post(&presence); + assert_eq!(400, result.unwrap().status()); + _m.assert(); + } + } + + #[cfg(test)] + mod on_a_200 { + use super::*; + #[test] + fn it_returns_a_response_with_201() { + let json = r#"{ + "ok": true + }"#; + let _m = mock("POST", "/api/presence/coconodes") + .with_status(201) + .with_body(json) + .create(); + let req = Request::new(mockito::server_url()); + let presence = fixtures::new_presence(); + let result = req.post(&presence); + assert_eq!(true, result.is_ok()); + _m.assert(); + } + } + + #[cfg(test)] + mod fixtures { + use crate::clients::directory::presence::CocoPresence; + + pub fn new_presence() -> CocoPresence { + CocoPresence { + host: "foo.com".to_string(), + pub_key: "abc".to_string(), + last_seen: 666, + } + } + } +} diff --git a/src/clients/directory/requests/presence_mixnodes_post.rs b/src/clients/directory/requests/presence_mixnodes_post.rs new file mode 100644 index 0000000000..c0250f959e --- /dev/null +++ b/src/clients/directory/requests/presence_mixnodes_post.rs @@ -0,0 +1,87 @@ +use crate::clients::directory::presence::MixNodePresence; +use reqwest::Response; + +pub struct Request { + base_url: String, + path: String, +} + +pub trait PresenceMixNodesPoster { + fn new(base_url: String) -> Self; + fn post(&self, presence: &MixNodePresence) -> Result; +} + +impl PresenceMixNodesPoster for Request { + fn new(base_url: String) -> Self { + Request { + base_url, + path: "/api/presence/mixnodes".to_string(), + } + } + + fn post(&self, presence: &MixNodePresence) -> Result { + let url = format!("{}{}", self.base_url, self.path); + let client = reqwest::Client::new(); + let p = client.post(&url).json(&presence).send()?; + Ok(p) + } +} + +#[cfg(test)] +mod metrics_get_request { + use super::*; + + #[cfg(test)] + use mockito::mock; + + #[cfg(test)] + mod on_a_400_status { + use super::*; + + #[test] + fn it_returns_an_error() { + let _m = mock("POST", "/api/presence/mixnodes") + .with_status(400) + .create(); + let req = Request::new(mockito::server_url()); + let presence = fixtures::new_presence(); + let result = req.post(&presence); + assert_eq!(400, result.unwrap().status()); + _m.assert(); + } + } + + #[cfg(test)] + mod on_a_200 { + use super::*; + #[test] + fn it_returns_a_response_with_201() { + let json = r#"{ + "ok": true + }"#; + let _m = mock("POST", "/api/presence/mixnodes") + .with_status(201) + .with_body(json) + .create(); + let req = Request::new(mockito::server_url()); + let presence = fixtures::new_presence(); + let result = req.post(&presence); + assert_eq!(true, result.is_ok()); + _m.assert(); + } + } + + #[cfg(test)] + mod fixtures { + use crate::clients::directory::presence::MixNodePresence; + + pub fn new_presence() -> MixNodePresence { + MixNodePresence { + host: "foo.com".to_string(), + pub_key: "abc".to_string(), + layer: 1, + last_seen: 0, + } + } + } +} diff --git a/src/clients/directory/requests/presence_providers_post.rs b/src/clients/directory/requests/presence_providers_post.rs new file mode 100644 index 0000000000..26cbf7576e --- /dev/null +++ b/src/clients/directory/requests/presence_providers_post.rs @@ -0,0 +1,85 @@ +use crate::clients::directory::presence::MixProviderPresence; +use reqwest::Response; + +pub struct Request { + base_url: String, + path: String, +} + +pub trait PresenceMixProviderPoster { + fn new(base_url: String) -> Self; + fn post(&self, presence: &MixProviderPresence) -> Result; +} + +impl PresenceMixProviderPoster for Request { + fn new(base_url: String) -> Self { + Request { + base_url, + path: "/api/presence/mixproviders".to_string(), + } + } + + fn post(&self, presence: &MixProviderPresence) -> Result { + let url = format!("{}{}", self.base_url, self.path); + let client = reqwest::Client::new(); + let p = client.post(&url).json(&presence).send()?; + Ok(p) + } +} + +#[cfg(test)] +mod metrics_get_request { + use super::*; + + #[cfg(test)] + use mockito::mock; + + #[cfg(test)] + mod on_a_400_status { + use super::*; + + #[test] + fn it_returns_an_error() { + let _m = mock("POST", "/api/presence/mixproviders") + .with_status(400) + .create(); + let req = Request::new(mockito::server_url()); + let presence = fixtures::new_presence(); + let result = req.post(&presence); + assert_eq!(400, result.unwrap().status()); + _m.assert(); + } + } + + #[cfg(test)] + mod on_a_200 { + use super::*; + #[test] + fn it_returns_a_response_with_201() { + let json = r#"{ + "ok": true + }"#; + let _m = mock("POST", "/api/presence/mixproviders") + .with_status(201) + .with_body(json) + .create(); + let req = Request::new(mockito::server_url()); + let presence = fixtures::new_presence(); + let result = req.post(&presence); + assert_eq!(true, result.is_ok()); + _m.assert(); + } + } + #[cfg(test)] + mod fixtures { + use crate::clients::directory::presence::MixProviderPresence; + + pub fn new_presence() -> MixProviderPresence { + MixProviderPresence { + host: "foo.com".to_string(), + pub_key: "abc".to_string(), + registered_clients: vec![], + } + } + } +} diff --git a/src/clients/directory/requests/presence_topology_get.rs b/src/clients/directory/requests/presence_topology_get.rs new file mode 100644 index 0000000000..fb99fdce6f --- /dev/null +++ b/src/clients/directory/requests/presence_topology_get.rs @@ -0,0 +1,306 @@ +use crate::clients::directory::presence::Topology; + +pub struct Request { + base_url: String, + path: String, +} + +pub trait PresenceTopologyGetRequester { + fn new(base_url: String) -> Self; + fn get(&self) -> Result; +} + +impl PresenceTopologyGetRequester for Request { + fn new(base_url: String) -> Self { + Request { + base_url, + path: "/api/presence/topology".to_string(), + } + } + + fn get(&self) -> Result { + let url = format!("{}{}", self.base_url, self.path); + let topology: Topology = reqwest::get(&url)?.json()?; + Ok(topology) + } +} + +#[cfg(test)] +mod topology_requests { + use super::*; + #[cfg(test)] + use mockito::mock; + #[cfg(test)] + mod on_a_400_status { + use super::*; + #[test] + #[should_panic] + fn it_panics() { + let _m = mock("GET", "/api/presence/topology") + .with_status(400) + .with_body("bad body") + .create(); + let req = Request::new(mockito::server_url()); + req.get().unwrap(); + _m.assert(); + } + } + #[cfg(test)] + mod on_a_200 { + use super::*; + #[test] + fn it_returns_a_response_with_200_status_and_a_correct_topology() { + let json = fixtures::topology_response_json(); + let _m = mock("GET", "/api/presence/topology") + .with_status(200) + .with_body(json) + .create(); + let req = Request::new(mockito::server_url()); + let result = req.get(); + assert_eq!(true, result.is_ok()); + assert_eq!( + 1575915097085539300, + result.unwrap().coco_nodes.first().unwrap().last_seen + ); + _m.assert(); + } + } + #[cfg(test)] + pub mod fixtures { + #[cfg(test)] + pub fn topology_response_json() -> String { + r#"{ + "cocoNodes": [ + { + "host": "3.8.244.109:4000", + "pubKey": "AAAAAAAAAAEKwAECSqKy8I8KkSYIBSctxRBRxuR61PpAOwK0UQtkeuPRdwusAyaoBbvv1IBWyMEhvbgT4CtgUnGfYH2s06CIJ09lWWvQ0Jkgthq12mG73H9QSTNM8RITlF1X5ax9BV0EK34M5dUncn1uEYzJzcbaLjUarf2bqoy906dtQpppUWDRLJI6ycw7rKKJ4ZNUhgi4KAEGBsSgLqc0zDKs0rArwouZyz4ofoWnY68mdJKrVy6Zqz83DSdc7B2hqqkHX_Bfeb4SwAEFuhRpy4HfcuxwcRI9sIWMo_LVmbk19g1gfMRlBrmZqoEQL6rDApVLZ9eMp-5IQK8WLlZpWf4Zjy7kZolARAyp_rHUQkH4PrDjgoPrKbm6qK_iejYpL7qx28Q3VeInMpwMIMaSbbW9y36sEVtGc2I0Iu5vS0sp8ESiVlQ5NaBz72deZ8oKJJ4IEPPHP99-b0UQX80fVIrNM88mMzKy0bHri9NFlmIG-e0G1cqmw_ry3XWGQkcr1M5RuNa6oX50w5QawAEVxd5FP5bE8bS4x54Csof11sQWUTwMp6Q7_3H7ZCTSlKSqujlOhmfqSHfGPO2sDIYPHDhDzjakZpKAZWWhn_hiR6DfPpomQ01ZYUhVKKSMxz7_VPjsQplP0bZXA2gfnkADUN8UQ0N9g_usIw73r4aZsOviMsRM8oByvsjVfUWc4_HTLSdnQyImFkHz9CiCmrIYL2dYQRePRatWggvBAyeRzntxI4jDqLKiBdi54ZlAKgV6MCRaJ7Bu7BtmLXrtK4sawAED3QYxuvOSZrbZdUr4yG-U9yVvJ9Klkf-5Mo4EYp3qTL2KBB6_LrZepjAQqp486YkZ03mTIezcsZ48EboXVTWKBZ3QnTI5tX-j4gGxQb7klOJc97qJkDxsvpz4F0ChgCUIZhpIItWHia7_R3Gi-b5siLIdQdUho9isn3kiDGm6t0NED2Bgy3ZxxQwzqsBZm4kPr2_fPX4YyvIoP9895YcGjZyE5iiRC_TE41RJmB1GZYdxegTMq3lNDllKgiqaiPgawAEJASDkmZHTwlg9YOev5OWpQD-FnhPkqVNo_QcDyRu9eoGcWSGFp2sYqjG2SpmiXq0VNnAO7AcKxRzDFu7TjfhlU3Kt0uTKIcrWVU1zFNbJNMjYEq90pp50nowwx8INz20IXET2ZNX6kIXYFCsEvPLZFlG2OoL6xg3uQS1qMl3lIS_VxdO_JfVe0rT65WsJ_P4Nkc1jYiuNPHY6d_iFO0BVYqX0sOCX73GC_TT13BR0jnPwDAVw0rGtYHsXBb8TKOsawAEZIClauuT1V3qOZnb7uRZhFXO-PKTxgc1LCzJt2ChOrMZaBpjlkf3IPpJ2UF4JH4kGaDeBf2k_S-FLAs3drK21efbi5P6_a4QTxAiiRimXGoQIyvOg462s6kP_ZRFufo8YYQHS4olaOeqU4564dNskg_uBPsFMz_2GNOhmn_15cJqP1jfkyD49Z16GTS5YLHgVl9bJKqyvLuypsToLbt1BJzipEP0L2OohuRm-_MvqvwwWKyjNQsubgee1K728d9AawAEBkGggcNVCtXyhoSqi3_w0tVxtkAYeud8sBeAtZHGs06me_QL8co0MFLlO-zdkUb4ZBq08rFEbgLOma8_3whleM8NIPaHNISp1q3IsIhB5zdXcZoGsqLixODBFHtID3YEHAlr4f9T_yh11yJ95xGCl_6Y37hpwLQVGyrfSfccM24mVFqnV3TT5Wdq3ile-jesUx1Q2G1yK_xVqc6itmk-kDuBjyZgzYi1-jsIXAjnhM9G7t8J_Bv5yGGZhLK2dCzM=", + "type": "validator", + "lastSeen": 1575915097085539300 + }, + { + "host": "3.9.129.61:4000", + "pubKey": "AAAAAAAAAAMKwAECSqKy8I8KkSYIBSctxRBRxuR61PpAOwK0UQtkeuPRdwusAyaoBbvv1IBWyMEhvbgT4CtgUnGfYH2s06CIJ09lWWvQ0Jkgthq12mG73H9QSTNM8RITlF1X5ax9BV0EK34M5dUncn1uEYzJzcbaLjUarf2bqoy906dtQpppUWDRLJI6ycw7rKKJ4ZNUhgi4KAEGBsSgLqc0zDKs0rArwouZyz4ofoWnY68mdJKrVy6Zqz83DSdc7B2hqqkHX_Bfeb4SwAEEv6RMevAQmLGkeK0uJKnMPPAtm8GgXjWSQijYdnxlPh5SJSNeJUbPZKWFFWdk8yIFXKa8jnzETtdGFKgUUt5AVUDpTBmEdwaHCzlFhXrttshy0V5OhPUlV8cGABmxbagMYm0bFPg0r-snSkrB9YG6wqJYQVeIMOCGYCPbHmDA8R_0-h8VkRKWs1d9KvQOK4kShqgZtYN71KJW8uDE4q2jsGDVvxFt1AgmU9b93xsXF17KrpZy5WxlLZ73HtnTD_oawAED4vd_rK-Kx_n8x_OdDiiEOPUlYDlDCQUqenU9XHKH3B6ijfkJ368wd3LDDVStjDwNORrAyUSw_VlSNUpd1XLC8d17gTaIq5ZI2fWuwwZaoN1JCsYU8fQ6USgtIehQX7IPP8EkFuNmuCBCmpr4schtYniGe9J8Q4dsV-TYPr2uLJkdx1r7luzF--I22k7NfQQM14QDci_0kgrgmZ54CJGkjXyOhCppBXg3fqLC6aFvT3ZocfiiXBJt0huGgPMDtYsawAECLh8KUdNsDolERwJ8v04bS5jI_KKf7uUnCHWuCELwbJSUI3OK1ufS1qSpauvSzVQSbrhEzrEfwQn4VtxQxJlX4UdDU-R-hafiZvVC6DLLAbuORBAC3FScn9W58CnezH4DvCp_w7nftDfdxeuungbZT9XaxS3iNC6PnFsWF6WM3DxMwrzOrFe6wEEoTSPe1mcUDrtwM5UksIvJr6MBRAXrdl0IdBTQr7cLwKe_KYi4siwdjfJEJtOh7oxQBxBg2UkawAEJAPZK2Gg2MQwpxdDT24lNQHF7FVfkO_LuhJwn0RbwNDSVeA4P6-tWL5TkCpqr8xYHfwQ6Z3ILfpGCZr8PspwIoRzqZHQ16f8Pq9xnr0hLEI9BOQU0FS2EtuyPgju5iwsAJAfehUzu6kNLphuLGsXoIZdXDG5mbylwh9JzAVXTwgaR0hNqyXVJxgbt7jcYaSEBFcMGV-hjXyVVNzBleE-G9o_noI_KWU4Ce7K-qOMcewMKfy_VEw-gVaD6dHz6AMoawAEE9XuOLwRttvKybAssZ9gsK-_YRUwuFOeRDIr3NX___9bx6pCc18adCIlH_8EJWFwXZ05ZpNNE88mYx7ZQ3aqaArZJRoWeZeKhqH_s05V10xbzkYX71G5cqz--8vr9ZlQRb2BeETF_Tdq_PLk7qbT8WTGIoq7ZwyDRQTgzvkCgyzj_hBLh2o7sSVNgUo38SFUTMn7YtvVFYlSrTDE3WKE-T-nh5SWdDBxgDTc3Bw8JpzNH-WkoJ4Lim7sB4Op1gEUawAEW4-kenlffwsNr_3b3aV0YuusLpxB03sxPzQ5B0CWNiVtbja1Z4tWhKGUUrdq_eUgMV0y5Of-BqNi5FspAQnhJBFSSxtOzRGV1h3qyUTksfZyed9z8zPI-ZPP9XXm7hYgJgDz_kxte-NfS9UG9q5AZetHUN4kGxXutjjzfUQZ9yTvhBKgKgTI2Dp_R_jZrWQ8F1BoWzIJzjddT1K2MvCQEkARYw08isbOeFmCwgVUcjxYZO45WyOmLQA7QJRL9WvA=", + "type": "validator", + "lastSeen": 1575915097388409000 + }, + { + "host": "3.9.222.1:4000", + "pubKey": "AAAAAAAAAAQKwAECSqKy8I8KkSYIBSctxRBRxuR61PpAOwK0UQtkeuPRdwusAyaoBbvv1IBWyMEhvbgT4CtgUnGfYH2s06CIJ09lWWvQ0Jkgthq12mG73H9QSTNM8RITlF1X5ax9BV0EK34M5dUncn1uEYzJzcbaLjUarf2bqoy906dtQpppUWDRLJI6ycw7rKKJ4ZNUhgi4KAEGBsSgLqc0zDKs0rArwouZyz4ofoWnY68mdJKrVy6Zqz83DSdc7B2hqqkHX_Bfeb4SwAECh9xcxpjOp1r7kiNIgrI9GgAlvXwgHkTchOxUiyOzTq6FDWdGN64KiC3NDeyGTg8FmzvGzS3jREeJqOdr4G9ZGtWkauAITgLFiH62t-YntRslhr8_1shxlmzKiNKJN_QFflEq79pZIlWtp3N8LIHMvXRtl-zt2DMze4s02XDmEkviyVE4CkQUDtCc-2MfPT4JcmEFqtFIxjrXn18SbYg3c6XUQHsGIkuDrKuCTRlpC8kvmM0uVoIeWdmwDlZk4jUawAEJhRwK5ozjqIWRP1bFzBPS9VhaJnfKU9PeFYtN5beiAHrYr2ylIB3yDfmAQUdKDowDUm5nfJATejEjEnrTGxh70QtfoNV391rSns3F71tBwY62KLaNr8qnVfeSFHV3FcQTMHHF_8mDb5_11Rj6aiMvW0y6eetHo7CDPMdEyDPmok_U2ZM5BzOUnwjT21HtnvcKxKKwHJ_QGfnAHPyDIhNOMgxJCrVazOidLCHeYGpyCLw1ipeTyKOQX0_ByB8dH6AawAEGV1GuF5SSlT67B1ityPJK2ZwXjeeKB4gGdCG3qRtWxLTZfGhVm7YAYm2f5tw_wrsJAZ9FubVhateGg0ZN67NxZtsvOOejXz6743f7ijnQopPgd_8pH-iVf6BEcSO8ZdcHxNRUTayzjVLs99bwMo2zaPevW4X4G_bN4mh---aPkdGYHwaiklzUhqJ-eqycrYAFyjyEXaPBXLQm1rpczqluNvnKbd8Q9LZWukgm7_uWv_HxufIvdWgoq8bAt78UU3oawAEP9VDehhqrQG5-WHMB66XVxo1TgMM8aVV0SwAq3lCRkpiFBz_9kw8T1F9Hx2AiNrEGT1QLbdMkpms1cG_5gBBahQofdt_NmUs1jfTFXY9iyMy1Q7A6ZYaLP8Z6q-orc1cKqySY-BJZQ_CpGFfXS0OVniFDQ6v78ytPK7K-yRgT1PxFgm3rZqrG0Tjbrpsg2PUL5S5fuXfMhUosP0uoLj0D1guWAR9Y7kfFBIXaTSFMoa8fghVBUTRNhK9f72a8SxQawAEOiv71taLjKqaaWQ_QjcDhWbvjG1EnsCyI0toNjGkcF19x4Vk-5NC96_4ioUGz404IC0XN03roRnibRT_78D9vZFVCWCqve9EjdF5TcApx03zIP4JT2g2q0MKIGgGrwt4Pz6LO6yOfMm7B8Yraps8IV-nP1w7K1m9XKP_FvH8egl5GHJe-_omlC2YyL_b28jMLENbxDFD-3KPjZFBhSLrRukX2PlayYTwEiTtokA2R9_11vQvJgP8KFEjGHg6zsAMawAEBn2H_hz2knb8ltnpEA5YSKVcV3nUtojkCNi_WUz7xUKd7efw1oI_lbnKrS7HkyC0JkQUZ1pCWUlSXNmgjMEhsn823a1LFzpV7rOv4vayYvvFX61hB9R78VjpyxJiYpDwRZLiUY3AK4WY8NqFDbjXR7rT4CkFHEf-VhSQQ8ZNvlpod1nmeVQVizHH9e7Tq7wsWz-LWEk3Hx6LmcrgDsL79LZYG9JXU5IdvG8RvLNx9cSwEI8yxcchpISAaot7UoYQ=", + "type": "validator", + "lastSeen": 1575915094734973000 + }, + { + "host": "3.9.102.214:4000", + "pubKey": "AAAAAAAAAAIKwAECSqKy8I8KkSYIBSctxRBRxuR61PpAOwK0UQtkeuPRdwusAyaoBbvv1IBWyMEhvbgT4CtgUnGfYH2s06CIJ09lWWvQ0Jkgthq12mG73H9QSTNM8RITlF1X5ax9BV0EK34M5dUncn1uEYzJzcbaLjUarf2bqoy906dtQpppUWDRLJI6ycw7rKKJ4ZNUhgi4KAEGBsSgLqc0zDKs0rArwouZyz4ofoWnY68mdJKrVy6Zqz83DSdc7B2hqqkHX_Bfeb4SwAEOVCUN3EwiVroS5-TOq2o7hYSxphK9X0G23N-IBZ0Tr1Rl8XEiJ-OEy0rqnAKwmhAZJWnx3u8oXqbZtOWIZmzQSpcoxhgwfhdmTZJCqT2RVzZyeFItX4sVeilEP3z2xdsJs8-a1kg6UZnx1s1BNLBo7eZrreZygWojPCIDBn03fSAflXoVc5PpY2CGy5MA_IgWgSYBHDdoZEtigp_amjqK7Us44Db20XpLxMXfbahiqa7WKNnMgi6Ca2H67VtaaD8awAEF3zbE1nZRAa7a8vbU25c80YBYJBaW8P6FwXQI-K0Xk5MakwYeMMnIrm6w6IS_0XAO5YlD453GLqnxY8H1BEnRpfOnT7PE4el9mJ8MuYQMo6R2up0lGCmYM0YA9FORjroM3ng69SEPfJPCReG7LfJkERl_m2U403ertDRBYrlqCDagDfyI500srBcMrjSvV3oNouyyx3yZUrjLQfbHhDteQFsYdmakJs8Y-Q9-5MXCcrz6Qa4xwv522Euv0CCxkHcawAEYjfsU_zDhUZA1ey1aquWXlFOnx-iEALqxW1slDYHwQ1M2SILc-v_E6i1doa5e_bAZHVezBHFAlaNAVedNyHFFJxYAqAK3hbzbvl2glw3Q6h_rTXElymloqtaqVFIJ-oUWWOHsZBmu8EDA-HzvGCiBa_GbRaVfh2lE4ObeMXoJrEm_5dbxxeEic2l3IYeIz40N9ooQQOkQcOZdY4AXWYCavIAwWEJBjLtptJgCLu9a_zM1S5GsiyJHpdDs46WbP0EawAEWZ-95Sf0YAHujxRNLdXgpqe0ZF8loVwzZfvyMvqaxF1Ug274BqHuY_c5NdPAzuqoTwjfEn8NKEoaNqlumM75FUYbaTd7mXvk4WVYWjVnkO40dfQjRB7DYhvj0LBlbndAJ4wJIA2ilPYgjZsXVbNNh3e2j3u9eABd0VaFMbSb8Sz5_31r8HzoWmPJs3HiyuyANGFUA6CvAnMN6K3b-D8BhFZU_nPUTgu80o8_n6LQt-XWbaC_mTHzsnOjzBiPJxlYawAEW3bmOEtStH2T8q7vMkhchImp2-hg9MFYGBmEe9sSByTn3NUf8eksqXOC1dUjHkXoZm298FgUYLkNdnlxWpf993j5mEDoFxjcTB7scBD7k6nu6Nrs_wK0-seS8gsHrx9UK7GwAsi10q82Cm4PFyAtrWjmy_d9WLHuZt6VIOKunTs8cf0FwNUiMcvZsruqIFJcP7iWxdiFdUkh65P_iCz1ZEjJcj2GEZoq4v3a3by1aizGPaaiKc1jd_T-XJg_YpncawAEWnstu5b9WiZv0x8xfsiMk6YRlU0Cnj5svxLLXz_8drvwAa--GBY5yH0ke2EM6udMEi2EPeFcGTe6Sjs0YEhSbY7Uad_8suD2J4tIWJSWBbiyvh7rSqzv57m7BlsVcHfQJn_wNH-UlC9xkx8vg-LwfN8_FlxvHNPTc7XZG3lKYbwpUWlZxAziOYT1VQ-2K2bQQBBMdix-ht_SjccL1Dc2dP5kDazQ8yZV_8xnyeheazEedWe63uutfkHlZRg9YwP8=", + "type": "validator", + "lastSeen": 1575915094967382800 + } + ], + "mixNodes": [ + { + "host": "35.176.155.107:1789", + "pubKey": "zSob16499jT7C3S3ky4GihNOjlU6aLfSRkf1xAxOwV0=", + "layer": 3, + "lastSeen": 1575915096805374500 + }, + { + "host": "18.130.86.190:1789", + "pubKey": "vCdpFc0NvW0NSqsuTxtjFtiSY35aXesgT3JNA8sSIXk=", + "layer": 1, + "lastSeen": 1575915097370376000 + }, + { + "host": "3.10.22.152:1789", + "pubKey": "OwOqwWjh_IlnaWS2PxO6odnhNahOYpRCkju50beQCTA=", + "layer": 1, + "lastSeen": 1575915097639423500 + }, + { + "host": "35.178.213.77:1789", + "pubKey": "nkkrUjgL8UJk05QydvWvFSvtRB6nmeV8RMvH5540J3s=", + "layer": 2, + "lastSeen": 1575915097895166500 + }, + { + "host": "52.56.99.196:1789", + "pubKey": "whHuBuEc6zyOZOquKbuATaH4Crml61V_3Y-MztpWhF4=", + "layer": 2, + "lastSeen": 1575915096255174700 + }, + { + "host": "3.9.12.238:1789", + "pubKey": "vk5Sr-Xyi0cTbugACv8U42ZJ6hs6cGDox0rpmXY94Fc=", + "layer": 3, + "lastSeen": 1575915096497827600 + } + ], + "mixProviderNodes": [ + { + "host": "3.8.176.11:1789", + "pubKey": "54U6krAr-j9nQXFlsHk3io04_p0tctuqH71t7w_usgI=", + "registeredClients": [ + { + "pubKey": "zOqdJFH49HcgGSCRnmbXGzovnwRLEPN0YGN1SCafTyo=" + }, + { + "pubKey": "fy9xo69hZ2UJ9uxhIS1YzKHZsH8saV-02AiyCNXPNUc=" + }, + { + "pubKey": "6hFCz42d5AODAoMXqcBWtoOoZh-7hPMDXbLKKhS7x3I=" + }, + { + "pubKey": "pPZMDzw0FyZ-LBAhwCvjlPGj1p2bO_vaWbRBc7Ojq3Q=" + }, + { + "pubKey": "kjl5poXt2GdIrHLuMBjmTBSChV-zMqsXFBhKZoIREVI=" + }, + { + "pubKey": "T1jMGuk7-rcIUWnVopAsdGzhAJ7ZVymwON2LzjuOfnY=" + }, + { + "pubKey": "3X0eKPkflx5Vzok0Gk0jm5-YEfvPAuWP55ovyBUOtXA=" + }, + { + "pubKey": "5wC3i8rCZolLKbWJ9U6eLieXNGLKM21dtL6lR30u_hE=" + }, + { + "pubKey": "1P6p7fgjwjlEepD9JgbN1V-rk9n36-hCmPN5P6y62n4=" + }, + { + "pubKey": "aBjlLQKKFroqhX_kvYLnMm1uq3FJdQWqVy9Q35zzERA=" + }, + { + "pubKey": "I0gVOPj6lv9ha60xPYKeAgbeUU8pdyMD-Y7Nb1nS9EQ=" + }, + { + "pubKey": "WgdvQ74QH1uFDWDL2YeApvv7oniNGh9BQJ_HZam20QA=" + }, + { + "pubKey": "Mlw23KaSL2hyrIjEZM76bZStt2iMzxVAqXwO5clJfxg=" + }, + { + "pubKey": "F9xzbjnMQVN4ZidcqN2ip9kVnI9wbS39aVayZGiMihY=" + }, + { + "pubKey": "s6pfVkZrUG--RNjfzS55N2oPvFkMdvgb1LUut6gqRy4=" + }, + { + "pubKey": "bSi-9k0jJNKc8PGx8M3SWFaNpORFjYw-NkWXRZVRWGU=" + }, + { + "pubKey": "pz6ahQcGOQcZBFx1tGmzRngqk6BecXB_wFd4WVdOQDU=" + }, + { + "pubKey": "5sfwIMcG2zRCxhDh4D9Evw1WPI5bfKZAShM_6o9Pu1I=" + }, + { + "pubKey": "9fZnxXy9onGPpZ3Ygckqw0okqCw3di02sLr-NTBr4SE=" + }, + { + "pubKey": "Q0TbbggOwzZjalUdi5eEHVFi9VMv-rMm5mJPUZZs12A=" + }, + { + "pubKey": "aPNyox_qAIGFB2-wZ0lc9iAWDN6jzLojApSiWVFjCks=" + }, + { + "pubKey": "DUKLEsIGMw-ucs3DjS7Ag9qCb5-C_A84DuIsZuLkdwI=" + }, + { + "pubKey": "YV84vPoSrLf1p9Sw6FnnrcCpS3kvpJUfKyKpnwk8z0Q=" + }, + { + "pubKey": "_IYEzZQoBAYeTxqzpEe_ez1-7pn7aId8AKliazy0qlE=" + }, + { + "pubKey": "srkOAoVU-a02lnEsoH_wOLLw7HFx_xHIZUSbnhjFwDw=" + }, + { + "pubKey": "LxSCBn_OEQq-hI2xDi6bfGoioRO_lSTIq6AQ9l1k5jg=" + }, + { + "pubKey": "OC0OOqtGfAytgZjthpjoKeYNa0VrtzfgZ0iO5Fag5y8=" + }, + { + "pubKey": "ImVEch2focRhm1ial1gA6YJPr6WDyW3oh-OgYcO5Ll4=" + }, + { + "pubKey": "yTDnzLvEaSq0mC9xNrtyjpAKtsIU6yRuBepCuWQMBm4=" + }, + { + "pubKey": "-LCUUc46HuL7iUEOMkrlVAkvvulRiQ7dR1QYh7bkKxw=" + }, + { + "pubKey": "Bx1MGpISig25rqe7mhoX68EROUPPzmF7yGLYah9DPgM=" + }, + { + "pubKey": "Z4Nu6iwLmgJ93yoIFTbTEBeDAHRwS-vo1T_K2Kv1FQo=" + }, + { + "pubKey": "cKFAGxllwAmEXCtDxG_T1iEm3-lKWUVQxxpDBje6mQU=" + }, + { + "pubKey": "pQV40whlQWUSXtrNTTePzO6sdq3zr1JUIWZWvD443nY=" + }, + { + "pubKey": "6Bb5HwnVqJPy5wcNsaHY-0y__coZCE7XC80kUkesnRU=" + }, + { + "pubKey": "COGdpfhmzNGR6YX820GqJIkjOihL8mr6-h-d3JlTDFA=" + } + ], + "lastSeen": 1575915097358694100 + }, + { + "host": "35.178.212.193:1789", + "pubKey": "sA-sxi038pEbGy4lgZWG-RdHHDkA6kZzu44G0LUxFSc=", + "registeredClients": [ + { + "pubKey": "UE-7r6-bpw0b4T3GxOBVxlg02psx23DF2p5Tuf-OBSE=" + }, + { + "pubKey": "UnZuLpzq64_EPtIcr1Fd-5AESBCBLFnDMDsjUaOqrUA=" + }, + { + "pubKey": "4ExXPrW5w0nZIQ5ravBRT6H9r0RH0MXuOcGIF8HzUhg=" + }, + { + "pubKey": "wPsRpJPi1e2sjItyRKDkFACbxwu3Cw5GlYVPmdYxk2U=" + }, + { + "pubKey": "UfK5UvT3HUkT1SGbv1QGafy3in3uQ9a6NSy5EOT6k0k=" + }, + { + "pubKey": "5Giu-tJpGXU0S9Av75iAv5qDO0k6l8v_k9-UCcRUCl4=" + }, + { + "pubKey": "MnQxlmmKDybku4CfxsQQxfftilsaphF9Gq1w3MB1ZCE=" + }, + { + "pubKey": "GdP1fHVs2R65EkuWVWKZSz6WPDh0MgThyuBOv6_xsmQ=" + }, + { + "pubKey": "4JEtSrKsonmBuDvxJ9nITSu7iC4f8reutXRAVugPgS4=" + }, + { + "pubKey": "q4XyuUJbSGJaoRb3SmWzeX88V2dKB7sPTf72BAtQp3k=" + }, + { + "pubKey": "gTzKd1Ph5bpUw-JxTZiCe8RBfO-FsZiVYDYioQ-6dVg=" + }, + { + "pubKey": "NX4oaDLYEOmMUP_9pcEaZv5MJHJ4ZYAoxPQDxov7tRs=" + }, + { + "pubKey": "7fbk4oGQNlTW-tnWjVz8rWtKrtAicTsiNWgO98sqMyk=" + }, + { + "pubKey": "w1bfLpnd3rWu5JczB0nQfnE2S6nUCbx2AA7HDE48DQo=" + } + ], + "lastSeen": 1575915097869025000 + } + ] + }"#.to_string() + } + } +} diff --git a/src/clients/mix.rs b/src/clients/mix.rs new file mode 100644 index 0000000000..b8bcb77883 --- /dev/null +++ b/src/clients/mix.rs @@ -0,0 +1,52 @@ +use sphinx::route::NodeAddressBytes; +use sphinx::SphinxPacket; +use std::net::SocketAddr; +use tokio::prelude::*; + +pub struct MixClient {} + +impl MixClient { + pub fn new() -> MixClient { + MixClient {} + } + + // Sends a Sphinx packet to a mixnode. + pub async fn send( + &self, + packet: SphinxPacket, + mix_addr: SocketAddr, + ) -> Result<(), Box> { + let bytes = packet.to_bytes(); + + println!("socket addr: {:?}", mix_addr); + + let mut stream = tokio::net::TcpStream::connect(mix_addr).await?; + stream.write_all(&bytes[..]).await?; + Ok(()) + } +} + +#[cfg(test)] +mod sending_a_sphinx_packet { + // use super::*; + // use sphinx::SphinxPacket; + + #[test] + fn works() { + // arrange + // let directory = Client::new(); + // let message = "Hello, Sphinx!".as_bytes().to_vec(); + // let mixes = directory.get_mixes(); + // let destination = directory.get_destination(); + // let delays = sphinx::header::delays::generate(2); + // let packet = SphinxPacket::new(message, &mixes, &destination, &delays).unwrap(); + // let mix_client = MixClient::new(); + // let first_hop = mixes.first().unwrap(); + // + // // act + // mix_client.send(packet, first_hop); + + // assert + // wtf are we supposed to assert here? + } +} diff --git a/src/clients/mod.rs b/src/clients/mod.rs new file mode 100644 index 0000000000..d2da563ec0 --- /dev/null +++ b/src/clients/mod.rs @@ -0,0 +1,334 @@ +use crate::clients::directory::presence::Topology; +use crate::clients::mix::MixClient; +use crate::clients::provider::ProviderClient; +use crate::sockets::tcp; +use crate::sockets::ws; +use crate::utils; +use crate::utils::topology::get_topology; +use futures::channel::{mpsc, oneshot}; +use futures::join; +use futures::lock::Mutex as FMutex; +use futures::select; +use futures::{SinkExt, StreamExt}; +use sfw_provider_requests::AuthToken; +use sphinx::route::{Destination, DestinationAddressBytes}; +use sphinx::SphinxPacket; +use std::net::SocketAddr; +use std::sync::Arc; +use std::time::Duration; +use tokio::runtime::Runtime; + +pub mod directory; +pub mod mix; +pub mod provider; +pub mod validator; + +const LOOP_COVER_AVERAGE_DELAY: f64 = 0.5; +// seconds +const MESSAGE_SENDING_AVERAGE_DELAY: f64 = 0.5; +// seconds; +const FETCH_MESSAGES_DELAY: f64 = 1.0; // seconds; + +// provider-poller sends polls service provider; receives messages +// provider-poller sends (TX) to ReceivedBufferController (RX) +// ReceivedBufferController sends (TX) to ... ??Client?? +// outQueueController sends (TX) to TrafficStreamController (RX) +// TrafficStreamController sends messages to mixnet +// ... ??Client?? sends (TX) to outQueueController (RX) +// Loop cover traffic stream just sends messages to mixnet without any channel communication + +struct MixMessage(SocketAddr, SphinxPacket); + +struct MixTrafficController; + +impl MixTrafficController { + // this was way more difficult to implement than what this code may suggest... + async fn run(mut rx: mpsc::UnboundedReceiver) { + let mix_client = MixClient::new(); + while let Some(mix_message) = rx.next().await { + println!( + "[MIX TRAFFIC CONTROL] - got a mix_message for {:?}", + mix_message.0 + ); + let send_res = mix_client.send(mix_message.1, mix_message.0).await; + match send_res { + Ok(_) => println!("We successfully sent the message!"), + Err(e) => eprintln!("We failed to send the message :( - {:?}", e), + }; + } + } +} + +pub type BufferResponse = oneshot::Sender>>; + +struct ReceivedMessagesBuffer { + messages: Vec>, +} + +impl ReceivedMessagesBuffer { + fn add_arc_futures_mutex(self) -> Arc> { + Arc::new(FMutex::new(self)) + } + + fn new() -> Self { + ReceivedMessagesBuffer { + messages: Vec::new(), + } + } + + async fn add_new_messages(buf: Arc>, msgs: Vec>) { + println!("Adding new messages to the buffer! {:?}", msgs); + let mut unlocked = buf.lock().await; + unlocked.messages.extend(msgs); + } + + async fn run_poller_input_controller( + buf: Arc>, + mut poller_rx: mpsc::UnboundedReceiver>>, + ) { + while let Some(new_messages) = poller_rx.next().await { + ReceivedMessagesBuffer::add_new_messages(buf.clone(), new_messages).await; + } + } + + async fn acquire_and_empty(buf: Arc>) -> Vec> { + let mut unlocked = buf.lock().await; + std::mem::replace(&mut unlocked.messages, Vec::new()) + } + + async fn run_query_output_controller( + buf: Arc>, + mut query_receiver: mpsc::UnboundedReceiver, + ) { + while let Some(request) = query_receiver.next().await { + let messages = ReceivedMessagesBuffer::acquire_and_empty(buf.clone()).await; + // if this fails, the whole application needs to blow + // because currently only this thread would fail + request.send(messages).unwrap(); + } + } +} + +pub enum SocketType { + TCP, + WebSocket, + None, +} + +pub struct NymClient { + // to be replaced by something else I guess + address: DestinationAddressBytes, + pub input_tx: mpsc::UnboundedSender, + // to be used by "send" function or socket, etc + input_rx: mpsc::UnboundedReceiver, + socket_listening_address: SocketAddr, + directory: String, + auth_token: Option, + socket_type: SocketType, +} + +#[derive(Debug)] +pub struct InputMessage(pub Destination, pub Vec); + +impl NymClient { + pub fn new( + address: DestinationAddressBytes, + socket_listening_address: SocketAddr, + directory: String, + auth_token: Option, + socket_type: SocketType, + ) -> Self { + let (input_tx, input_rx) = mpsc::unbounded::(); + + NymClient { + address, + input_tx, + input_rx, + socket_listening_address, + directory, + auth_token, + socket_type, + } + } + + async fn start_loop_cover_traffic_stream( + mut tx: mpsc::UnboundedSender, + our_info: Destination, + topology: Topology, + ) { + loop { + println!("[LOOP COVER TRAFFIC STREAM] - next cover message!"); + let delay = utils::poisson::sample(LOOP_COVER_AVERAGE_DELAY); + let delay_duration = Duration::from_secs_f64(delay); + tokio::time::delay_for(delay_duration).await; + let cover_message = + utils::sphinx::loop_cover_message(our_info.address, our_info.identifier, &topology); + tx.send(MixMessage(cover_message.0, cover_message.1)) + .await + .unwrap(); + } + } + + async fn control_out_queue( + mut mix_tx: mpsc::UnboundedSender, + mut input_rx: mpsc::UnboundedReceiver, + our_info: Destination, + topology: Topology, + ) { + loop { + println!("[OUT QUEUE] here I will be sending real traffic (or loop cover if nothing is available)"); + select! { + real_message = input_rx.next() => { + println!("[OUT QUEUE] - we got a real message!"); + let real_message = real_message.expect("The channel must have closed! - if the client hasn't crashed, it should have!"); + println!("real: {:?}", real_message); + let encapsulated_message = utils::sphinx::encapsulate_message(real_message.0, real_message.1, &topology); + mix_tx.send(MixMessage(encapsulated_message.0, encapsulated_message.1)).await.unwrap(); + }, + + default => { + println!("[OUT QUEUE] - no real message - going to send extra loop cover"); + let cover_message = utils::sphinx::loop_cover_message(our_info.address, our_info.identifier, &topology); + mix_tx.send(MixMessage(cover_message.0, cover_message.1)).await.unwrap(); + } + }; + + let delay_duration = Duration::from_secs_f64(MESSAGE_SENDING_AVERAGE_DELAY); + tokio::time::delay_for(delay_duration).await; + } + } + + async fn start_provider_polling( + provider_client: ProviderClient, + mut poller_tx: mpsc::UnboundedSender>>, + ) { + let loop_message = &utils::sphinx::LOOP_COVER_MESSAGE_PAYLOAD.to_vec(); + let dummy_message = &sfw_provider_requests::DUMMY_MESSAGE_CONTENT.to_vec(); + loop { + let delay_duration = Duration::from_secs_f64(FETCH_MESSAGES_DELAY); + tokio::time::delay_for(delay_duration).await; + println!("[FETCH MSG] - Polling provider..."); + let messages = provider_client.retrieve_messages().await.unwrap(); + let good_messages = messages + .into_iter() + .filter(|message| message != loop_message && message != dummy_message) + .collect(); + // if any of those fails, whole application should blow... + poller_tx.send(good_messages).await.unwrap(); + } + } + + pub fn start(self) -> Result<(), Box> { + println!("Starting nym client"); + let mut rt = Runtime::new()?; + + let topology = get_topology(self.directory.clone()); + // this is temporary and assumes there exists only a single provider. + let provider_address: SocketAddr = topology + .mix_provider_nodes + .first() + .unwrap() + .host + .parse() + .unwrap(); + + let mut provider_client = + ProviderClient::new(provider_address, self.address, self.auth_token); + + // registration + rt.block_on(async { + match self.auth_token { + None => { + let auth_token = provider_client.register().await.unwrap(); + provider_client.update_token(auth_token); + println!("Obtained new token! - {:?}", auth_token); + } + Some(token) => println!("Already got the token! - {:?}", token), + } + }); + + // channels for intercomponent communication + let (mix_tx, mix_rx) = mpsc::unbounded(); + let (poller_input_tx, poller_input_rx) = mpsc::unbounded(); + let (received_messages_buffer_output_tx, received_messages_buffer_output_rx) = + mpsc::unbounded(); + + let received_messages_buffer = ReceivedMessagesBuffer::new().add_arc_futures_mutex(); + + let received_messages_buffer_input_controller_future = + rt.spawn(ReceivedMessagesBuffer::run_poller_input_controller( + received_messages_buffer.clone(), + poller_input_rx, + )); + let received_messages_buffer_output_controller_future = + rt.spawn(ReceivedMessagesBuffer::run_query_output_controller( + received_messages_buffer, + received_messages_buffer_output_rx, + )); + + let mix_traffic_future = rt.spawn(MixTrafficController::run(mix_rx)); + let loop_cover_traffic_future = rt.spawn(NymClient::start_loop_cover_traffic_stream( + mix_tx.clone(), + Destination::new(self.address, Default::default()), + topology.clone(), + )); + + let out_queue_control_future = rt.spawn(NymClient::control_out_queue( + mix_tx, + self.input_rx, + Destination::new(self.address, Default::default()), + topology.clone(), + )); + + let provider_polling_future = rt.spawn(NymClient::start_provider_polling( + provider_client, + poller_input_tx, + )); + + match self.socket_type { + SocketType::WebSocket => { + rt.spawn(ws::start_websocket( + self.socket_listening_address, + self.input_tx, + received_messages_buffer_output_tx, + self.address, + topology, + )); + } + SocketType::TCP => { + rt.spawn(tcp::start_tcpsocket( + self.socket_listening_address, + self.input_tx, + received_messages_buffer_output_tx, + self.address, + topology, + )); + } + SocketType::None => (), + } + + rt.block_on(async { + let future_results = join!( + received_messages_buffer_input_controller_future, + received_messages_buffer_output_controller_future, + mix_traffic_future, + loop_cover_traffic_future, + out_queue_control_future, + provider_polling_future, + ); + + assert!( + future_results.0.is_ok() + && future_results.1.is_ok() + && future_results.2.is_ok() + && future_results.3.is_ok() + && future_results.4.is_ok() + && future_results.5.is_ok() + ); + }); + + // this line in theory should never be reached as the runtime should be permanently blocked on traffic senders + eprintln!("The client went kaput..."); + Ok(()) + } +} diff --git a/src/clients/provider.rs b/src/clients/provider.rs new file mode 100644 index 0000000000..e95c318e22 --- /dev/null +++ b/src/clients/provider.rs @@ -0,0 +1,118 @@ +use futures::io::Error; +use sfw_provider_requests::requests::{ProviderRequest, PullRequest, RegisterRequest}; +use sfw_provider_requests::responses::{ + ProviderResponse, ProviderResponseError, PullResponse, RegisterResponse, +}; +use sfw_provider_requests::AuthToken; +use sphinx::route::DestinationAddressBytes; +use std::net::{Shutdown, SocketAddr}; +use std::time::Duration; +use tokio::prelude::*; + +#[derive(Debug)] +pub enum ProviderClientError { + ClientAlreadyRegisteredError, + EmptyAuthTokenError, + NetworkError, + + InvalidRequestError, + InvalidResponseError, + InvalidResponseLengthError, +} + +impl From for ProviderClientError { + fn from(_: Error) -> Self { + use ProviderClientError::*; + + NetworkError + } +} + +impl From for ProviderClientError { + fn from(err: ProviderResponseError) -> Self { + use ProviderClientError::*; + match err { + ProviderResponseError::MarshalError => InvalidRequestError, + ProviderResponseError::UnmarshalError => InvalidResponseError, + ProviderResponseError::UnmarshalErrorInvalidLength => InvalidResponseLengthError, + } + } +} + +pub struct ProviderClient { + provider_network_address: SocketAddr, + our_address: DestinationAddressBytes, + auth_token: Option, +} + +impl ProviderClient { + pub fn new( + provider_network_address: SocketAddr, + our_address: DestinationAddressBytes, + auth_token: Option, + ) -> Self { + // DH temporary: the provider's client port is not in the topology, but we can't change that + // right now without messing up the existing Go mixnet. So I'm going to hardcode this + // for the moment until the Go mixnet goes away. + let provider_socket = SocketAddr::new(provider_network_address.ip(), 9000); + + ProviderClient { + provider_network_address: provider_socket, + our_address, + auth_token, + } + } + + pub fn update_token(&mut self, auth_token: AuthToken) { + self.auth_token = Some(auth_token) + } + + pub async fn send_request(&self, bytes: Vec) -> Result, ProviderClientError> { + let mut socket = tokio::net::TcpStream::connect(self.provider_network_address).await?; + println!("keep alive: {:?}", socket.keepalive()); + socket.set_keepalive(Some(Duration::from_secs(2))).unwrap(); + socket.write_all(&bytes[..]).await?; + if let Err(_e) = socket.shutdown(Shutdown::Write) { + // TODO: make it a silent log once we have a proper logging library + // eprintln!("failed to close write part of the socket; err = {:?}", e) + } + + let mut response = Vec::new(); + socket.read_to_end(&mut response).await?; + if let Err(_e) = socket.shutdown(Shutdown::Read) { + // TODO: make it a silent log once we have a proper logging library + // eprintln!("failed to close read part of the socket; err = {:?}", e) + } + + Ok(response) + } + + pub async fn retrieve_messages(&self) -> Result>, ProviderClientError> { + if self.auth_token.is_none() { + return Err(ProviderClientError::EmptyAuthTokenError); + } + + let pull_request = PullRequest::new(self.our_address, self.auth_token.unwrap()); + let bytes = pull_request.to_bytes(); + + let response = self.send_request(bytes).await?; + println!("Received the following response: {:?}", response); + + let parsed_response = PullResponse::from_bytes(&response)?; + Ok(parsed_response.messages) + } + + pub async fn register(&self) -> Result { + if self.auth_token.is_some() { + return Err(ProviderClientError::ClientAlreadyRegisteredError); + } + + let register_request = RegisterRequest::new(self.our_address); + let bytes = register_request.to_bytes(); + + let response = self.send_request(bytes).await?; + let parsed_response = RegisterResponse::from_bytes(&response)?; + + Ok(parsed_response.auth_token) + } +} diff --git a/src/clients/validator.rs b/src/clients/validator.rs new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/src/clients/validator.rs @@ -0,0 +1 @@ + diff --git a/src/commands/init.rs b/src/commands/init.rs new file mode 100644 index 0000000000..00af80c1f5 --- /dev/null +++ b/src/commands/init.rs @@ -0,0 +1,20 @@ +use crate::banner; +use crate::identity::mixnet; +use crate::persistence::pathfinder::Pathfinder; +use crate::persistence::pemstore::PemStore; +use clap::ArgMatches; + +pub fn execute(matches: &ArgMatches) { + println!("{}", banner()); + println!("Initialising client..."); + + let id = matches.value_of("id").unwrap().to_string(); // required for now + let pathfinder = Pathfinder::new(id); + + println!("Writing keypairs to {:?}...", pathfinder.config_dir); + let mix_keys = mixnet::KeyPair::new(); + let pem_store = PemStore::new(pathfinder); + pem_store.write(mix_keys); + + println!("Client configuration completed.\n\n\n") +} diff --git a/src/commands/mod.rs b/src/commands/mod.rs new file mode 100644 index 0000000000..83edeba8a9 --- /dev/null +++ b/src/commands/mod.rs @@ -0,0 +1,4 @@ +pub mod init; +pub mod run; +pub mod tcpsocket; +pub mod websocket; diff --git a/src/commands/run.rs b/src/commands/run.rs new file mode 100644 index 0000000000..932da4a190 --- /dev/null +++ b/src/commands/run.rs @@ -0,0 +1,17 @@ +use crate::banner; +//use crate::clients::NymClient; +//use crate::persistence::pemstore; +use clap::ArgMatches; + +pub fn execute(_matches: &ArgMatches) { + println!("{}", banner()); + panic!("For time being this command is deprecated! Please use 'websocket' instead"); + // + // let is_local = matches.is_present("local"); + // let id = matches.value_of("id").unwrap().to_string(); + // println!("Starting client..."); + // + // let keypair = pemstore::read_keypair_from_disk(id); + // let client = NymClient::new(keypair.public_bytes(), is_local); + // client.start("127.0.0.1:9000".parse().unwrap()).unwrap(); +} diff --git a/src/commands/tcpsocket.rs b/src/commands/tcpsocket.rs new file mode 100644 index 0000000000..d609f00d1b --- /dev/null +++ b/src/commands/tcpsocket.rs @@ -0,0 +1,44 @@ +use crate::banner; +use crate::clients::{NymClient, SocketType}; +use crate::persistence::pemstore; +use crate::sockets::tcp; + +use clap::ArgMatches; +use std::net::ToSocketAddrs; + +pub fn execute(matches: &ArgMatches) { + println!("{}", banner()); + + let id = matches.value_of("id").unwrap().to_string(); + let port = match matches.value_of("port").unwrap_or("9001").parse::() { + Ok(n) => n, + Err(err) => panic!("Invalid port value provided - {:?}", err), + }; + + let directory_server = matches + .value_of("directory") + .unwrap_or("https://directory.nymtech.net") + .to_string(); + + println!("Starting TCP socket on port: {:?}", port); + println!("Listening for messages..."); + + let socket_address = ("127.0.0.1", port) + .to_socket_addrs() + .expect("Failed to combine host and port") + .next() + .expect("Failed to extract the socket address from the iterator"); + + let keypair = pemstore::read_keypair_from_disk(id); + let auth_token = None; + + let client = NymClient::new( + keypair.public_bytes(), + socket_address.clone(), + directory_server, + auth_token, + SocketType::TCP, + ); + + client.start().unwrap(); +} diff --git a/src/commands/websocket.rs b/src/commands/websocket.rs new file mode 100644 index 0000000000..1b8ccd69b2 --- /dev/null +++ b/src/commands/websocket.rs @@ -0,0 +1,43 @@ +use crate::banner; +use crate::clients::{NymClient, SocketType}; +use crate::persistence::pemstore; + +use clap::ArgMatches; +use std::net::ToSocketAddrs; + +pub fn execute(matches: &ArgMatches) { + println!("{}", banner()); + + let id = matches.value_of("id").unwrap().to_string(); + let port = match matches.value_of("port").unwrap_or("9001").parse::() { + Ok(n) => n, + Err(err) => panic!("Invalid port value provided - {:?}", err), + }; + + let directory_server = matches + .value_of("directory") + .unwrap_or("https://directory.nymtech.net") + .to_string(); + + println!("Starting websocket on port: {:?}", port); + println!("Listening for messages..."); + + let socket_address = ("127.0.0.1", port) + .to_socket_addrs() + .expect("Failed to combine host and port") + .next() + .expect("Failed to extract the socket address from the iterator"); + + let keypair = pemstore::read_keypair_from_disk(id); + // TODO: reading auth_token from disk (if exists); + let auth_token = None; + let client = NymClient::new( + keypair.public_bytes(), + socket_address, + directory_server, + auth_token, + SocketType::WebSocket, + ); + + client.start().unwrap(); +} diff --git a/src/directory.rs b/src/directory.rs deleted file mode 100644 index 18ef0356e3..0000000000 --- a/src/directory.rs +++ /dev/null @@ -1,70 +0,0 @@ -use sphinx::route::{Node as SphinxNode, Destination}; - -pub struct DirectoryClient {} - -impl DirectoryClient { - pub fn new() -> DirectoryClient { - DirectoryClient {} - } - - // Hardcoded for now. Later, this should make a network request to the directory server (if one - // has not yet been made), parse the returned JSON, memoize the full tree of active nodes, - // and return the list of currently active mix nodes. - pub fn get_mixes(&self) -> Vec { - fake_directory_mixes() - } - - pub fn get_destination(&self) -> Destination { - Destination { - address: [0u8;32], - identifier: [0u8; 16], - } - } -} - - - -#[cfg(test)] -mod retrieving_mixnode_list { - use super::*; - - #[test] - fn always_works_because_it_is_hardcoded() { - let directory = DirectoryClient::new(); - let expected = fake_directory_mixes().as_slice().to_owned(); - - let mixes = directory.get_mixes(); - - assert_eq!(expected, mixes.as_slice()); - } -} - -#[cfg(test)] -mod retrieving_destinations { - use super::*; - - #[test] - fn always_works_because_it_is_hardcoded() { - let directory = DirectoryClient::new(); - let expected = Destination { - address: [0u8;32], - identifier: [0u8; 16], - }; - - let destination = directory.get_destination(); - - assert_eq!(expected, destination); - } -} - -fn fake_directory_mixes() -> Vec { - let node1 = sphinx::route::Node{ - address: [0u8;32], - pub_key: Default::default() - }; - let node2 = sphinx::route::Node{ - address: [1u8;32], - pub_key: Default::default() - }; - vec![node1, node2] -} \ No newline at end of file diff --git a/src/identity/mixnet.rs b/src/identity/mixnet.rs new file mode 100644 index 0000000000..10e081a4fa --- /dev/null +++ b/src/identity/mixnet.rs @@ -0,0 +1,33 @@ +use curve25519_dalek::montgomery::MontgomeryPoint; +use curve25519_dalek::scalar::Scalar; + +// This keypair serves as the user's identity within the Mixnet +pub struct KeyPair { + pub private: Scalar, + pub public: MontgomeryPoint, +} + +impl KeyPair { + pub fn new() -> KeyPair { + let (private, public) = sphinx::crypto::keygen(); + KeyPair { private, public } + } + + pub fn from_bytes(private_bytes: Vec, public_bytes: Vec) -> KeyPair { + let mut bytes = [0; 32]; + bytes.copy_from_slice(&private_bytes[..]); + let private = Scalar::from_canonical_bytes(bytes).unwrap(); + let mut bytes = [0; 32]; + bytes.copy_from_slice(&public_bytes[..]); + let public = MontgomeryPoint(bytes); + KeyPair { private, public } + } + + pub fn private_bytes(&self) -> [u8; 32] { + self.private.to_bytes() + } + + pub fn public_bytes(&self) -> [u8; 32] { + self.public.to_bytes() + } +} diff --git a/src/identity/mod.rs b/src/identity/mod.rs new file mode 100644 index 0000000000..ae7f01c0eb --- /dev/null +++ b/src/identity/mod.rs @@ -0,0 +1 @@ +pub mod mixnet; diff --git a/src/identity/validators.rs b/src/identity/validators.rs new file mode 100644 index 0000000000..b18c85b0b2 --- /dev/null +++ b/src/identity/validators.rs @@ -0,0 +1 @@ +// TODO types for Validator keys will go in here once we hook this up. diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000000..5f1dc2a7c5 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,5 @@ +pub mod clients; +pub mod identity; +pub mod persistence; +pub mod sockets; +pub mod utils; diff --git a/src/main.rs b/src/main.rs index 0dfebd32d1..6d73a64713 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,136 @@ -mod directory; -mod mix; +use clap::{App, Arg, ArgMatches, SubCommand}; +use std::process; + +pub mod clients; +mod commands; +mod identity; +mod persistence; +mod sockets; +mod utils; fn main() { - let _ = "Hello, Sphinx!".as_bytes().to_vec(); + let arg_matches = App::new("Nym Client") + .version("0.1.0") + .author("Nymtech") + .about("Implementation of the Nym Client") + .subcommand( + SubCommand::with_name("init") + .about("Initialise a Nym client. Do this first!") + .arg(Arg::with_name("id") + .long("id") + .help("Id of the nym-mixnet-client we want to create config for.") + .takes_value(true) + .required(true) + ) + .arg(Arg::with_name("provider") + .long("provider") + .help("Id of the provider we have preference to connect to. If left empty, a random provider will be chosen.") + .takes_value(true) + ) + ) + .subcommand( + SubCommand::with_name("run") + .about("Run a persistent Nym client process") + .arg(Arg::with_name("id") + .long("id") + .help("Id of the nym-mixnet-client we want to run.") + .takes_value(true) + .required(true) + ) + .arg( + Arg::with_name("directory") + .long("directory") + .help("Address of the directory server the client is getting topology from") + .takes_value(true), + ) + ) + .subcommand( + SubCommand::with_name("tcpsocket") + .about("Run Nym client that listens for bytes on a TCP socket") + .arg( + Arg::with_name("port") + .short("p") + .long("port") + .help("Port for TCP socket to listen on") + .takes_value(true) + .required(true), + ) + .arg( + Arg::with_name("directory") + .long("directory") + .help("Address of the directory server the client is getting topology from") + .takes_value(true), + ) + .arg(Arg::with_name("id") + .long("id") + .help("Id of the nym-mixnet-client we want to run.") + .takes_value(true) + .required(true) + ) + ) + .subcommand( + SubCommand::with_name("websocket") + .about("Run Nym client that listens on a websocket") + .arg( + Arg::with_name("port") + .short("p") + .long("port") + .help("Port for websocket to listen on") + .takes_value(true) + ) + .arg( + Arg::with_name("directory") + .long("directory") + .help("Address of the directory server the client is getting topology from") + .takes_value(true), + ) + .arg(Arg::with_name("id") + .long("id") + .help("Id of the nym-mixnet-client we want to run.") + .takes_value(true) + .required(true) + ) + ) + .get_matches(); + + if let Err(e) = execute(arg_matches) { + println!("{}", e); + process::exit(1); + } } +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() { + ("init", Some(m)) => Ok(commands::init::execute(m)), + ("run", Some(m)) => Ok(commands::run::execute(m)), + ("tcpsocket", Some(m)) => Ok(commands::tcpsocket::execute(m)), + ("websocket", Some(m)) => Ok(commands::websocket::execute(m)), + _ => Err(usage()), + } +} + +fn usage() -> String { + banner() + "usage: --help to see available options.\n\n" +} + +fn banner() -> String { + format!( + r#" + + _ __ _ _ _ __ ___ + | '_ \| | | | '_ \ _ \ + | | | | |_| | | | | | | + |_| |_|\__, |_| |_| |_| + |___/ + + (client - version {:}) + + "#, + built_info::PKG_VERSION + ) +} diff --git a/src/mix.rs b/src/mix.rs deleted file mode 100644 index 4e903d644c..0000000000 --- a/src/mix.rs +++ /dev/null @@ -1,41 +0,0 @@ -use crate::directory::DirectoryClient; -use sphinx::SphinxPacket; -use sphinx::route::Node; - -struct MixClient {} - -impl MixClient { - fn new() -> MixClient { - MixClient {} - } - - fn send(&self, packet: SphinxPacket, mix: &Node) { - let bytes = packet.to_bytes(); - // now we shoot it into space! - } -} - - -#[cfg(test)] -mod sending_a_sphinx_packet { - use super::*; - use sphinx::SphinxPacket; - - #[test] - fn works() { - // arrange - let directory = DirectoryClient::new(); - let message = "Hello, Sphinx!".as_bytes().to_vec(); - let mixes = directory.get_mixes(); - let destination = directory.get_destination(); - let packet = SphinxPacket::new(message, &mixes, &destination); - let mix_client = MixClient::new(); - let first_hop = mixes.first().unwrap(); - - // act - mix_client.send(packet, first_hop); - - // assert - // wtf are we supposed to assert here? - } -} \ No newline at end of file diff --git a/src/persistence/mod.rs b/src/persistence/mod.rs new file mode 100644 index 0000000000..bc1ad593bd --- /dev/null +++ b/src/persistence/mod.rs @@ -0,0 +1,2 @@ +pub mod pathfinder; +pub mod pemstore; diff --git a/src/persistence/pathfinder.rs b/src/persistence/pathfinder.rs new file mode 100644 index 0000000000..08110b9ae8 --- /dev/null +++ b/src/persistence/pathfinder.rs @@ -0,0 +1,21 @@ +use std::path::PathBuf; + +pub struct Pathfinder { + pub config_dir: PathBuf, + pub private_mix_key: PathBuf, + pub public_mix_key: PathBuf, +} + +impl Pathfinder { + pub fn new(id: String) -> Pathfinder { + let os_config_dir = dirs::config_dir().unwrap(); // grabs the OS default config dir + let config_dir = os_config_dir.join("nym").join("clients").join(id); + let private_mix_key = config_dir.join("private.pem"); + let public_mix_key = config_dir.join("public.pem"); + Pathfinder { + config_dir, + private_mix_key, + public_mix_key, + } + } +} diff --git a/src/persistence/pemstore.rs b/src/persistence/pemstore.rs new file mode 100644 index 0000000000..037c6ab58a --- /dev/null +++ b/src/persistence/pemstore.rs @@ -0,0 +1,72 @@ +use crate::identity::mixnet::KeyPair; +use crate::persistence::pathfinder::Pathfinder; +use pem::{encode, parse, Pem}; +use std::fs::File; +use std::io::prelude::*; +use std::path::PathBuf; + +pub fn read_keypair_from_disk(id: String) -> KeyPair { + let pathfinder = Pathfinder::new(id); + let pem_store = PemStore::new(pathfinder); + let keypair = pem_store.read(); + keypair +} + +pub struct PemStore { + config_dir: PathBuf, + private_mix_key: PathBuf, + public_mix_key: PathBuf, +} + +impl PemStore { + pub fn new(pathfinder: Pathfinder) -> PemStore { + PemStore { + config_dir: pathfinder.config_dir, + private_mix_key: pathfinder.private_mix_key, + public_mix_key: pathfinder.public_mix_key, + } + } + + pub fn read(&self) -> KeyPair { + let private = self.read_file(self.private_mix_key.clone()); + let public = self.read_file(self.public_mix_key.clone()); + + KeyPair::from_bytes(private, public) + } + + fn read_file(&self, filepath: PathBuf) -> Vec { + let mut pem_bytes = File::open(filepath).unwrap(); + let mut buf = Vec::new(); + pem_bytes.read_to_end(&mut buf).unwrap(); + let pem = parse(&buf).unwrap(); + pem.contents + } + // This should be refactored and made more generic for when we have other kinds of + // KeyPairs that we want to persist (e.g. validator keypairs, or keys for + // signing vs encryption). However, for the moment, it does the job. + pub fn write(&self, key_pair: KeyPair) { + std::fs::create_dir_all(self.config_dir.clone()).unwrap(); + + self.write_pem_file( + self.private_mix_key.clone(), + key_pair.private_bytes(), + String::from("SPHINX CURVE25519 PRIVATE KEY"), + ); + self.write_pem_file( + self.public_mix_key.clone(), + key_pair.public_bytes(), + String::from("SPHINX CURVE25519 PUBLIC KEY"), + ); + } + + fn write_pem_file(&self, filepath: PathBuf, data: [u8; 32], tag: String) { + let pem = Pem { + tag, + contents: data.to_vec(), + }; + let key = encode(&pem); + + let mut file = File::create(filepath).unwrap(); + file.write_all(key.as_bytes()).unwrap(); + } +} diff --git a/src/persistence/toml.rs b/src/persistence/toml.rs new file mode 100644 index 0000000000..f4f5578ad0 --- /dev/null +++ b/src/persistence/toml.rs @@ -0,0 +1 @@ +// TODO: we can put all the TOML config templating code in here once we get to that. diff --git a/src/sockets/mod.rs b/src/sockets/mod.rs new file mode 100644 index 0000000000..86dd43f872 --- /dev/null +++ b/src/sockets/mod.rs @@ -0,0 +1,2 @@ +pub mod tcp; +pub mod ws; diff --git a/src/sockets/tcp.rs b/src/sockets/tcp.rs new file mode 100644 index 0000000000..5262475092 --- /dev/null +++ b/src/sockets/tcp.rs @@ -0,0 +1,305 @@ +use crate::clients::directory::presence::Topology; +use crate::clients::BufferResponse; +use crate::clients::InputMessage; +use futures::channel::{mpsc, oneshot}; +use futures::future::FutureExt; +use futures::io::Error; +use futures::SinkExt; +use sphinx::route::{Destination, DestinationAddressBytes}; +use std::io; +use std::net::SocketAddr; +use tokio::prelude::*; +use std::convert::TryFrom; +use std::sync::Arc; +use std::borrow::Borrow; + +const SEND_REQUEST_PREFIX: u8 = 1; +const FETCH_REQUEST_PREFIX: u8 = 2; +const GET_CLIENTS_REQUEST_PREFIX: u8 = 3; +const OWN_DETAILS_REQUEST_PREFIX: u8 = 4; + +#[derive(Debug)] +pub enum TCPSocketError { + FailedToStartSocketError, + UnknownSocketError, + IncompleteDataError, + UnknownRequestError, +} + +impl From for TCPSocketError { + fn from(err: Error) -> Self { + use TCPSocketError::*; + match err.kind() { + io::ErrorKind::ConnectionRefused => FailedToStartSocketError, + io::ErrorKind::ConnectionReset => FailedToStartSocketError, + io::ErrorKind::ConnectionAborted => FailedToStartSocketError, + io::ErrorKind::NotConnected => FailedToStartSocketError, + + io::ErrorKind::AddrInUse => FailedToStartSocketError, + io::ErrorKind::AddrNotAvailable => FailedToStartSocketError, + _ => UnknownSocketError, + } + } +} + + +enum ClientRequest { + Send { + message: Vec, + recipient_address: DestinationAddressBytes, + }, + Fetch, + GetClients, + OwnDetails, +} + +impl TryFrom<&[u8]> for ClientRequest { + type Error = TCPSocketError; + + fn try_from(data: &[u8]) -> Result { + use TCPSocketError::*; + if data.is_empty() { + return Err(IncompleteDataError); + } + + match data[0] { + SEND_REQUEST_PREFIX => parse_send_request(data), + FETCH_REQUEST_PREFIX => Ok(ClientRequest::Fetch), + GET_CLIENTS_REQUEST_PREFIX => Ok(ClientRequest::GetClients), + OWN_DETAILS_REQUEST_PREFIX => Ok(ClientRequest::OwnDetails), + _ => Err(UnknownRequestError) + } + } +} + +fn parse_send_request(data: &[u8]) -> Result { + if data.len() < 1 + 32 + 1 { + // make sure it has the prefix, destination and at least single byte of data + return Err(TCPSocketError::IncompleteDataError); + } + + let mut recipient_address = [0u8; 32]; + recipient_address.copy_from_slice(&data[1..33]); + + let message = data[33..].to_vec(); + + Ok(ClientRequest::Send { + message, + recipient_address, + }) +} + +impl ClientRequest { + async fn handle_send( + msg: Vec, + recipient_address: DestinationAddressBytes, + mut input_tx: mpsc::UnboundedSender, + ) -> ServerResponse { + println!("send handle. sending to: {:?}, msg: {:?}", recipient_address, msg); + let dummy_surb = [0; 16]; + let input_msg = InputMessage(Destination::new(recipient_address, dummy_surb), msg); + + println!("ALMOST ABOUT TO SOMEDAY SEND {:?}", input_msg); + input_tx.send(input_msg).await.unwrap(); + + ServerResponse::Send + } + + async fn handle_fetch(mut msg_query: mpsc::UnboundedSender) -> ServerResponse { + println!("fetch handle"); + let (res_tx, res_rx) = oneshot::channel(); + if msg_query.send(res_tx).await.is_err() { + return ServerResponse::Error { + message: "Server failed to receive messages".to_string(), + }; + } + + let messages = res_rx.map(|msg| msg).await; + + if messages.is_err() { + return ServerResponse::Error { + message: "Server failed to receive messages".to_string(), + }; + } + + let messages = messages.unwrap(); + println!("fetched {} messages", messages.len()); + ServerResponse::Fetch { + messages, + } + } + + async fn handle_get_clients(topology: &Topology) -> ServerResponse { + println!("get clients handle"); + let clients = topology + .mix_provider_nodes + .iter() + .flat_map(|provider| provider.registered_clients.iter()) + .map(|client| base64::decode_config(&client.pub_key, base64::URL_SAFE).unwrap()) // TODO: this can potentially throw an error + .collect(); + ServerResponse::GetClients { clients } + } + + async fn handle_own_details(self_address_bytes: DestinationAddressBytes) -> ServerResponse { + println!("own details handle"); + ServerResponse::OwnDetails { + address: self_address_bytes.to_vec(), + } + } +} + + +enum ServerResponse { + Send, + Fetch { messages: Vec> }, + GetClients { clients: Vec> }, + OwnDetails { address: Vec }, + Error { message: String }, +} + +impl Into> for ServerResponse { + fn into(self) -> Vec { + match self { + ServerResponse::Send => b"ok".to_vec(), + ServerResponse::Fetch {messages} =>encode_fetched_messages(messages), + ServerResponse::GetClients {clients} => encode_list_of_clients(clients), + ServerResponse::OwnDetails {address} => address, + ServerResponse::Error { message } => message.as_bytes().to_vec() + } + } +} + +// num_msgs || len1 || len2 || ... || msg1 || msg2 || ... +fn encode_fetched_messages(messages: Vec>) -> Vec { + // for reciprocal of this look into sfw-provider-requests::responses::PullResponse::from_bytes() + + let num_msgs = messages.len() as u16; + let msgs_lens: Vec = messages.iter().map(|msg| msg.len() as u16).collect(); + + num_msgs + .to_be_bytes() + .to_vec() + .into_iter() + .chain( + msgs_lens + .into_iter() + .flat_map(|len| len.to_be_bytes().to_vec().into_iter()), + ) + .chain(messages.iter().flat_map(|msg| msg.clone().into_iter())) + .collect() +} + +fn encode_list_of_clients(clients: Vec>) -> Vec { + println!("clients: {:?}", clients); + // we can just concat all clients since all of them got to be 32 bytes long + // (if not, then we have bigger problem somewhere up the line) + + // converts [[1,2,3],[4,5,6],...] into [1,2,3,4,5,6,...] + clients.into_iter().flatten().collect() +} + +impl ServerResponse { + fn new_error(message: String) -> ServerResponse { + ServerResponse::Error { message } + } +} + + +async fn handle_connection(data: &[u8], request_handling_data: RequestHandlingData) -> Result { + let request = ClientRequest::try_from(data)?; + let response = match request { + ClientRequest::Send { + message, + recipient_address + } => ClientRequest::handle_send(message, recipient_address, request_handling_data.msg_input).await, + ClientRequest::Fetch => ClientRequest::handle_fetch(request_handling_data.msg_query).await, + ClientRequest::GetClients => ClientRequest::handle_get_clients(request_handling_data.topology.borrow()).await, + ClientRequest::OwnDetails => ClientRequest::handle_own_details(request_handling_data.self_address).await, + }; + + Ok(response) +} + +struct RequestHandlingData { + msg_input: mpsc::UnboundedSender, + msg_query: mpsc::UnboundedSender, + self_address: DestinationAddressBytes, + topology: Arc, +} + +async fn accept_connection( + mut socket: tokio::net::TcpStream, + msg_input: mpsc::UnboundedSender, + msg_query: mpsc::UnboundedSender, + self_address: DestinationAddressBytes, + topology: Topology, +) { + let address = socket + .peer_addr() + .expect("connected streams should have a peer address"); + println!("Peer address: {}", address); + + let topology = Arc::new(topology); + + let mut buf = [0u8; 2048]; + + // In a loop, read data from the socket and write the data back. + loop { + // TODO: shutdowns? + + let response = match socket.read(&mut buf).await { + // socket closed + Ok(n) if n == 0 => { + println!("Remote connection closed."); + return; + } + Ok(n) => { + let request_handling_data = RequestHandlingData { + topology: topology.clone(), + msg_input: msg_input.clone(), + msg_query: msg_query.clone(), + self_address: self_address.clone(), + }; + match handle_connection(&buf[..n], request_handling_data).await { + Ok(res) => res, + Err(e) => ServerResponse::new_error(format!("{:?}", e)) + } + } + Err(e) => { + eprintln!("failed to read from socket; err = {:?}", e); + return; + } + }; + + let response_vec: Vec = response.into(); + if let Err(e) = socket.write_all(&response_vec).await { + eprintln!("failed to write reply to socket; err = {:?}", e); + return; + } + } +} + +pub async fn start_tcpsocket( + address: SocketAddr, + message_tx: mpsc::UnboundedSender, + received_messages_query_tx: mpsc::UnboundedSender, + self_address: DestinationAddressBytes, + topology: Topology, +) -> Result<(), TCPSocketError> { + let mut listener = tokio::net::TcpListener::bind(address).await?; + + while let Ok((stream, _)) = listener.accept().await { + // it's fine to be cloning the channel on all new connection, because in principle + // this server should only EVER have a single client connected + tokio::spawn(accept_connection( + stream, + message_tx.clone(), + received_messages_query_tx.clone(), + self_address, + topology.clone(), + )); + } + + eprintln!("The tcpsocket went kaput..."); + Ok(()) +} \ No newline at end of file diff --git a/src/sockets/ws.rs b/src/sockets/ws.rs new file mode 100644 index 0000000000..4b211feb0e --- /dev/null +++ b/src/sockets/ws.rs @@ -0,0 +1,260 @@ +use crate::clients::directory::presence::Topology; +use crate::clients::BufferResponse; +use crate::clients::InputMessage; +use futures::channel::mpsc::{UnboundedReceiver, UnboundedSender}; +use futures::channel::{mpsc, oneshot}; +use futures::future::FutureExt; +use futures::io::Error; +use futures::{SinkExt, StreamExt}; +use serde::{Deserialize, Serialize}; +use sphinx::route::{Destination, DestinationAddressBytes}; +use std::io; +use std::net::SocketAddr; +use tungstenite::protocol::Message; + +struct Connection { + address: SocketAddr, + msg_input: mpsc::UnboundedSender, + msg_query: mpsc::UnboundedSender, + rx: UnboundedReceiver, + self_address: DestinationAddressBytes, + topology: Topology, + tx: UnboundedSender, +} + +#[derive(Debug)] +pub enum WebSocketError { + FailedToStartSocketError, + UnknownSocketError, +} + +impl From for WebSocketError { + fn from(err: Error) -> Self { + use WebSocketError::*; + match err.kind() { + io::ErrorKind::ConnectionRefused => FailedToStartSocketError, + io::ErrorKind::ConnectionReset => FailedToStartSocketError, + io::ErrorKind::ConnectionAborted => FailedToStartSocketError, + io::ErrorKind::NotConnected => FailedToStartSocketError, + + io::ErrorKind::AddrInUse => FailedToStartSocketError, + io::ErrorKind::AddrNotAvailable => FailedToStartSocketError, + _ => UnknownSocketError, + } + } +} + +#[derive(Serialize, Deserialize, Debug)] +#[serde(tag = "type", rename_all = "camelCase")] +enum ClientRequest { + Send { + message: String, + recipient_address: String, + }, + Fetch, + GetClients, + OwnDetails, +} + +impl From for ClientRequest { + fn from(msg: Message) -> Self { + let text_msg = match msg { + Message::Text(msg) => msg, + Message::Binary(_) => panic!("binary messages are not supported!"), + Message::Close(_) => panic!("todo: handle close!"), + _ => panic!("Other types of messages are also unsupported!"), + }; + serde_json::from_str(&text_msg).unwrap() + } +} + +impl ClientRequest { + async fn handle_send( + msg: String, + recipient_address: String, + mut input_tx: mpsc::UnboundedSender, + ) -> ServerResponse { + let address_vec = match base64::decode_config(&recipient_address, base64::URL_SAFE) { + Err(e) => { + return ServerResponse::Error { + message: e.to_string(), + } + } + Ok(hex) => hex, + }; + + if address_vec.len() != 32 { + return ServerResponse::Error { + message: "InvalidDestinationLength".to_string(), + }; + } + + let mut address = [0; 32]; + address.copy_from_slice(&address_vec); + + let dummy_surb = [0; 16]; + + let input_msg = InputMessage(Destination::new(address, dummy_surb), msg.into_bytes()); + + println!("ALMOST ABOUT TO SOMEDAY SEND {:?}", input_msg); + input_tx.send(input_msg).await.unwrap(); + + ServerResponse::Send + } + + async fn handle_fetch(mut msg_query: mpsc::UnboundedSender) -> ServerResponse { + let (res_tx, res_rx) = oneshot::channel(); + if msg_query.send(res_tx).await.is_err() { + return ServerResponse::Error { + message: "Server failed to receive messages".to_string(), + }; + } + + let messages = res_rx.map(|msg| msg).await; + + if messages.is_err() { + return ServerResponse::Error { + message: "Server failed to receive messages".to_string(), + }; + } + + let messages = messages.unwrap(); + let messages_as_b64 = messages + .iter() + .map(|message| base64::encode_config(message, base64::URL_SAFE)) + .collect(); + ServerResponse::Fetch { + messages: messages_as_b64, + } + } + + async fn handle_get_clients(topology: Topology) -> ServerResponse { + let clients = topology + .mix_provider_nodes + .into_iter() + .flat_map(|provider| provider.registered_clients.into_iter()) + .map(|client| client.pub_key) + .collect(); + ServerResponse::GetClients { clients } + } + + async fn handle_own_details(self_address_bytes: DestinationAddressBytes) -> ServerResponse { + let self_address = base64::encode_config(&self_address_bytes, base64::URL_SAFE); + ServerResponse::OwnDetails { + address: self_address, + } + } +} + +#[derive(Serialize, Deserialize, Debug)] +#[serde(tag = "type", rename_all = "camelCase")] +enum ServerResponse { + Send, + Fetch { messages: Vec }, + GetClients { clients: Vec }, + OwnDetails { address: String }, + Error { message: String }, +} + +impl Into for ServerResponse { + fn into(self) -> Message { + let str_res = serde_json::to_string(&self).unwrap(); + Message::Text(str_res) + } +} + +async fn handle_connection(conn: Connection) { + let mut conn = conn; + while let Some(msg) = conn.rx.next().await { + println!("Received a message from {}: {}", conn.address, msg); + let request: ClientRequest = msg.into(); + + let response = match request { + ClientRequest::Send { + message, + recipient_address, + } => { + ClientRequest::handle_send(message, recipient_address, conn.msg_input.clone()).await + } + ClientRequest::Fetch => ClientRequest::handle_fetch(conn.msg_query.clone()).await, + ClientRequest::GetClients => { + ClientRequest::handle_get_clients(conn.topology.clone()).await + } + ClientRequest::OwnDetails => ClientRequest::handle_own_details(conn.self_address).await, + }; + + conn.tx + .unbounded_send(response.into()) + .expect("Failed to forward message"); + } +} + +async fn accept_connection( + stream: tokio::net::TcpStream, + msg_input: mpsc::UnboundedSender, + msg_query: mpsc::UnboundedSender, + self_address: DestinationAddressBytes, + topology: Topology, +) { + let address = stream + .peer_addr() + .expect("connected streams should have a peer address"); + println!("Peer address: {}", address); + + let mut ws_stream = tokio_tungstenite::accept_async(stream) + .await + .expect("Error during the websocket handshake occurred"); + + println!("New WebSocket connection: {}", address); + + // Create a channel for our stream, which other sockets will use to + // send us messages. Then register our address with the stream to send + // data to us. + let (msg_tx, msg_rx) = futures::channel::mpsc::unbounded(); + let (response_tx, mut response_rx) = futures::channel::mpsc::unbounded(); + let conn = Connection { + address, + rx: msg_rx, + tx: response_tx, + topology, + msg_input, + msg_query, + self_address, + }; + tokio::spawn(handle_connection(conn)); + + while let Some(message) = ws_stream.next().await { + let message = message.expect("Failed to get request"); + msg_tx + .unbounded_send(message) + .expect("Failed to forward request"); + if let Some(resp) = response_rx.next().await { + ws_stream.send(resp).await.expect("Failed to send response"); + } + } +} + +pub async fn start_websocket( + address: SocketAddr, + message_tx: mpsc::UnboundedSender, + received_messages_query_tx: mpsc::UnboundedSender, + self_address: DestinationAddressBytes, + topology: Topology, +) -> Result<(), WebSocketError> { + let mut listener = tokio::net::TcpListener::bind(address).await?; + + while let Ok((stream, _)) = listener.accept().await { + // it's fine to be cloning the channel on all new connection, because in principle + // this server should only EVER have a single client connected + tokio::spawn(accept_connection( + stream, + message_tx.clone(), + received_messages_query_tx.clone(), + self_address, + topology.clone(), + )); + } + + eprintln!("The websocket went kaput..."); + Ok(()) +} diff --git a/src/utils/addressing.rs b/src/utils/addressing.rs new file mode 100644 index 0000000000..a2660471f4 --- /dev/null +++ b/src/utils/addressing.rs @@ -0,0 +1,80 @@ +use std::convert::{TryFrom, TryInto}; +use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr}; + +pub enum AddressType { + V4, + V6, +} + +impl Into for AddressType { + fn into(self) -> u8 { + use AddressType::*; + + match self { + V4 => 4, + V6 => 6, + } + } +} + +#[derive(Debug)] +pub enum AddressTypeError { + InvalidPrefixError, +} + +impl TryFrom for AddressType { + type Error = AddressTypeError; + + fn try_from(value: u8) -> Result { + use AddressType::*; + use AddressTypeError::*; + + match value { + 4 => Ok(V4), + 6 => Ok(V6), + _ => Err(InvalidPrefixError), + } + } +} + +/// FLAG || port || octets || zeropad +pub fn encoded_bytes_from_socket_address(address: SocketAddr) -> [u8; 32] { + let port_bytes = address.port().to_be_bytes(); + + let encoded_host: Vec = match address.ip() { + IpAddr::V4(ip) => std::iter::once(AddressType::V4.into()) + .chain(port_bytes.iter().cloned()) + .chain(ip.octets().iter().cloned()) + .chain(std::iter::repeat(0)) + .take(32) + .collect(), + IpAddr::V6(ip) => std::iter::once(AddressType::V6.into()) + .chain(port_bytes.iter().cloned()) + .chain(ip.octets().iter().cloned()) + .chain(std::iter::repeat(0)) + .take(32) + .collect(), + }; + + let mut address_bytes = [0u8; 32]; + address_bytes.copy_from_slice(&encoded_host[..32]); + + address_bytes +} + +pub fn socket_address_from_encoded_bytes(b: [u8; 32]) -> SocketAddr { + let address_type: AddressType = b[0].try_into().unwrap(); + + let port: u16 = u16::from_be_bytes([b[1], b[2]]); + + let ip = match address_type { + AddressType::V4 => IpAddr::V4(Ipv4Addr::new(b[3], b[4], b[5], b[6])), + AddressType::V6 => { + let mut address_octets = [0u8; 16]; + address_octets.copy_from_slice(&b[3..19]); + IpAddr::V6(Ipv6Addr::from(address_octets)) + } + }; + + SocketAddr::new(ip, port) +} diff --git a/src/utils/bytes.rs b/src/utils/bytes.rs new file mode 100644 index 0000000000..6079fa8385 --- /dev/null +++ b/src/utils/bytes.rs @@ -0,0 +1,63 @@ +pub fn zero_pad_to_32(mut bytes: Vec) -> [u8; 32] { + assert!(bytes.len() <= 32); + if bytes.len() != 32 { + bytes.resize(32, 0); + } + let mut padded_bytes = [0; 32]; + padded_bytes.copy_from_slice(&bytes[..]); + padded_bytes +} + +#[cfg(test)] +mod zero_padding_to_32_bytes { + use super::*; + + #[cfg(test)] + mod with_empty_input { + use super::*; + + #[test] + fn it_returns_32_zeros() { + let input = vec![]; + let result = zero_pad_to_32(input); + assert_eq!([0u8; 32], result); + } + } + + #[cfg(test)] + mod with_all_bytes_set_to_1 { + use super::*; + #[test] + fn it_returns_32_ones() { + let input = vec![1u8; 32]; + let result = zero_pad_to_32(input); + assert_eq!([1u8; 32], result); + } + } + + #[cfg(test)] + mod with_3_bytes_set { + use super::*; + #[test] + fn it_returns_input_zero_padded_to_32_bytes() { + let input = vec![1u8; 3]; + let result = zero_pad_to_32(input); + let expected_content = vec![ + 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, + ]; + assert_eq!(expected_content, result.to_vec()); + } + } + + #[cfg(test)] + mod with_oversized_input { + use super::*; + #[test] + #[should_panic] + fn it_panics() { + let input = vec![1u8; 33]; + zero_pad_to_32(input); + } + } +} diff --git a/src/utils/mod.rs b/src/utils/mod.rs new file mode 100644 index 0000000000..5e6fb07681 --- /dev/null +++ b/src/utils/mod.rs @@ -0,0 +1,5 @@ +pub mod addressing; +pub mod bytes; +pub mod poisson; +pub mod sphinx; +pub mod topology; diff --git a/src/utils/poisson.rs b/src/utils/poisson.rs new file mode 100644 index 0000000000..d4991f0dd8 --- /dev/null +++ b/src/utils/poisson.rs @@ -0,0 +1,6 @@ +use rand_distr::{Distribution, Exp}; + +pub fn sample(average_delay: f64) -> f64 { + let exp = Exp::new(1.0 / average_delay).unwrap(); + exp.sample(&mut rand::thread_rng()) +} diff --git a/src/utils/sphinx.rs b/src/utils/sphinx.rs new file mode 100644 index 0000000000..234df40448 --- /dev/null +++ b/src/utils/sphinx.rs @@ -0,0 +1,48 @@ +use crate::clients::directory::presence::Topology; +use crate::utils::{addressing, bytes, topology}; +use curve25519_dalek::montgomery::MontgomeryPoint; +use sphinx::route::{Destination, DestinationAddressBytes, Node, NodeAddressBytes, SURBIdentifier}; +use sphinx::SphinxPacket; +use std::net::SocketAddr; + +pub const LOOP_COVER_MESSAGE_PAYLOAD: &[u8] = b"The cake is a lie!"; + +pub fn loop_cover_message( + our_address: DestinationAddressBytes, + surb_id: SURBIdentifier, + topology: &Topology, +) -> (SocketAddr, SphinxPacket) { + let destination = Destination::new(our_address, surb_id); + + encapsulate_message(destination, LOOP_COVER_MESSAGE_PAYLOAD.to_vec(), topology) +} + +pub fn encapsulate_message( + recipient: Destination, + message: Vec, + topology: &Topology, +) -> (SocketAddr, SphinxPacket) { + let mixes_route = topology::route_from(&topology); + let first_provider = topology.mix_provider_nodes.first().unwrap(); + let decoded_key_bytes = + base64::decode_config(&first_provider.pub_key, base64::URL_SAFE).unwrap(); + let key_bytes = bytes::zero_pad_to_32(decoded_key_bytes); + let key = MontgomeryPoint(key_bytes); + + let provider = Node::new( + addressing::encoded_bytes_from_socket_address(first_provider.host.clone().parse().unwrap()), + key, + ); + + let route = [mixes_route, vec![provider]].concat(); + + let delays = sphinx::header::delays::generate(route.len()); + + // build the packet + let packet = sphinx::SphinxPacket::new(message, &route[..], &recipient, &delays).unwrap(); + + let first_node_address = + addressing::socket_address_from_encoded_bytes(route.first().unwrap().address); + + (first_node_address, packet) +} diff --git a/src/utils/topology.rs b/src/utils/topology.rs new file mode 100644 index 0000000000..5e11de7aa7 --- /dev/null +++ b/src/utils/topology.rs @@ -0,0 +1,58 @@ +use crate::clients::directory; +use crate::clients::directory::presence::MixNodePresence; +use crate::clients::directory::presence::Topology; +use crate::clients::directory::requests::presence_topology_get::PresenceTopologyGetRequester; +use crate::clients::directory::DirectoryClient; +use crate::utils::{addressing, bytes}; +use curve25519_dalek::montgomery::MontgomeryPoint; +use rand::seq::SliceRandom; +use sphinx::route::Node as SphinxNode; +use std::collections::HashMap; +use std::net::SocketAddr; + +pub(crate) fn get_topology(directory_server: String) -> Topology { + println!("Using directory server: {:?}", directory_server); + let directory_config = directory::Config { + base_url: directory_server, + }; + let directory = directory::Client::new(directory_config); + + let topology = directory + .presence_topology + .get() + .expect("Failed to retrieve network topology."); + topology +} + +pub(crate) fn route_from(topology: &Topology) -> Vec { + let mut layered_topology: HashMap> = HashMap::new(); + let mixes = topology.mix_nodes.iter(); + for mix in mixes { + let layer_nodes = layered_topology.entry(mix.layer).or_insert(Vec::new()); + layer_nodes.push(mix.clone()); + } + + let num_layers = layered_topology.len() as u64; + let mut route = vec![]; + + for x in 1..=num_layers { + let nodes = &layered_topology[&x]; + let the_node = nodes.choose(&mut rand::thread_rng()).unwrap(); + route.push(the_node); + } + + route + .iter() + .map(|mix| { + let address_bytes = + addressing::encoded_bytes_from_socket_address(mix.host.clone().parse().unwrap()); + let decoded_key_bytes = base64::decode_config(&mix.pub_key, base64::URL_SAFE).unwrap(); + let key_bytes = bytes::zero_pad_to_32(decoded_key_bytes); + let key = MontgomeryPoint(key_bytes); + SphinxNode { + address: address_bytes, + pub_key: key, + } + }) + .collect() +} diff --git a/src/validator.rs b/src/validator.rs deleted file mode 100644 index e69de29bb2..0000000000