diff --git a/Cargo.lock b/Cargo.lock index 8b16138c7c..2c8b06bec4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -120,7 +120,16 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3670df70cbc01729f901f94c887814b3c68db038aad1329a418bae178bc5295c" dependencies = [ - "async-stream-impl", + "async-stream-impl 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core", +] + +[[package]] +name = "async-stream" +version = "0.3.0" +source = "git+https://github.com/SergioBenitez/async-stream.git?rev=c46ada9#c46ada948e0d4800393836f57eb2a3db516beb1e" +dependencies = [ + "async-stream-impl 0.3.0 (git+https://github.com/SergioBenitez/async-stream.git?rev=c46ada9)", "futures-core", ] @@ -135,6 +144,36 @@ dependencies = [ "syn", ] +[[package]] +name = "async-stream-impl" +version = "0.3.0" +source = "git+https://github.com/SergioBenitez/async-stream.git?rev=c46ada9#c46ada948e0d4800393836f57eb2a3db516beb1e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "async-trait" +version = "0.1.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b98e84bbb4cbcdd97da190ba0c58a1bb0de2c1fdf67d159e192ed766aeca722" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "atomic" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3410529e8288c463bedb5930f82833bc0c90e5d2fe639a56582a4d09220b281" +dependencies = [ + "autocfg", +] + [[package]] name = "atty" version = "0.2.14" @@ -152,6 +191,12 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +[[package]] +name = "base-x" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b" + [[package]] name = "base64" version = "0.12.3" @@ -164,6 +209,12 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +[[package]] +name = "binascii" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "383d29d513d8764dcdc42ea295d979eb99c3c9f00607b3692cf68a431f7dca72" + [[package]] name = "bitflags" version = "1.2.1" @@ -405,12 +456,35 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "const_fn" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "402da840495de3f976eaefc3485b7f5eb5b0bf9761f9a47be27fe975b3b8c2ec" + [[package]] name = "constant_time_eq" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + +[[package]] +name = "cookie" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdf8865bac3d9a3bde5bde9088ca431b11f5d37c7a578b8086af77248b76627" +dependencies = [ + "percent-encoding", + "time", + "version_check", +] + [[package]] name = "core-foundation" version = "0.9.1" @@ -583,6 +657,48 @@ dependencies = [ "num_cpus", ] +[[package]] +name = "derive_more" +version = "0.99.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f82b1b72f1263f214c0f823371768776c4f5841b942c9883aa8e5ec584fd0ba6" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "devise" +version = "0.3.0" +source = "git+https://github.com/SergioBenitez/Devise.git?rev=df00b5#df00b5162edd53e8d496e7935774e69b5f7f6bdf" +dependencies = [ + "devise_codegen", + "devise_core", +] + +[[package]] +name = "devise_codegen" +version = "0.3.0" +source = "git+https://github.com/SergioBenitez/Devise.git?rev=df00b5#df00b5162edd53e8d496e7935774e69b5f7f6bdf" +dependencies = [ + "devise_core", + "quote", +] + +[[package]] +name = "devise_core" +version = "0.3.0" +source = "git+https://github.com/SergioBenitez/Devise.git?rev=df00b5#df00b5162edd53e8d496e7935774e69b5f7f6bdf" +dependencies = [ + "bitflags", + "proc-macro2", + "proc-macro2-diagnostics", + "quote", + "syn", +] + [[package]] name = "difference" version = "2.0.0" @@ -627,6 +743,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "discard" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" + [[package]] name = "doc-comment" version = "0.3.3" @@ -662,6 +784,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "either" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" + [[package]] name = "encoding_rs" version = "0.8.24" @@ -690,6 +818,20 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" +[[package]] +name = "figment" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ca029e813a72b7526d28273d25f3e4a2f365d1b7a1018a6f93ec9053a119763" +dependencies = [ + "atomic", + "pear", + "serde", + "toml", + "uncased", + "version_check", +] + [[package]] name = "fnv" version = "1.0.7" @@ -871,6 +1013,19 @@ dependencies = [ "tungstenite", ] +[[package]] +name = "generator" +version = "0.6.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "061d3be1afec479d56fa3bd182bf966c7999ec175fcfdb87ac14d417241366c6" +dependencies = [ + "cc", + "libc", + "log", + "rustversion", + "winapi", +] + [[package]] name = "generic-array" version = "0.12.3" @@ -915,6 +1070,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "glob" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" + [[package]] name = "h2" version = "0.3.1" @@ -1036,15 +1197,15 @@ dependencies = [ [[package]] name = "httparse" -version = "1.3.4" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" +checksum = "4a1ce40d6fc9764887c2fdc7305c3dcc429ba11ff981c1509416afd5697e4437" [[package]] name = "httpdate" -version = "0.3.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" +checksum = "05842d0d43232b23ccb7060ecb0f0626922c21f30012e97b767b30afd4a5d4b9" [[package]] name = "humantime" @@ -1073,9 +1234,9 @@ dependencies = [ [[package]] name = "hyper" -version = "0.14.4" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8e946c2b1349055e0b72ae281b238baf1a3ea7307c7e9f9d64673bdd9c26ac7" +checksum = "1e5f105c494081baa3bf9e200b279e27ec1623895cd504c7dbef8d0b080fcf54" dependencies = [ "bytes 1.0.1", "futures-channel", @@ -1088,7 +1249,7 @@ dependencies = [ "httpdate", "itoa", "pin-project", - "socket2", + "socket2 0.4.0", "tokio", "tower-service", "tracing", @@ -1127,8 +1288,15 @@ checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2" dependencies = [ "autocfg", "hashbrown", + "serde", ] +[[package]] +name = "inlinable_string" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3094308123a0e9fd59659ce45e22de9f53fc1d2ac6e1feb9fef988e4f76cad77" + [[package]] name = "input_buffer" version = "0.4.0" @@ -1167,9 +1335,9 @@ checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" [[package]] name = "js-sys" -version = "0.3.48" +version = "0.3.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc9f84f9b115ce7843d60706df1422a916680bfdfcbdb0447c5614ff9d7e4d78" +checksum = "83bdfbace3a0e81a4253f73b49e960b053e396a11012cbd49b9b74d6a2b67062" dependencies = [ "wasm-bindgen", ] @@ -1228,6 +1396,19 @@ dependencies = [ "cfg-if 0.1.10", ] +[[package]] +name = "loom" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0e8460f2f2121162705187214720353c517b97bdfb3494c0b1e33d83ebe4bed" +dependencies = [ + "cfg-if 0.1.10", + "generator", + "scoped-tls", + "serde", + "serde_json", +] + [[package]] name = "maplit" version = "1.0.2" @@ -1302,7 +1483,7 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a33c1b55807fbed163481b5ba66db4b2fa6cde694a5027be10fb724206c5897" dependencies = [ - "socket2", + "socket2 0.3.19", "winapi", ] @@ -1361,6 +1542,25 @@ dependencies = [ "serde_urlencoded", ] +[[package]] +name = "multer" +version = "1.2.2" +source = "git+https://github.com/rousan/multer-rs.git?rev=7e4f0c5f#7e4f0c5fe14e4c531f503922bfe04f68b32ddf17" +dependencies = [ + "bytes 1.0.1", + "derive_more", + "encoding_rs", + "futures-util", + "http", + "httparse", + "log", + "mime", + "tokio", + "tokio-util", + "twoway", + "version_check", +] + [[package]] name = "native-tls" version = "0.2.7" @@ -1500,7 +1700,7 @@ dependencies = [ [[package]] name = "nym-mixnode" -version = "0.10.0" +version = "0.10.1-dev" dependencies = [ "bs58 0.4.0", "clap", @@ -1520,6 +1720,8 @@ dependencies = [ "pemstore", "pretty_env_logger", "rand 0.7.3", + "rocket", + "rocket_contrib", "serde", "tokio", "tokio-util", @@ -1803,6 +2005,29 @@ dependencies = [ "winapi", ] +[[package]] +name = "pear" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86ab3a2b792945ed67eadbbdcbd2898f8dd2319392b2a45ac21adea5245cb113" +dependencies = [ + "inlinable_string", + "pear_codegen", + "yansi", +] + +[[package]] +name = "pear_codegen" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "620c9c4776ba41b59ab101360c9b1419c0c8c81cd2e6e39fae7109e7425994cb" +dependencies = [ + "proc-macro2", + "proc-macro2-diagnostics", + "quote", + "syn", +] + [[package]] name = "pem" version = "0.8.3" @@ -1938,13 +2163,26 @@ checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" [[package]] name = "proc-macro2" -version = "1.0.24" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec" dependencies = [ "unicode-xid", ] +[[package]] +name = "proc-macro2-diagnostics" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bf29726d67464d49fa6224a1d07936a8c08bb3fba727c7493f6cf1616fdaada" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "version_check", + "yansi", +] + [[package]] name = "proxy-helpers" version = "0.1.0" @@ -2108,6 +2346,26 @@ dependencies = [ "rust-argon2", ] +[[package]] +name = "ref-cast" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300f2a835d808734ee295d45007adacb9ebb29dd3ae2424acfa17930cae541da" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c38e3aecd2b21cb3959637b883bb3714bc7e43f0268b9a29d3743ee3e55cdd2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "regex" version = "1.3.9" @@ -2137,9 +2395,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf12057f289428dbf5c591c74bf10392e4a8003f993405a902f20117019022d4" +checksum = "2296f2fac53979e8ccbc4a1136b25dcefd37be9ed7e4a1f6b05a6029c84ff124" dependencies = [ "base64 0.13.0", "bytes 1.0.1", @@ -2170,6 +2428,94 @@ dependencies = [ "winreg", ] +[[package]] +name = "rocket" +version = "0.5.0-dev" +source = "git+https://github.com/SergioBenitez/Rocket?rev=f442ad93cb2788bfd08aca5d94e509db20888101#f442ad93cb2788bfd08aca5d94e509db20888101" +dependencies = [ + "async-stream 0.3.0 (git+https://github.com/SergioBenitez/async-stream.git?rev=c46ada9)", + "async-trait", + "atomic", + "atty", + "binascii", + "bytes 1.0.1", + "either", + "figment", + "futures", + "indexmap", + "log", + "memchr", + "multer", + "num_cpus", + "parking_lot", + "pin-project-lite", + "rand 0.8.3", + "ref-cast", + "rocket_codegen", + "rocket_http", + "serde", + "state", + "tempfile", + "time", + "tokio", + "tokio-util", + "ubyte", + "version_check", + "yansi", +] + +[[package]] +name = "rocket_codegen" +version = "0.5.0-dev" +source = "git+https://github.com/SergioBenitez/Rocket?rev=f442ad93cb2788bfd08aca5d94e509db20888101#f442ad93cb2788bfd08aca5d94e509db20888101" +dependencies = [ + "devise", + "glob", + "indexmap", + "quote", + "rocket_http", + "unicode-xid", +] + +[[package]] +name = "rocket_contrib" +version = "0.5.0-dev" +source = "git+https://github.com/SergioBenitez/Rocket?rev=f442ad93cb2788bfd08aca5d94e509db20888101#f442ad93cb2788bfd08aca5d94e509db20888101" +dependencies = [ + "log", + "rocket", + "serde", + "serde_json", + "tokio", +] + +[[package]] +name = "rocket_http" +version = "0.5.0-dev" +source = "git+https://github.com/SergioBenitez/Rocket?rev=f442ad93cb2788bfd08aca5d94e509db20888101#f442ad93cb2788bfd08aca5d94e509db20888101" +dependencies = [ + "cookie", + "either", + "http", + "hyper", + "indexmap", + "log", + "memchr", + "mime", + "parking_lot", + "pear", + "percent-encoding", + "pin-project-lite", + "ref-cast", + "serde", + "smallvec", + "stable-pattern", + "state", + "time", + "tokio", + "uncased", +] + [[package]] name = "rust-argon2" version = "0.8.2" @@ -2182,6 +2528,21 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver 0.9.0", +] + +[[package]] +name = "rustversion" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb5d2a036dc6d2d8fd16fde3498b04306e29bd193bf306a57427019b823d5acd" + [[package]] name = "ryu" version = "1.0.5" @@ -2256,15 +2617,30 @@ dependencies = [ "libc", ] +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser 0.7.0", +] + [[package]] name = "semver" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" dependencies = [ - "semver-parser", + "semver-parser 0.10.2", ] +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + [[package]] name = "semver-parser" version = "0.10.2" @@ -2362,6 +2738,12 @@ dependencies = [ "opaque-debug 0.3.0", ] +[[package]] +name = "sha1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" + [[package]] name = "sha2" version = "0.8.2" @@ -2463,6 +2845,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "socket2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e3dfc207c526015c632472a77be09cf1b6e46866581aecae5cc38fb4235dea2" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "socks5-requests" version = "0.1.0" @@ -2492,6 +2884,81 @@ dependencies = [ "sha2 0.8.2", ] +[[package]] +name = "stable-pattern" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4564168c00635f88eaed410d5efa8131afa8d8699a612c80c455a0ba05c21045" +dependencies = [ + "memchr", +] + +[[package]] +name = "standback" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e113fb6f3de07a243d434a56ec6f186dfd51cb08448239fe7bcae73f87ff28ff" +dependencies = [ + "version_check", +] + +[[package]] +name = "state" +version = "0.4.2" +source = "git+https://github.com/SergioBenitez/state.git?rev=8f94dc#8f94dce673b7d4b0e7b96c808a84f5e2a4be4a60" +dependencies = [ + "loom", +] + +[[package]] +name = "stdweb" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" +dependencies = [ + "discard", + "rustc_version", + "stdweb-derive", + "stdweb-internal-macros", + "stdweb-internal-runtime", + "wasm-bindgen", +] + +[[package]] +name = "stdweb-derive" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "serde_derive", + "syn", +] + +[[package]] +name = "stdweb-internal-macros" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" +dependencies = [ + "base-x", + "proc-macro2", + "quote", + "serde", + "serde_derive", + "serde_json", + "sha1", + "syn", +] + +[[package]] +name = "stdweb-internal-runtime" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" + [[package]] name = "stream-cipher" version = "0.3.2" @@ -2521,9 +2988,9 @@ checksum = "502d53007c02d7605a05df1c1a73ee436952781653da5d0bf57ad608f66932c1" [[package]] name = "syn" -version = "1.0.58" +version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc60a3d73ea6594cd712d830cc1f0390fd71542d8c8cd24e70cc54cdfd5e05d5" +checksum = "a1e8cdbefb79a9a5a65e0db8b47b723ee907b7c7f8496c76a1770b5c310bab82" dependencies = [ "proc-macro2", "quote", @@ -2603,6 +3070,44 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "time" +version = "0.2.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08a8cbfbf47955132d0202d1662f49b2423ae35862aee471f3ba4b133358f372" +dependencies = [ + "const_fn", + "libc", + "standback", + "stdweb", + "time-macros", + "version_check", + "winapi", +] + +[[package]] +name = "time-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1" +dependencies = [ + "proc-macro-hack", + "time-macros-impl", +] + +[[package]] +name = "time-macros-impl" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5c3be1edfad6027c69f5491cf4cb310d1a71ecd6af742788c6ff8bced86b8fa" +dependencies = [ + "proc-macro-hack", + "proc-macro2", + "quote", + "standback", + "syn", +] + [[package]] name = "tinyvec" version = "1.1.1" @@ -2675,7 +3180,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f58403903e94d4bc56805e46597fced893410b2e753e229d3f7f22423ea03f67" dependencies = [ - "async-stream", + "async-stream 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 1.0.1", "futures-core", "tokio", @@ -2785,18 +3290,53 @@ dependencies = [ "utf-8", ] +[[package]] +name = "twoway" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b40075910de3a912adbd80b5d8bad6ad10a23eeb1f5bf9d4006839e899ba5bc" +dependencies = [ + "memchr", + "unchecked-index", +] + [[package]] name = "typenum" version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" +[[package]] +name = "ubyte" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42756bb9e708855de2f8a98195643dff31a97f0485d90d8467b39dc24be9e8fe" +dependencies = [ + "serde", +] + [[package]] name = "ucd-trie" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" +[[package]] +name = "uncased" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baeed7327e25054889b9bd4f975f32e5f4c5d434042d59ab6cd4142c0a76ed0" +dependencies = [ + "serde", + "version_check", +] + +[[package]] +name = "unchecked-index" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeba86d422ce181a719445e51872fa30f1f7413b62becb52e95ec91aa262d85c" + [[package]] name = "unicode-bidi" version = "0.3.4" @@ -2887,7 +3427,7 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" name = "version-checker" version = "0.1.0" dependencies = [ - "semver", + "semver 0.11.0", ] [[package]] @@ -2920,9 +3460,9 @@ checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" [[package]] name = "wasm-bindgen" -version = "0.2.71" +version = "0.2.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee1280240b7c461d6a0071313e08f34a60b0365f14260362e5a2b17d1d31aa7" +checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd" dependencies = [ "cfg-if 1.0.0", "serde", @@ -2932,9 +3472,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.71" +version = "0.2.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b7d8b6942b8bb3a9b0e73fc79b98095a27de6fa247615e59d096754a3bc2aa8" +checksum = "3b33f6a0694ccfea53d94db8b2ed1c3a8a4c86dd936b13b9f0a15ec4a451b900" dependencies = [ "bumpalo", "lazy_static", @@ -2959,9 +3499,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.71" +version = "0.2.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ac38da8ef716661f0f36c0d8320b89028efe10c7c0afde65baffb496ce0d3b" +checksum = "088169ca61430fe1e58b8096c24975251700e7b1f6fd91cc9d59b04fb9b18bd4" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2969,9 +3509,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.71" +version = "0.2.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc053ec74d454df287b9374ee8abb36ffd5acb95ba87da3ba5b7d3fe20eb401e" +checksum = "be2241542ff3d9f241f5e2cb6dd09b37efe786df8851c54957683a49f0987a97" dependencies = [ "proc-macro2", "quote", @@ -2982,9 +3522,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.71" +version = "0.2.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d6f8ec44822dd71f5f221a5847fb34acd9060535c1211b70a05844c0f6383b1" +checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f" [[package]] name = "wasm-bindgen-test" @@ -3119,6 +3659,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "yansi" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fc79f4a1e39857fc00c3f662cbf2651c771f00e9c15fe2abc341806bd46bd71" + [[package]] name = "zeroize" version = "1.1.0" diff --git a/clients/native/src/commands/upgrade.rs b/clients/native/src/commands/upgrade.rs index 3a55f2de6d..baf8afbf5a 100644 --- a/clients/native/src/commands/upgrade.rs +++ b/clients/native/src/commands/upgrade.rs @@ -100,12 +100,12 @@ fn parse_package_version() -> Version { fn pre_090_upgrade(from: &str, mut config: Config) -> Config { // this is not extracted to separate function as you only have to manually pass version // if upgrading from pre090 version - let from = match from.strip_prefix("v") { + let from = match from.strip_prefix('v') { Some(stripped) => stripped, None => from, }; - let from = match from.strip_prefix("V") { + let from = match from.strip_prefix('V') { Some(stripped) => stripped, None => from, }; diff --git a/clients/socks5/src/commands/upgrade.rs b/clients/socks5/src/commands/upgrade.rs index ac535eb606..627d7ce4d1 100644 --- a/clients/socks5/src/commands/upgrade.rs +++ b/clients/socks5/src/commands/upgrade.rs @@ -100,12 +100,12 @@ fn parse_package_version() -> Version { fn pre_090_upgrade(from: &str, mut config: Config) -> Config { // this is not extracted to separate function as you only have to manually pass version // if upgrading from pre090 version - let from = match from.strip_prefix("v") { + let from = match from.strip_prefix('v') { Some(stripped) => stripped, None => from, }; - let from = match from.strip_prefix("V") { + let from = match from.strip_prefix('V') { Some(stripped) => stripped, None => from, }; diff --git a/common/client-libs/metrics-client/Cargo.toml b/common/client-libs/metrics-client/Cargo.toml index 972182f9db..690832f8d4 100644 --- a/common/client-libs/metrics-client/Cargo.toml +++ b/common/client-libs/metrics-client/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" [dependencies] serde = { version = "1.0", features = ["derive"] } -reqwest = { version = "0.11", features = ["json"] } +reqwest = { version = "0.11.3", features = ["json"] } [dev-dependencies] mockito = "0.30" diff --git a/common/wasm-utils/Cargo.toml b/common/wasm-utils/Cargo.toml index 2b5dd88f43..01b6689524 100644 --- a/common/wasm-utils/Cargo.toml +++ b/common/wasm-utils/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" [dependencies] futures = "0.3" -js-sys = "0.3" +js-sys = "^0.3.51" wasm-bindgen = "0.2" wasm-bindgen-futures = "0.4" diff --git a/gateway/src/commands/upgrade.rs b/gateway/src/commands/upgrade.rs index ec891cccd2..6d232f5ead 100644 --- a/gateway/src/commands/upgrade.rs +++ b/gateway/src/commands/upgrade.rs @@ -89,12 +89,12 @@ fn parse_package_version() -> Version { fn pre_090_upgrade(from: &str, config: Config) -> Config { // this is not extracted to separate function as you only have to manually pass version // if upgrading from pre090 version - let from = match from.strip_prefix("v") { + let from = match from.strip_prefix('v') { Some(stripped) => stripped, None => from, }; - let from = match from.strip_prefix("V") { + let from = match from.strip_prefix('V') { Some(stripped) => stripped, None => from, }; diff --git a/gateway/src/config/mod.rs b/gateway/src/config/mod.rs index bd4973bdf7..1dad80b084 100644 --- a/gateway/src/config/mod.rs +++ b/gateway/src/config/mod.rs @@ -194,8 +194,7 @@ impl Config { // first let's see if we received host:port or just host part of an address let host = host.into(); - let split_host: Vec<_> = host.split(':').collect(); - match split_host.len() { + match host.split(':').count() { 1 => { // we provided only 'host' part so we are going to reuse existing port self.mixnet_endpoint.announce_address = @@ -277,8 +276,7 @@ impl Config { // first let's see if we received host:port or just host part of an address let host = host.into(); - let split_host: Vec<_> = host.split(':').collect(); - match split_host.len() { + match host.split(':').count() { 1 => { // we provided only 'host' part so we are going to reuse existing port self.clients_endpoint.announce_address = format!( diff --git a/mixnode/Cargo.toml b/mixnode/Cargo.toml index fbc3cc3516..055ae6824b 100644 --- a/mixnode/Cargo.toml +++ b/mixnode/Cargo.toml @@ -3,7 +3,7 @@ [package] name = "nym-mixnode" -version = "0.10.0" +version = "0.10.1-dev" authors = ["Dave Hrycyszyn ", "Jędrzej Stuczyński "] edition = "2018" @@ -20,6 +20,8 @@ humantime-serde = "1.0.1" log = "0.4" pretty_env_logger = "0.4" rand = "0.7" +rocket = { git = "https://github.com/SergioBenitez/Rocket", rev="f442ad93cb2788bfd08aca5d94e509db20888101" } +rocket_contrib = { git = "https://github.com/SergioBenitez/Rocket", rev="f442ad93cb2788bfd08aca5d94e509db20888101" } serde = { version = "1.0", features = ["derive"] } tokio = { version = "1.4", features = [ "rt-multi-thread", "net", "signal" ] } tokio-util = { version = "0.6", features = ["codec"] } diff --git a/mixnode/src/commands/init.rs b/mixnode/src/commands/init.rs index a9bdba7327..8643c23ebe 100644 --- a/mixnode/src/commands/init.rs +++ b/mixnode/src/commands/init.rs @@ -7,7 +7,7 @@ use crate::config::Config; use clap::{App, Arg, ArgMatches}; use config::NymConfig; use crypto::asymmetric::{encryption, identity}; -use log::*; +use log::debug; use nymsphinx::params::DEFAULT_NUM_MIX_HOPS; use std::collections::HashMap; use tokio::runtime::Runtime; diff --git a/mixnode/src/commands/run.rs b/mixnode/src/commands/run.rs index 7ba64f3cbf..144546abd8 100644 --- a/mixnode/src/commands/run.rs +++ b/mixnode/src/commands/run.rs @@ -7,7 +7,7 @@ use crate::node::MixNode; use clap::{App, Arg, ArgMatches}; use config::NymConfig; use crypto::asymmetric::{encryption, identity}; -use log::*; +use log::warn; use version_checker::is_minor_version_compatible; pub fn command_args<'a, 'b>() -> App<'a, 'b> { diff --git a/mixnode/src/commands/sign.rs b/mixnode/src/commands/sign.rs index 4ed3a4e033..de490bd80d 100644 --- a/mixnode/src/commands/sign.rs +++ b/mixnode/src/commands/sign.rs @@ -3,7 +3,7 @@ use clap::{App, Arg, ArgMatches}; use colored::*; use config::NymConfig; use crypto::asymmetric::identity; -use log::*; +use log::error; pub fn command_args<'a, 'b>() -> App<'a, 'b> { App::new("sign") diff --git a/mixnode/src/commands/upgrade.rs b/mixnode/src/commands/upgrade.rs index cbdc2a4374..9720099656 100644 --- a/mixnode/src/commands/upgrade.rs +++ b/mixnode/src/commands/upgrade.rs @@ -109,12 +109,12 @@ fn pre_090_upgrade(from: &str, config: Config) -> Config { // this is not extracted to separate function as you only have to manually pass version // if upgrading from pre090 version - let from = match from.strip_prefix("v") { + let from = match from.strip_prefix('v') { Some(stripped) => stripped, None => from, }; - let from = match from.strip_prefix("V") { + let from = match from.strip_prefix('V') { Some(stripped) => stripped, None => from, }; diff --git a/mixnode/src/config/mod.rs b/mixnode/src/config/mod.rs index c8882e1e46..5d11d26181 100644 --- a/mixnode/src/config/mod.rs +++ b/mixnode/src/config/mod.rs @@ -3,7 +3,7 @@ use crate::config::template::config_template; use config::{deserialize_duration, deserialize_validators, NymConfig}; -use log::*; +use log::error; use serde::{Deserialize, Serialize}; use std::net::{IpAddr, SocketAddr}; use std::path::PathBuf; @@ -185,8 +185,7 @@ impl Config { // first lets see if we received host:port or just host part of an address let host = host.into(); - let split_host: Vec<_> = host.split(':').collect(); - match split_host.len() { + match host.split(':').count() { 1 => { // we provided only 'host' part so we are going to reuse existing port self.mixnode.announce_address = diff --git a/mixnode/src/main.rs b/mixnode/src/main.rs index 3ae3ba5e81..1f3df39610 100644 --- a/mixnode/src/main.rs +++ b/mixnode/src/main.rs @@ -1,3 +1,6 @@ +#[macro_use] +extern crate rocket; + // Copyright 2020 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 diff --git a/mixnode/src/node/http/mod.rs b/mixnode/src/node/http/mod.rs new file mode 100644 index 0000000000..0639d38f32 --- /dev/null +++ b/mixnode/src/node/http/mod.rs @@ -0,0 +1 @@ +pub(crate) mod verloc; diff --git a/mixnode/src/node/http/verloc.rs b/mixnode/src/node/http/verloc.rs new file mode 100644 index 0000000000..067f6147bb --- /dev/null +++ b/mixnode/src/node/http/verloc.rs @@ -0,0 +1,28 @@ +use rocket_contrib::json::Json; +use serde::Serialize; + +/// Provides verifiable location (verloc) measurements for this mixnode - a list of the +/// round-trip times, in milliseconds, for all other mixnodes that this node knows about. +#[get("/verloc")] +pub(crate) fn verloc() -> Json> { + // replace the foomps with a reference to the measurements vec :) + let foomp1 = Foomp { + ip: "1.2.3.4".to_string(), + port: "1789".to_string(), + identity_key: "abc".to_string(), + }; + let foomp2 = Foomp { + ip: "2.3.4.5".to_string(), + port: "1789".to_string(), + identity_key: "def".to_string(), + }; + let foomps = vec![foomp1, foomp2]; + Json(foomps) +} + +#[derive(Serialize)] +pub(crate) struct Foomp { + ip: String, + port: String, + identity_key: String, +} diff --git a/mixnode/src/node/listener/connection_handler/mod.rs b/mixnode/src/node/listener/connection_handler/mod.rs index 1dae33ac1c..ee73a7eacd 100644 --- a/mixnode/src/node/listener/connection_handler/mod.rs +++ b/mixnode/src/node/listener/connection_handler/mod.rs @@ -6,7 +6,7 @@ use crate::node::listener::connection_handler::packet_processing::{ }; use crate::node::packet_delayforwarder::PacketDelayForwardSender; use futures::StreamExt; -use log::*; +use log::{error, info}; use nymsphinx::forwarding::packet::MixPacket; use nymsphinx::framing::codec::SphinxCodec; use nymsphinx::framing::packet::FramedSphinxPacket; diff --git a/mixnode/src/node/listener/mod.rs b/mixnode/src/node/listener/mod.rs index caba660a1a..68a7c19b63 100644 --- a/mixnode/src/node/listener/mod.rs +++ b/mixnode/src/node/listener/mod.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use crate::node::listener::connection_handler::ConnectionHandler; -use log::*; +use log::error; use std::net::SocketAddr; use std::process; use tokio::net::TcpListener; diff --git a/mixnode/src/node/metrics.rs b/mixnode/src/node/metrics.rs index e1dc0188a4..e290751abe 100644 --- a/mixnode/src/node/metrics.rs +++ b/mixnode/src/node/metrics.rs @@ -4,7 +4,7 @@ use futures::channel::mpsc; use futures::lock::Mutex; use futures::StreamExt; -use log::*; +use log::trace; use metrics_client::models::metrics::MixMetric; use std::collections::HashMap; use std::ops::DerefMut; diff --git a/mixnode/src/node/mod.rs b/mixnode/src/node/mod.rs index 43a6229066..18d45290b7 100644 --- a/mixnode/src/node/mod.rs +++ b/mixnode/src/node/mod.rs @@ -2,16 +2,18 @@ // SPDX-License-Identifier: Apache-2.0 use crate::config::Config; +use crate::node::http::verloc::verloc; use crate::node::listener::connection_handler::packet_processing::PacketProcessor; use crate::node::listener::connection_handler::ConnectionHandler; use crate::node::listener::Listener; use crate::node::packet_delayforwarder::{DelayForwarder, PacketDelayForwardSender}; use crypto::asymmetric::{encryption, identity}; -use log::*; +use log::{error, info, warn}; use std::process; use std::sync::Arc; use tokio::runtime::Runtime; +pub(crate) mod http; mod listener; mod metrics; pub(crate) mod packet_delayforwarder; @@ -36,6 +38,11 @@ impl MixNode { } } + fn start_http_api(&self) { + info!("Starting HTTP API on port 8000..."); + tokio::spawn(async move { rocket::build().mount("/", routes![verloc]).launch().await }); + } + fn start_metrics_reporter(&self) -> metrics::MetricsReporter { info!("Starting metrics reporter..."); metrics::MetricsController::new( @@ -130,7 +137,7 @@ impl MixNode { if duplicate_node_key == self.identity_keypair.public_key().to_base58_string() { warn!("You seem to have bonded your mixnode before starting it - that's highly unrecommended as in the future it will result in slashing"); } else { - error!( + log::error!( "Our announce-host is identical to an existing node's announce-host! (its key is {:?})", duplicate_node_key ); @@ -141,10 +148,10 @@ impl MixNode { let metrics_reporter = self.start_metrics_reporter(); let delay_forwarding_channel = self.start_packet_delay_forwarder(metrics_reporter.clone()); self.start_socket_listener(metrics_reporter, delay_forwarding_channel); + self.start_http_api(); info!("Finished nym mixnode startup procedure - it should now be able to receive mix traffic!"); - self.wait_for_interrupt().await - }) + }); } } diff --git a/mixnode/src/node/packet_delayforwarder.rs b/mixnode/src/node/packet_delayforwarder.rs index 002aae5615..89c37e6e6c 100644 --- a/mixnode/src/node/packet_delayforwarder.rs +++ b/mixnode/src/node/packet_delayforwarder.rs @@ -4,7 +4,7 @@ use crate::node::metrics::MetricsReporter; use futures::channel::mpsc; use futures::StreamExt; -use log::*; +use log::debug; use nonexhaustive_delayqueue::{Expired, NonExhaustiveDelayQueue, TimerError}; use nymsphinx::forwarding::packet::MixPacket; use tokio::time::{Duration, Instant};