From 8efdac469d258456400fb544a43a467a88ab7410 Mon Sep 17 00:00:00 2001 From: Niko PLP Date: Fri, 23 Jun 2023 22:04:08 +0300 Subject: [PATCH] serving app and .ng_bootstrap --- Cargo.lock | 528 +++++++++++++------------- README.md | 11 + ng-app/package.json | 3 +- ng-app/prepare-app-file.cjs | 30 ++ ng-app/src/routes/WalletCreate.svelte | 8 +- ng-wallet/src/types.rs | 9 +- ngd/src/main.rs | 5 +- ngone/README.md | 11 + p2p-broker/Cargo.toml | 4 +- p2p-broker/src/server_ws.rs | 180 +++++++-- p2p-client-ws/Cargo.toml | 2 +- p2p-net/src/types.rs | 67 ++++ pnpm-lock.yaml | 73 ++++ 13 files changed, 618 insertions(+), 313 deletions(-) create mode 100644 ng-app/prepare-app-file.cjs diff --git a/Cargo.lock b/Cargo.lock index 1e8b298..07caf94 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -31,9 +31,9 @@ dependencies = [ [[package]] name = "aes" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433cfd6710c9986c576a25ca913c39d66a6474107b406f34f91d4a8923395241" +checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" dependencies = [ "cfg-if", "cipher", @@ -71,9 +71,18 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.0.1" +version = "0.7.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +dependencies = [ + "memchr", +] + +[[package]] +name = "aho-corasick" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" dependencies = [ "memchr", ] @@ -93,6 +102,12 @@ dependencies = [ "alloc-no-stdlib", ] +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + [[package]] name = "android_system_properties" version = "0.1.5" @@ -119,15 +134,15 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" +checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" [[package]] name = "anstyle-parse" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" +checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" dependencies = [ "utf8parse", ] @@ -138,7 +153,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" dependencies = [ - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -148,7 +163,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" dependencies = [ "anstyle", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -176,9 +191,9 @@ checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "assert_cmd" @@ -309,7 +324,7 @@ dependencies = [ "futures-lite", "rustix", "signal-hook", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -354,14 +369,13 @@ checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] name = "async-tungstenite" version = "0.22.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce01ac37fdc85f10a43c43bc582cbd566720357011578a935761075f898baf58" +source = "git+https://git.nextgraph.org/NextGraph/async-tungstenite.git?branch=nextgraph#979de8e77d365af4630607dfdc721d5d9aeea42e" dependencies = [ "async-std", "futures-io", @@ -435,9 +449,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.0" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" +checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" [[package]] name = "base64-url" @@ -445,7 +459,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c5b0a88aa36e9f095ee2e2b13fb8c5e4313e022783aedacc123328c0084916d" dependencies = [ - "base64 0.21.0", + "base64 0.21.2", ] [[package]] @@ -486,9 +500,9 @@ dependencies = [ [[package]] name = "blake3" -version = "1.3.3" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ae2468a89544a466886840aa467a25b766499f4f04bf7d9fcd10ecee9fccef" +checksum = "729b71f35bd3fa1a4c86b85d32c8b9069ea7fe14f7a53cfabb65f62d4265b888" dependencies = [ "arrayref", "arrayvec", @@ -505,7 +519,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83fc15853171b33280f5614e77f5fa4debd33f51a86c44daa4ba3d759674c561" dependencies = [ "base64 0.13.1", - "uuid 1.3.3", + "uuid 1.3.4", ] [[package]] @@ -582,9 +596,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.12.2" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c6ed94e98ecff0c12dd1b04c15ec0d7d9458ca8fe806cea6f12954efe74c63b" +checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" [[package]] name = "bytemuck" @@ -634,9 +648,9 @@ dependencies = [ [[package]] name = "cargo_toml" -version = "0.15.2" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f83bc2e401ed041b7057345ebc488c005efa0341d5541ce7004d30458d0090b" +checksum = "599aa35200ffff8f04c1925aa1acc92fa2e08874379ef42e210a80e527e60838" dependencies = [ "serde", "toml", @@ -662,14 +676,14 @@ checksum = "d38f2da7a0a2c4ccf0065be06397cc26a81f4e528be095826eee9d4adbb8c60f" dependencies = [ "byteorder", "fnv", - "uuid 1.3.3", + "uuid 1.3.4", ] [[package]] name = "cfg-expr" -version = "0.15.1" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8790cf1286da485c72cf5fc7aeba308438800036ec67d89425924c4807268c9" +checksum = "215c0072ecc28f92eeb0eea38ba63ddfcb65c2828c46311d646f1a3ff5f9841c" dependencies = [ "smallvec", "target-lexicon", @@ -707,12 +721,12 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.24" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b" +checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" dependencies = [ + "android-tzdata", "iana-time-zone", - "num-integer", "num-traits", "serde", "winapi", @@ -731,9 +745,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.4" +version = "4.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80672091db20273a15cf9fdd4e47ed43b5091ec9841bf4c6145c9dfbbcae09ed" +checksum = "2686c4115cb0810d9a984776e197823d08ec94f176549a89a9efded477c456dc" dependencies = [ "clap_builder", "clap_derive", @@ -742,9 +756,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.3.4" +version = "4.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1458a1df40e1e2afebb7ab60ce55c1fa8f431146205aa5f4887e0b111c27636" +checksum = "2e53afce1efce6ed1f633cf0e57612fe51db54a1ee4fd8f8503d078fe02d69ae" dependencies = [ "anstream", "anstyle", @@ -762,7 +776,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] @@ -845,9 +859,9 @@ dependencies = [ [[package]] name = "constant_time_eq" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13418e745008f7349ec7e449155f419a61b92b58a99cc3616942b926825ec76b" +checksum = "21a53c0a4d288377e7415b53dcfc3c04da5cdc2cc95c8d5ac178b58f0b861ad6" [[package]] name = "convert_case" @@ -886,21 +900,20 @@ dependencies = [ [[package]] name = "core-graphics-types" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b" +checksum = "2bb142d41022986c1d8ff29103a1411c8a3dfad3552f87a4f8dc50d61d4f4e33" dependencies = [ "bitflags", "core-foundation", - "foreign-types", "libc", ] [[package]] name = "cpufeatures" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58" +checksum = "03e69e28e9f7f77debdedbaafa2866e1de9ba56df55a8bd7cfc724c25a09987c" dependencies = [ "libc", ] @@ -943,9 +956,9 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.14" +version = "0.9.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" dependencies = [ "autocfg", "cfg-if", @@ -956,9 +969,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" dependencies = [ "cfg-if", ] @@ -999,12 +1012,12 @@ dependencies = [ [[package]] name = "cssparser-macros" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfae75de57f2b2e85e8768c3ea840fd159c8f33e2b6522c7835b7abac81be16e" +checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" dependencies = [ "quote", - "syn 1.0.109", + "syn 2.0.18", ] [[package]] @@ -1026,12 +1039,6 @@ dependencies = [ "cipher", ] -[[package]] -name = "cty" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" - [[package]] name = "cuckoofilter" version = "0.5.0" @@ -1091,7 +1098,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] @@ -1102,7 +1109,7 @@ checksum = "29a358ff9f12ec09c3e61fef9b5a9902623a695a46a917b07f269bff1445611a" dependencies = [ "darling_core", "quote", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] @@ -1231,15 +1238,15 @@ checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" [[package]] name = "dtoa" -version = "0.4.8" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0" +checksum = "65d09067bfacaa79114679b279d7f5885b53295b1e2cfb4e79c8e4bd3d633169" [[package]] name = "dtoa-short" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bde03329ae10e79ede66c9ce4dc930aa8599043b0743008548680f25b91502d6" +checksum = "dbaceec3c6e4211c79e7b1800fb9680527106beb2f9c51904a3210c03a448c74" dependencies = [ "dtoa", ] @@ -1328,7 +1335,7 @@ checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" dependencies = [ "errno-dragonfly", "libc", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -1349,15 +1356,15 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "exr" -version = "1.6.3" +version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdd2162b720141a91a054640662d3edce3d50a944a50ffca5313cd951abb35b4" +checksum = "279d3efcc55e19917fff7ab3ddd6c14afb6a90881a0078465196fe2f99d08c56" dependencies = [ "bit_field", "flume", "half", "lebe", - "miniz_oxide 0.6.2", + "miniz_oxide", "rayon-core", "smallvec", "zune-inflate", @@ -1407,9 +1414,9 @@ checksum = "e825f6987101665dea6ec934c09ec6d721de7bc1bf92248e1d5810c8cd636b77" [[package]] name = "field-offset" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3cf3a800ff6e860c863ca6d4b16fd999db8b752819c1606884047b73e468535" +checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f" dependencies = [ "memoffset", "rustc_version", @@ -1422,7 +1429,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" dependencies = [ "crc32fast", - "miniz_oxide 0.7.1", + "miniz_oxide", ] [[package]] @@ -1461,9 +1468,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ "percent-encoding", ] @@ -1549,7 +1556,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] @@ -1724,9 +1731,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "js-sys", @@ -1790,9 +1797,9 @@ dependencies = [ [[package]] name = "glib" -version = "0.16.7" +version = "0.16.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddd4df61a866ed7259d6189b8bcb1464989a77f1d85d25d002279bbe9dd38b2f" +checksum = "16aa2475c9debed5a32832cb5ff2af5a3f9e1ab9e69df58eaadc1ab2004d6eba" dependencies = [ "bitflags", "futures-channel", @@ -1841,6 +1848,19 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +[[package]] +name = "globset" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc" +dependencies = [ + "aho-corasick 0.7.20", + "bstr", + "fnv", + "log", + "regex", +] + [[package]] name = "gloo-timers" version = "0.2.6" @@ -2113,9 +2133,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.56" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" +checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -2158,9 +2178,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -2225,13 +2245,13 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ "hermit-abi 0.3.1", "libc", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -2249,7 +2269,7 @@ dependencies = [ "hermit-abi 0.3.1", "io-lifetimes", "rustix", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -2327,9 +2347,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.63" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f37a4a5928311ac501dee68b3c7613a1037d0edb30c8e5427bd832d55d1b790" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] @@ -2381,9 +2401,9 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" [[package]] name = "libc" -version = "0.2.144" +version = "0.2.146" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" +checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" [[package]] name = "libm" @@ -2429,9 +2449,9 @@ dependencies = [ [[package]] name = "lock_api" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" dependencies = [ "autocfg", "scopeguard", @@ -2439,11 +2459,10 @@ dependencies = [ [[package]] name = "log" -version = "0.4.17" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" dependencies = [ - "cfg-if", "value-bag", ] @@ -2520,9 +2539,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memoffset" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" dependencies = [ "autocfg", ] @@ -2543,15 +2562,6 @@ dependencies = [ "unicase", ] -[[package]] -name = "miniz_oxide" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" -dependencies = [ - "adler", -] - [[package]] name = "miniz_oxide" version = "0.7.1" @@ -2564,14 +2574,13 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", - "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.45.0", + "windows-sys", ] [[package]] @@ -2598,7 +2607,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", ] [[package]] @@ -2835,7 +2844,7 @@ dependencies = [ "blake2", "chacha20poly1305", "noise-protocol", - "sha2 0.10.6", + "sha2 0.10.7", "x25519-dalek", "zeroize", ] @@ -2941,9 +2950,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "opaque-debug" @@ -2978,15 +2987,17 @@ dependencies = [ "chacha20", "default-net", "futures", - "getrandom 0.2.9", + "getrandom 0.2.10", "hex", "once_cell", "p2p-client-ws", "p2p-net", "p2p-repo", + "rust-embed", "serde", "serde_bare", "serde_bytes", + "serde_json", "stores-lmdb", "tempfile", ] @@ -3002,7 +3013,7 @@ dependencies = [ "async-tungstenite", "chacha20", "futures", - "getrandom 0.2.9", + "getrandom 0.2.10", "p2p-net", "p2p-repo", "pharos", @@ -3026,7 +3037,7 @@ dependencies = [ "default-net", "ed25519-dalek", "futures", - "getrandom 0.2.9", + "getrandom 0.2.10", "noise-protocol", "noise-rust-crypto", "num_enum", @@ -3128,15 +3139,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.7" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.2.16", + "redox_syscall 0.3.5", "smallvec", - "windows-sys 0.45.0", + "windows-targets 0.48.0", ] [[package]] @@ -3158,9 +3169,9 @@ checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pharos" @@ -3287,7 +3298,7 @@ checksum = "39407670928234ebc5e6e580247dd567ad73a3578460c5990f9503df207e8f07" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] @@ -3320,7 +3331,7 @@ version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9bd9647b268a3d3e14ff09c23201133a62589c658db02bb7388c7246aafe0590" dependencies = [ - "base64 0.21.0", + "base64 0.21.2", "indexmap", "line-wrap", "quick-xml", @@ -3330,15 +3341,15 @@ dependencies = [ [[package]] name = "png" -version = "0.17.8" +version = "0.17.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaeebc51f9e7d2c150d3f3bfeb667f2aa985db5ef1e3d212847bdedb488beeaa" +checksum = "59871cc5b6cce7eaccca5a802b4173377a1c2ba90654246789a8fa2334426d11" dependencies = [ "bitflags", "crc32fast", "fdeflate", "flate2", - "miniz_oxide 0.7.1", + "miniz_oxide", ] [[package]] @@ -3354,7 +3365,7 @@ dependencies = [ "libc", "log", "pin-project-lite", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -3370,9 +3381,9 @@ dependencies = [ [[package]] name = "polyval" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef234e08c11dfcb2e56f79fd70f6f2eb7f025c0ce2333e82f4f0518ecad30c6" +checksum = "d52cff9d1d4dee5fe6d03729099f4a310a41179e0a10dbf542039873f2e826fb" dependencies = [ "cfg-if", "cpufeatures", @@ -3462,9 +3473,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.58" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa1fb82fc0c281dd9671101b66b771ebbe1eaf967b96ac8740dcba4b70005ca8" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] @@ -3504,9 +3515,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.27" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -3571,7 +3582,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", ] [[package]] @@ -3594,12 +3605,9 @@ dependencies = [ [[package]] name = "raw-window-handle" -version = "0.5.0" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed7e3d950b66e19e0c372f3fa3fbbcf85b1746b571f74e0c2af6042a5c93420a" -dependencies = [ - "cty", -] +checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" [[package]] name = "rayon" @@ -3647,7 +3655,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", "redox_syscall 0.2.16", "thiserror", ] @@ -3658,7 +3666,7 @@ version = "1.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" dependencies = [ - "aho-corasick", + "aho-corasick 1.0.2", "memchr", "regex-syntax 0.7.2", ] @@ -3690,7 +3698,7 @@ version = "0.11.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" dependencies = [ - "base64 0.21.0", + "base64 0.21.2", "bytes", "encoding_rs", "futures-core", @@ -3744,9 +3752,9 @@ dependencies = [ [[package]] name = "rust-embed" -version = "6.6.1" +version = "6.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b68543d5527e158213414a92832d2aab11a84d2571a5eb021ebe22c43aab066" +checksum = "b73e721f488c353141288f223b599b4ae9303ecf3e62923f40a492f0634a4dc3" dependencies = [ "rust-embed-impl", "rust-embed-utils", @@ -3755,14 +3763,14 @@ dependencies = [ [[package]] name = "rust-embed-impl" -version = "6.5.0" +version = "6.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d4e0f0ced47ded9a68374ac145edd65a6c1fa13a96447b873660b2a568a0fd7" +checksum = "e22ce362f5561923889196595504317a4372b84210e6e335da529a65ea5452b5" dependencies = [ "proc-macro2", "quote", "rust-embed-utils", - "syn 1.0.109", + "syn 2.0.18", "walkdir", ] @@ -3772,7 +3780,8 @@ version = "7.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "512b0ab6853f7e14e3c8754acb43d6f748bb9ced66aa5915a6553ac8213f7731" dependencies = [ - "sha2 0.10.6", + "globset", + "sha2 0.10.7", "walkdir", ] @@ -3787,16 +3796,16 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.19" +version = "0.37.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" +checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0" dependencies = [ "bitflags", "errno", "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -3805,7 +3814,7 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" dependencies = [ - "base64 0.21.0", + "base64 0.21.2", ] [[package]] @@ -3890,9 +3899,9 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.163" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" +checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" dependencies = [ "serde_derive", ] @@ -3937,20 +3946,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.163" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" +checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] name = "serde_json" -version = "1.0.96" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" +checksum = "bdf3bf93142acad5821c99197022e170842cdbc1c30482b98750c688c640842a" dependencies = [ "itoa 1.0.6", "ryu", @@ -3965,7 +3974,7 @@ checksum = "bcec881020c684085e55a25f7fd888954d56609ef363479dc5a1305eb0d40cab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] @@ -3991,11 +4000,11 @@ dependencies = [ [[package]] name = "serde_with" -version = "2.3.3" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07ff71d2c147a7b57362cead5e22f772cd52f6ab31cfcd9edcd7f6aeb2a0afbe" +checksum = "9f02d8aa6e3c385bf084924f660ce2a3a6bd333ba55b35e8590b321f35d88513" dependencies = [ - "base64 0.13.1", + "base64 0.21.2", "chrono", "hex", "indexmap", @@ -4007,14 +4016,14 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "2.3.3" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" +checksum = "edc7d5d3932fb12ce722ee5e64dd38c504efba37567f0c402f6ca728c3b8b070" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] @@ -4075,9 +4084,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" dependencies = [ "cfg-if", "cpufeatures", @@ -4259,9 +4268,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "subtle" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "swift-rs" @@ -4269,7 +4278,7 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05e51d6f2b5fff4808614f429f8a7655ac8bcfe218185413f3a60c508482c2d6" dependencies = [ - "base64 0.21.0", + "base64 0.21.2", "serde", "serde_json", ] @@ -4287,9 +4296,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.16" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6f671d4b5ffdb8eadec19c0ae67fe2639df8684bd7bc4b83d986b8db549cf01" +checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" dependencies = [ "proc-macro2", "quote", @@ -4319,9 +4328,9 @@ dependencies = [ [[package]] name = "system-deps" -version = "6.1.0" +version = "6.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5fa6fb9ee296c0dc2df41a656ca7948546d061958115ddb0bcaae43ad0d17d2" +checksum = "30c2de8a4d8f4b823d634affc9cd2a74ec98c53a756f317e529a48046cbf71f3" dependencies = [ "cfg-expr", "heck", @@ -4371,7 +4380,7 @@ dependencies = [ "serde", "tao-macros", "unicode-segmentation", - "uuid 1.3.3", + "uuid 1.3.4", "windows 0.44.0", "windows-implement", "x11-dl", @@ -4390,15 +4399,15 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.7" +version = "0.12.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd1ba337640d60c3e96bc6f0638a939b9c9a7f2c316a1598c279828b3d1dc8c5" +checksum = "1b1c7f239eb94671427157bd93b3694320f3668d4e1eff08c7285366fd777fac" [[package]] name = "tauri" -version = "2.0.0-alpha.9" +version = "2.0.0-alpha.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "695b6c1cdf861002bc2ea17a53cf0669e62da5def6ffcbff02fa00c7515d40b4" +checksum = "2e18377a75e314aa1d476896af881ed63f57a78ca84889fe63e69067f0de158d" dependencies = [ "anyhow", "bytes", @@ -4436,7 +4445,7 @@ dependencies = [ "thiserror", "tokio", "url", - "uuid 1.3.3", + "uuid 1.3.4", "webkit2gtk", "webview2-com", "windows 0.44.0", @@ -4444,9 +4453,9 @@ dependencies = [ [[package]] name = "tauri-build" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34a5b16abedfa53fdb6ad4c68c41612e097dbfac1c18390fe6e4ded18d9ec28d" +checksum = "a52990870fd043f1d3bd6719ae713ef2e0c50431334d7249f6ae8509d1b8c326" dependencies = [ "anyhow", "cargo_toml", @@ -4463,11 +4472,11 @@ dependencies = [ [[package]] name = "tauri-codegen" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f03863ab7ecf1fea3a748c4a9ace7b0a6a2051b4ce10ae954ec546957fb529" +checksum = "5c1f1611ab0896f2693163ba4e8f3e39c02a1b70cdca4314286b5e365a5e08c6" dependencies = [ - "base64 0.21.0", + "base64 0.21.2", "brotli", "ico", "json-patch", @@ -4478,20 +4487,20 @@ dependencies = [ "semver", "serde", "serde_json", - "sha2 0.10.6", + "sha2 0.10.7", "tauri-utils", "thiserror", "time", "url", - "uuid 1.3.3", + "uuid 1.3.4", "walkdir", ] [[package]] name = "tauri-macros" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74f9a2623fed6b5bc04f2e1344c88df6415617bd223599c60a4171630b63fb74" +checksum = "22752425c6dd6f3a058f376db7371f1d5bac250e340d40ba6c97ecf7182eef29" dependencies = [ "heck", "proc-macro2", @@ -4503,9 +4512,9 @@ dependencies = [ [[package]] name = "tauri-runtime" -version = "0.13.0-alpha.5" +version = "0.13.0-alpha.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de05147581dd8cfdac638455029eb06c57fa64eb17eb03d5d7f229c571941cd9" +checksum = "d7ce19f1309299bbc38ee9236307fad4943bd8fb09dd3fea5e9dd93c1d0898d6" dependencies = [ "gtk", "http", @@ -4518,15 +4527,15 @@ dependencies = [ "tauri-utils", "thiserror", "url", - "uuid 1.3.3", + "uuid 1.3.4", "windows 0.44.0", ] [[package]] name = "tauri-runtime-wry" -version = "0.13.0-alpha.5" +version = "0.13.0-alpha.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7784048ef49a57ff32d55bf4ce89ec72fc97e3d4fdc68785d164b23965170e49" +checksum = "1231be42085f3a8b150e615601f8a070bd16bf579771a5dafe2931970a05b518" dependencies = [ "cocoa", "gtk", @@ -4536,7 +4545,7 @@ dependencies = [ "raw-window-handle", "tauri-runtime", "tauri-utils", - "uuid 1.3.3", + "uuid 1.3.4", "webkit2gtk", "webview2-com", "windows 0.44.0", @@ -4545,12 +4554,13 @@ dependencies = [ [[package]] name = "tauri-utils" -version = "2.0.0-alpha.5" +version = "2.0.0-alpha.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58eca5e3b6714c6bd87052182ebb7d5392d551f478f994878f136f49d4e6d640" +checksum = "2e2812e0cdfffb892c654555b2f1b8c84a035b4c56eb1646cb3eb5a9d8164d8e" dependencies = [ "brotli", "ctor", + "dunce", "glob", "heck", "html5ever", @@ -4583,15 +4593,16 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.5.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" +checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" dependencies = [ + "autocfg", "cfg-if", "fastrand", "redox_syscall 0.3.5", "rustix", - "windows-sys 0.45.0", + "windows-sys", ] [[package]] @@ -4643,7 +4654,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] @@ -4669,9 +4680,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.21" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3403384eaacbca9923fa06940178ac13e4edb725486d70e8e15881d0c836cc" +checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd" dependencies = [ "itoa 1.0.6", "serde", @@ -4711,9 +4722,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.28.1" +version = "1.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aa32867d44e6f2ce3385e89dceb990188b8bb0fb25b0cf576647a6f98ac5105" +checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2" dependencies = [ "autocfg", "bytes", @@ -4725,7 +4736,7 @@ dependencies = [ "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -4736,7 +4747,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] @@ -4799,9 +4810,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.19.9" +version = "0.19.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d964908cec0d030b812013af25a0e57fddfadb1e066ecc6681d86253129d4f" +checksum = "2380d56e8670370eee6566b0bfd4265f65b3f432e8c6d85623f728d4fa31f739" dependencies = [ "indexmap", "serde", @@ -4831,13 +4842,13 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.24" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" +checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] @@ -4916,8 +4927,7 @@ dependencies = [ [[package]] name = "tungstenite" version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15fba1a6d6bb030745759a9a2a588bfe8490fc8b4751a277db3a0be1c9ebbf67" +source = "git+https://git.nextgraph.org/NextGraph/tungstenite-rs.git?branch=nextgraph#3961996e6d0e50281a0ec5654df400b46d01f1a2" dependencies = [ "byteorder", "bytes", @@ -4955,9 +4965,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "unicode-normalization" @@ -4982,7 +4992,7 @@ checksum = "ae605c39dfbdec433798d4a8b03ffbac711dc51cdeb1ba5c725bdcaf24e464cc" dependencies = [ "blob-uuid", "lazy_static", - "uuid 1.3.3", + "uuid 1.3.4", ] [[package]] @@ -4997,9 +5007,9 @@ dependencies = [ [[package]] name = "url" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" dependencies = [ "form_urlencoded", "idna", @@ -5027,11 +5037,11 @@ checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" [[package]] name = "uuid" -version = "1.3.3" +version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "345444e32442451b267fc254ae85a209c64be56d2890e601a0c37ff0c3c5ecd2" +checksum = "0fa2982af2eec27de306107c027578ff7f423d65f7250e40ce0fea8f45248b81" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", ] [[package]] @@ -5042,13 +5052,9 @@ checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "value-bag" -version = "1.0.0-alpha.9" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2209b78d1249f7e6f3293657c9779fe31ced465df091bbd433a1cf88e916ec55" -dependencies = [ - "ctor", - "version_check", -] +checksum = "a4d330786735ea358f3bc09eea4caa098569c1c93f342d9aca0514915022fe7e" [[package]] name = "version-compare" @@ -5109,11 +5115,10 @@ dependencies = [ [[package]] name = "want" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" dependencies = [ - "log", "try-lock", ] @@ -5173,9 +5178,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bba0e8cb82ba49ff4e229459ff22a191bbe9a1cb3a341610c9c33efc27ddf73" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -5183,24 +5188,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b04bc93f9d6bdee709f6bd2118f57dd6679cf1176a1af464fca3ab0d66d8fb" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.36" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d1985d03709c53167ce907ff394f5316aa22cb4e12761295c5dc57dacb6297e" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" dependencies = [ "cfg-if", "js-sys", @@ -5210,9 +5215,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14d6b024f1a526bb0234f52840389927257beb670610081360e5a03c5df9c258" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -5220,28 +5225,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "wasm-bindgen-test" -version = "0.3.36" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9e636f3a428ff62b3742ebc3c70e254dfe12b8c2b469d688ea59cdd4abcf502" +checksum = "6e6e302a7ea94f83a6d09e78e7dc7d9ca7b186bc2829c24a22d0753efd680671" dependencies = [ "console_error_panic_hook", "js-sys", @@ -5253,9 +5258,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-test-macro" -version = "0.3.36" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f18c1fad2f7c4958e7bcce014fa212f59a65d5e3721d0f77e6c0b27ede936ba3" +checksum = "ecb993dd8c836930ed130e020e77d9b2e65dd0fbab1b67c790b0f5d80b11a575" dependencies = [ "proc-macro2", "quote", @@ -5276,9 +5281,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.63" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bdd9ef4e984da1187bf8110c5cf5b845fbc87a23602cdf912386a76fcd3a7c2" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" dependencies = [ "js-sys", "wasm-bindgen", @@ -5472,15 +5477,6 @@ version = "0.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee78911e3f4ce32c1ad9d3c7b0bd95389662ad8d8f1a3155688fed70bd96e2b6" -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - [[package]] name = "windows-sys" version = "0.48.0" @@ -5612,9 +5608,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61de7bac303dc551fe038e2b3cef0f571087a47571ea6e79a87692ac99b99699" +checksum = "ca0ace3845f0d96209f0375e6d367e3eb87eb65d27d445bdc9f1843a26f39448" dependencies = [ "memchr", ] @@ -5665,7 +5661,7 @@ dependencies = [ "once_cell", "serde", "serde_json", - "sha2 0.10.6", + "sha2 0.10.7", "soup3", "tao", "thiserror", @@ -5785,7 +5781,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.18", ] [[package]] diff --git a/README.md b/README.md index 62e5faa..25ac6ba 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,17 @@ cargo test --package p2p-client-ws --lib -- --nocapture ### Build release binaries +First you will need to build the single-file release of ng-app. + +``` +// uncomment line 14 of src/App.svelte: import * as api from "ng-sdk-js"; +cd ng-app +pnpm filebuild +cd .. +``` + +then build the ngd daemon + ``` cargo build -r -p ngd ``` diff --git a/ng-app/package.json b/ng-app/package.json index 31e454e..690b53e 100644 --- a/ng-app/package.json +++ b/ng-app/package.json @@ -7,7 +7,7 @@ "dev": "vite", "webdev": "cross-env NG_APP_WEB=1 TAURI_DEBUG=1 vite", "webbuild": "cross-env NG_APP_WEB=1 vite build", - "filebuild": "cross-env NG_APP_WEB=1 NG_APP_FILE=1 vite build", + "filebuild": "cross-env NG_APP_WEB=1 NG_APP_FILE=1 vite build && node prepare-app-file.cjs", "filebuilddebug": "cross-env NG_APP_WEB=1 NG_APP_FILE=1 TAURI_DEBUG=1 vite build -m debug", "build": "vite build", "preview": "vite preview", @@ -33,6 +33,7 @@ "autoprefixer": "^10.4.14", "cross-env": "^7.0.3", "internal-ip": "^7.0.0", + "node-gzip": "^1.1.2", "postcss": "^8.4.23", "postcss-load-config": "^4.0.1", "svelte": "^3.54.0", diff --git a/ng-app/prepare-app-file.cjs b/ng-app/prepare-app-file.cjs new file mode 100644 index 0000000..e02a481 --- /dev/null +++ b/ng-app/prepare-app-file.cjs @@ -0,0 +1,30 @@ +var crypto = require('crypto') + , fs = require('fs') + const {gzip, } = require('node-gzip'); + +var algorithm = 'sha256' + , shasum = crypto.createHash(algorithm) + + const sha_file = './dist-file/index.sha256'; + const gzip_file = './dist-file/index.gzip'; +var filename = './dist-file/index.html' + , s = fs.ReadStream(filename) + + var bufs = []; +s.on('data', function(data) { + shasum.update(data) + bufs.push(data); +}) + +s.on('end', function() { + var hash = shasum.digest('hex') + console.log(hash + ' ' + filename) + + fs.writeFileSync(sha_file, hash, 'utf8'); + + var buf = Buffer.concat(bufs); + gzip(buf).then((compressed) => {fs.writeFileSync(gzip_file, compressed);}); + + }) + + diff --git a/ng-app/src/routes/WalletCreate.svelte b/ng-app/src/routes/WalletCreate.svelte index 1d8f767..7ca449b 100644 --- a/ng-app/src/routes/WalletCreate.svelte +++ b/ng-app/src/routes/WalletCreate.svelte @@ -557,10 +557,10 @@ This security measure will prevent you from entering your pazzle and PIN on malicious sites and apps. - When you will use you wallet, if you do not see and recognize your - own security phrase and image before entering your pazzle, please - stop and DO NOT enter your pazzle, you are being the victim of a - phishing attempt. + Every time you will use your wallet, if you do not see and recognize + your own security phrase and image before entering your pazzle, + please stop and DO NOT enter your pazzle, as you would be the victim + of a phishing attempt.

diff --git a/ng-wallet/src/types.rs b/ng-wallet/src/types.rs index d232096..4d365a6 100644 --- a/ng-wallet/src/types.rs +++ b/ng-wallet/src/types.rs @@ -12,7 +12,7 @@ use std::fmt; use serde::{Deserialize, Serialize}; use serde_big_array::BigArray; -use p2p_net::types::{BrokerServerV0, NetAddr}; +use p2p_net::types::{BootstrapContentV0, BrokerServerV0}; use p2p_repo::types::*; /// WalletId is a PubKey @@ -21,13 +21,6 @@ pub type WalletId = PubKey; /// BootstrapId is a WalletId pub type BootstrapId = WalletId; -/// Bootstrap content Version 0 -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct BootstrapContentV0 { - /// list of servers, in order of preference - pub servers: Vec, -} - /// Bootstrap Version 0 #[derive(Clone, Debug, Serialize, Deserialize)] pub struct BootstrapV0 { diff --git a/ngd/src/main.rs b/ngd/src/main.rs index 09887f2..d470d48 100644 --- a/ngd/src/main.rs +++ b/ngd/src/main.rs @@ -577,6 +577,7 @@ async fn main_inner() -> Result<(), ()> { } else { listener.refuse_clients = true; } + listener.serve_app = false; listeners.push(listener); } } @@ -645,7 +646,7 @@ async fn main_inner() -> Result<(), ()> { port: private_part.1, discoverable: false, refuse_clients: args.public_without_clients, - serve_app: true, + serve_app: false, accept_direct: false, accept_forward_for: AcceptForwardForV0::PublicStatic(( BindAddress { @@ -720,6 +721,7 @@ async fn main_inner() -> Result<(), ()> { let mut listener = ListenerV0::new_direct(inter, !args.no_ipv6, arg_value.1); listener.accept_direct = false; + listener.serve_app = false; listener.accept_forward_for = AcceptForwardForV0::PublicDyn((public_port, 60, "".to_string())); listeners.push(listener); @@ -829,6 +831,7 @@ async fn main_inner() -> Result<(), ()> { { let r = listeners.last_mut().unwrap(); r.accept_direct = true; + r.serve_app = true; r.ipv6 = !args.no_ipv6; } else { listeners.push(ListenerV0::new_direct(inter, !args.no_ipv6, arg_value.1)); diff --git a/ngone/README.md b/ngone/README.md index 275c235..45e24fe 100644 --- a/ngone/README.md +++ b/ngone/README.md @@ -23,6 +23,17 @@ cargo watch -c -w src -x run ## Build +First you will need to build the single-file release of ng-app. + +``` +// uncomment line 14 of src/App.svelte: import * as api from "ng-sdk-js"; +cd ../ng-app +pnpm filebuild +cd ../ngone +``` + +then, in ngone: + ``` cd web pnpm run build diff --git a/p2p-broker/Cargo.toml b/p2p-broker/Cargo.toml index f58c3dc..ede8a04 100644 --- a/p2p-broker/Cargo.toml +++ b/p2p-broker/Cargo.toml @@ -22,9 +22,11 @@ async-channel = "1.7.1" tempfile = "3" hex = "0.4.3" async-trait = "0.1.64" -async-tungstenite = { version = "0.22.2", features = ["async-std-runtime"] } +async-tungstenite = { git = "https://git.nextgraph.org/NextGraph/async-tungstenite.git", branch = "nextgraph", features = ["async-std-runtime"] } blake3 = "1.3.1" once_cell = "1.17.1" +rust-embed= { version = "6.7.0", features=["include-exclude"] } +serde_json = "1.0.96" [target.'cfg(target_arch = "wasm32")'.dependencies.getrandom] version = "0.2.7" diff --git a/p2p-broker/src/server_ws.rs b/p2p-broker/src/server_ws.rs index c55e013..f22e24a 100644 --- a/p2p-broker/src/server_ws.rs +++ b/p2p-broker/src/server_ws.rs @@ -21,11 +21,15 @@ use async_tungstenite::accept_hdr_async; use async_tungstenite::tungstenite::handshake::server::{ Callback, ErrorResponse, Request, Response, }; -use async_tungstenite::tungstenite::http::header::{CONNECTION, HOST, ORIGIN, UPGRADE}; -use async_tungstenite::tungstenite::http::HeaderValue; -use async_tungstenite::tungstenite::http::StatusCode; + +use async_tungstenite::tungstenite::http::{ + header::{CONNECTION, HOST, ORIGIN, UPGRADE}, + HeaderValue, Method, StatusCode, Uri, Version, +}; + use async_tungstenite::tungstenite::protocol::Message; use futures::{SinkExt, StreamExt}; +use once_cell::sync::Lazy; use once_cell::sync::OnceCell; use p2p_client_ws::remote_ws::ConnectionWebSocket; use p2p_net::broker::*; @@ -37,11 +41,14 @@ use p2p_net::utils::{get_domain_without_port, Sensitive, U8Array}; use p2p_repo::log::*; use p2p_repo::types::{PrivKey, PubKey}; use p2p_repo::utils::generate_keypair; +use rust_embed::RustEmbed; +use serde_json::json; use std::collections::HashMap; use std::collections::HashSet; use std::fs; use std::net::SocketAddr; use std::net::{IpAddr, Ipv4Addr, Ipv6Addr}; +use std::num::NonZeroU8; use std::ops::Deref; use std::path::{Path, PathBuf}; use std::sync::Arc; @@ -52,6 +59,9 @@ use tempfile::Builder; static LISTENERS_INFO: OnceCell<(HashMap, HashMap)> = OnceCell::new(); + +static BOOTSTRAP_STRING: OnceCell = OnceCell::new(); + struct SecurityCallback { remote_bind_address: BindAddress, local_bind_address: BindAddress, @@ -178,25 +188,69 @@ fn prepare_urls_from_private_addrs(addrs: &Vec, port: u16) -> Vec, + connection: Option<&HeaderValue>, remote: IP, serve_app: bool, - response: Response, -) -> Result { - if upgrade.is_some() - && upgrade + uri: &Uri, + last_etag: Option<&HeaderValue>, +) -> Result<(), ErrorResponse> { + if connection.is_some() + && connection .unwrap() .to_str() .unwrap() .split(|c| c == ' ' || c == ',') .any(|p| p.eq_ignore_ascii_case("Upgrade")) { - return Ok(response); + return Ok(()); } if serve_app && (remote.is_private() || remote.is_loopback()) { - return Err(make_error(StatusCode::OK)); + if uri == "/" { + log_debug!("Serving the app"); + let sha_file = App::get("index.sha256").unwrap(); + let sha = format!( + "\"{}\"", + std::str::from_utf8(sha_file.data.as_ref()).unwrap() + ); + if last_etag.is_some() && last_etag.unwrap().to_str().unwrap() == sha { + // return 304 + let res = Response::builder() + .status(StatusCode::NOT_MODIFIED) + .header("Cache-Control", "max-age=31536000, must-revalidate") + .header("ETag", sha) + .body(None) + .unwrap(); + return Err(res); + } + let file = App::get("index.gzip").unwrap(); + let res = Response::builder() + .status(StatusCode::OK) + .header("Content-Type", "text/html") + .header("Cache-Control", "max-age=31536000, must-revalidate") + .header("Content-Encoding", "gzip") + .header("ETag", sha) + .body(Some(file.data.to_vec())) + .unwrap(); + return Err(res); + } else if uri == "/.ng_bootstrap" { + log_debug!("Serving bootstrap"); + + let res = Response::builder() + .status(StatusCode::OK) + .header("Content-Type", "text/json") + .header("Cache-Control", "max-age=3600, must-revalidate") + .body(Some(BOOTSTRAP_STRING.get().unwrap().as_bytes().to_vec())) + .unwrap(); + return Err(res); + } } Err(make_error(StatusCode::FORBIDDEN)) @@ -207,7 +261,7 @@ const LOCAL_URLS: [&str; 3] = ["http://localhost", "http://127.0.0.1", "http://: const APP_NG_ONE_URL: &str = "https://app.nextgraph.one"; impl Callback for SecurityCallback { - fn on_request(self, request: &Request, response: Response) -> Result { + fn on_request(self, request: &Request) -> Result<(), ErrorResponse> { let local_urls = LOCAL_URLS .to_vec() .iter() @@ -236,21 +290,30 @@ impl Callback for SecurityCallback { .get(listener_id) .ok_or(make_error(StatusCode::FORBIDDEN))?; + if request.method() != Method::GET { + return Err(make_error(StatusCode::METHOD_NOT_ALLOWED)); + } + if request.version() != Version::HTTP_11 { + return Err(make_error(StatusCode::HTTP_VERSION_NOT_SUPPORTED)); + } + let xff = request.headers().get("X-Forwarded-For"); - let upgrade = request.headers().get(CONNECTION); + let connection = request.headers().get(CONNECTION); let host = request.headers().get(HOST); let origin = request.headers().get(ORIGIN); let remote = self.remote_bind_address.ip; - let xff = request.headers().get("X-Forwarded-For"); + let last_etag = request.headers().get("If-None-Match"); + let uri = request.uri(); log_debug!( - "upgrade:{:?} origin:{:?} host:{:?} xff:{:?} remote:{:?} local:{:?}", - upgrade, + "connection:{:?} origin:{:?} host:{:?} xff:{:?} remote:{:?} local:{:?} uri:{:?}", + connection, origin, host, xff, remote, - self.local_bind_address + self.local_bind_address, + uri ); match listener.config.if_type { @@ -270,7 +333,13 @@ impl Callback for SecurityCallback { "accepted core with refuse_clients {}", listener.config.refuse_clients ); - return Ok(response); + return upgrade_ws_or_serve_app( + connection, + remote, + listener.config.serve_app, + uri, + last_etag, + ); } InterfaceType::Loopback => { if !remote.is_loopback() { @@ -293,10 +362,11 @@ impl Callback for SecurityCallback { listener.config.accept_direct ); return upgrade_ws_or_serve_app( - upgrade, + connection, remote, listener.config.serve_app, - response, + uri, + last_etag, ); } else if listener.config.accept_forward_for.is_private_domain() { let (hosts_str, urls_str) = @@ -305,14 +375,26 @@ impl Callback for SecurityCallback { check_host(host, hosts_str)?; check_xff_is_public_or_private(xff, false, false)?; log_debug!("accepted loopback PRIVATE_DOMAIN"); - return Ok(response); + return upgrade_ws_or_serve_app( + connection, + remote, + listener.config.serve_app, + uri, + last_etag, + ); } else if listener.config.accept_forward_for == AcceptForwardForV0::No { check_host(host, local_hosts)?; check_no_xff(xff)?; // TODO local_urls might need a trailing :port, but it is ok for now as we do starts_with check_origin_is_url(origin, local_urls)?; log_debug!("accepted loopback DIRECT"); - return Ok(response); + return upgrade_ws_or_serve_app( + connection, + remote, + listener.config.serve_app, + uri, + last_etag, + ); } } InterfaceType::Private => { @@ -347,7 +429,13 @@ impl Callback for SecurityCallback { check_origin_is_url(origin, urls_str)?; check_host_in_addrs(host, &addrs)?; log_debug!("accepted private PUBLIC_STATIC or PUBLIC_DYN with direct {} with refuse_clients {}",listener.config.accept_direct, listener.config.refuse_clients); - return Ok(response); + return upgrade_ws_or_serve_app( + connection, + remote, + listener.config.serve_app, + uri, + last_etag, + ); } else if listener.config.accept_forward_for.is_public_domain() { if !remote.is_private() { return Err(make_error(StatusCode::FORBIDDEN)); @@ -373,7 +461,13 @@ impl Callback for SecurityCallback { "accepted private PUBLIC_DOMAIN with direct {}", listener.config.accept_direct ); - return Ok(response); + return upgrade_ws_or_serve_app( + connection, + remote, + listener.config.serve_app, + uri, + last_etag, + ); } else if listener.config.accept_forward_for == AcceptForwardForV0::No { if !remote.is_private() { return Err(make_error(StatusCode::FORBIDDEN)); @@ -387,7 +481,13 @@ impl Callback for SecurityCallback { prepare_urls_from_private_addrs(&listener.addrs, listener.config.port), )?; log_debug!("accepted private DIRECT"); - return Ok(response); + return upgrade_ws_or_serve_app( + connection, + remote, + listener.config.serve_app, + uri, + last_etag, + ); } } _ => {} @@ -410,10 +510,7 @@ pub async fn accept(tcp: TcpStream, peer_priv_key: Sensitive<[u8; 32]>) { ) .await; if ws.is_err() { - log_debug!("websocket rejected {:?}", ws.err()); - //let mut buffer = Vec::new(); - //tcp.read_to_end(&mut buffer).await; - //log_debug!("{:?}", buffer); + log_debug!("websocket rejected"); return; } @@ -459,7 +556,7 @@ pub async fn run_server_accept_one( pub async fn run_server_v0( peer_priv_key: Sensitive<[u8; 32]>, - peer_pub_key: PubKey, + peer_id: PubKey, wallet_master_key: Sensitive<[u8; 32]>, config: DaemonConfigV0, mut path: PathBuf, @@ -512,9 +609,12 @@ pub async fn run_server_v0( let mut listeners_addrs: Vec<(Vec, String)> = vec![]; let mut listeners: Vec = vec![]; let mut accept_clients = false; + //let mut serve_app = false; // TODO: check that there is only one PublicDyn or one PublicStatic or one Core + let mut servers: Vec = vec![]; + // Preparing the listeners addrs and infos for listener in config.listeners { if !listener.accept_direct && listener.accept_forward_for == AcceptForwardForV0::No { @@ -576,11 +676,26 @@ pub async fn run_server_v0( listener.interface_name ); } + // if listener.serve_app { + // serve_app = true; + // } + + let bind_addresses: Vec = + addrs.iter().map(|addr| addr.into()).collect(); + + let server_types = listener.get_bootstraps(bind_addresses.clone()); + for server_type in server_types { + servers.push(BrokerServerV0 { + peer_id, + server_type, + }) + } let listener_id: String = listener.to_string(); + let listener_info = ListenerInfo { config: listener, - addrs: addrs.iter().map(|addr| addr.into()).collect(), + addrs: bind_addresses, }; listener_infos.insert(listener_id, listener_info); @@ -598,11 +713,14 @@ pub async fn run_server_v0( log_warn!("There isn't any listener that accept clients. This is a misconfiguration as a core server that cannot receive client connections is useless"); } + let bootstrap = BootstrapContent::V0(BootstrapContentV0 { servers }); + BOOTSTRAP_STRING.set(json!(bootstrap).to_string()).unwrap(); + // saving the infos in the broker. This needs to happen before we start listening, as new incoming connections can happen anytime after that. // and we need those infos for permission checking. { let mut broker = BROKER.write().await; - broker.set_my_peer_id(peer_pub_key); + broker.set_my_peer_id(peer_id); LISTENERS_INFO .set(broker.set_listeners(listener_infos)) .unwrap(); diff --git a/p2p-client-ws/Cargo.toml b/p2p-client-ws/Cargo.toml index 6ecb205..f589725 100644 --- a/p2p-client-ws/Cargo.toml +++ b/p2p-client-ws/Cargo.toml @@ -33,4 +33,4 @@ features = ["js"] [target.'cfg(not(target_arch = "wasm32"))'.dependencies] getrandom = "0.2.7" xactor = "0.7.11" -async-tungstenite = { version = "0.22.2", features = ["async-std-runtime"] } +async-tungstenite = { git = "https://git.nextgraph.org/NextGraph/async-tungstenite.git", branch = "nextgraph", features = ["async-std-runtime"] } diff --git a/p2p-net/src/types.rs b/p2p-net/src/types.rs index 3060a29..7dcd238 100644 --- a/p2p-net/src/types.rs +++ b/p2p-net/src/types.rs @@ -118,6 +118,18 @@ pub struct BrokerServerV0 { pub peer_id: PubKey, } +/// Bootstrap content Version 0 +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct BootstrapContentV0 { + /// list of servers, in order of preference + pub servers: Vec, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +pub enum BootstrapContent { + V0(BootstrapContentV0), +} + /// ListenerInfo #[cfg(not(target_arch = "wasm32"))] #[derive(Clone, Debug, Serialize, Deserialize)] @@ -274,6 +286,61 @@ impl ListenerV0 { accept_forward_for: AcceptForwardForV0::No, } } + + pub fn get_bootstraps(&self, addrs: Vec) -> Vec { + let mut res: Vec = vec![]; + match self.accept_forward_for { + AcceptForwardForV0::PublicStatic(_) => { + if !self.refuse_clients { + res.push(BrokerServerTypeV0::BoxPublic( + self.accept_forward_for.get_public_bind_addresses(), + )); + } + if self.accept_direct { + res.push(BrokerServerTypeV0::BoxPrivate(addrs)); + } + } + AcceptForwardForV0::PublicDyn(_) => { + if !self.refuse_clients { + res.push(BrokerServerTypeV0::BoxPublicDyn( + // self.accept_forward_for.get_public_bind_addresses(), //FIXME. we should use this, but for now it isnt implemented + vec![], + )); + } + if self.accept_direct { + res.push(BrokerServerTypeV0::BoxPrivate(addrs)); + } + } + AcceptForwardForV0::PublicDomain(_) | AcceptForwardForV0::PublicDomainPeer(_) => { + res.push(BrokerServerTypeV0::Domain( + self.accept_forward_for.get_domain().to_string(), + )); + if self.accept_direct { + if self.if_type == InterfaceType::Private { + res.push(BrokerServerTypeV0::BoxPrivate(addrs)); + } else if self.if_type == InterfaceType::Loopback { + res.push(BrokerServerTypeV0::Localhost(addrs[0].port)); + } + } + } + AcceptForwardForV0::PrivateDomain(_) => { + res.push(BrokerServerTypeV0::Domain( + self.accept_forward_for.get_domain().to_string(), + )); + } + AcceptForwardForV0::No => { + if self.if_type == InterfaceType::Loopback { + res.push(BrokerServerTypeV0::Localhost(addrs[0].port)); + } else if self.if_type == InterfaceType::Public && !self.refuse_clients { + res.push(BrokerServerTypeV0::BoxPublic(addrs)); + } else if self.if_type == InterfaceType::Private { + res.push(BrokerServerTypeV0::BoxPrivate(addrs)); + } + } + _ => panic!("get_bootstrap missing"), + } + res + } } #[cfg(not(target_arch = "wasm32"))] impl fmt::Display for ListenerV0 { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 89bf942..b77d24c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -21,6 +21,7 @@ importers: flowbite-svelte: ^0.37.1 internal-ip: ^7.0.0 ng-sdk-js: workspace:^0.1.0 + node-gzip: ^1.1.2 postcss: ^8.4.23 postcss-load-config: ^4.0.1 svelte: ^3.54.0 @@ -53,6 +54,7 @@ importers: autoprefixer: 10.4.14_postcss@8.4.24 cross-env: 7.0.3 internal-ip: 7.0.0 + node-gzip: 1.1.2 postcss: 8.4.24 postcss-load-config: 4.0.1_postcss@8.4.24 svelte: 3.59.1 @@ -72,12 +74,31 @@ importers: ngone/web: specifiers: '@sveltejs/vite-plugin-svelte': ^2.0.4 + autoprefixer: ^10.4.14 + flowbite: ^1.6.5 + flowbite-svelte: ^0.37.1 + postcss: ^8.4.23 + postcss-load-config: ^4.0.1 svelte: ^3.58.0 + svelte-preprocess: ^5.0.3 + svelte-spa-router: ^3.3.0 + tailwindcss: ^3.3.1 vite: ^4.3.9 + vite-plugin-svelte-svg: ^2.2.1 + dependencies: + flowbite: 1.6.5 + flowbite-svelte: 0.37.3_svelte@3.59.1 + svelte-spa-router: 3.3.0 devDependencies: '@sveltejs/vite-plugin-svelte': 2.4.1_svelte@3.59.1+vite@4.3.9 + autoprefixer: 10.4.14_postcss@8.4.24 + postcss: 8.4.24 + postcss-load-config: 4.0.1_postcss@8.4.24 svelte: 3.59.1 + svelte-preprocess: 5.0.4_sxhny56dlbcmwov4vk7qwrzshi + tailwindcss: 3.3.2 vite: 4.3.9 + vite-plugin-svelte-svg: 2.2.1_svelte@3.59.1+vite@4.3.9 packages: @@ -1227,6 +1248,10 @@ packages: engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true + /node-gzip/1.1.2: + resolution: {integrity: sha512-ZB6zWpfZHGtxZnPMrJSKHVPrRjURoUzaDbLFj3VO70mpLTW5np96vXyHwft4Id0o+PYIzgDkBUjIzaNHhQ8srw==} + dev: true + /node-releases/2.0.12: resolution: {integrity: sha512-QzsYKWhXTWx8h1kIvqfnC++o0pEmpRQA/aenALsL2F4pqNVr7YzcdMlDij5WBnwftRbJCNJL/O7zdKaxKPHqgQ==} dev: true @@ -1631,6 +1656,54 @@ packages: typescript: 5.1.3 dev: true + /svelte-preprocess/5.0.4_sxhny56dlbcmwov4vk7qwrzshi: + resolution: {integrity: sha512-ABia2QegosxOGsVlsSBJvoWeXy1wUKSfF7SWJdTjLAbx/Y3SrVevvvbFNQqrSJw89+lNSsM58SipmZJ5SRi5iw==} + engines: {node: '>= 14.10.0'} + requiresBuild: true + peerDependencies: + '@babel/core': ^7.10.2 + coffeescript: ^2.5.1 + less: ^3.11.3 || ^4.0.0 + postcss: ^7 || ^8 + postcss-load-config: ^2.1.0 || ^3.0.0 || ^4.0.0 + pug: ^3.0.0 + sass: ^1.26.8 + stylus: ^0.55.0 + sugarss: ^2.0.0 || ^3.0.0 || ^4.0.0 + svelte: ^3.23.0 || ^4.0.0-next.0 || ^4.0.0 + typescript: '>=3.9.5 || ^4.0.0 || ^5.0.0' + peerDependenciesMeta: + '@babel/core': + optional: true + coffeescript: + optional: true + less: + optional: true + postcss: + optional: true + postcss-load-config: + optional: true + pug: + optional: true + sass: + optional: true + stylus: + optional: true + sugarss: + optional: true + typescript: + optional: true + dependencies: + '@types/pug': 2.0.6 + detect-indent: 6.1.0 + magic-string: 0.27.0 + postcss: 8.4.24 + postcss-load-config: 4.0.1_postcss@8.4.24 + sorcery: 0.11.0 + strip-indent: 3.0.0 + svelte: 3.59.1 + dev: true + /svelte-preprocess/5.0.4_vmz4xia4c7tzh4ii3qac2x3tom: resolution: {integrity: sha512-ABia2QegosxOGsVlsSBJvoWeXy1wUKSfF7SWJdTjLAbx/Y3SrVevvvbFNQqrSJw89+lNSsM58SipmZJ5SRi5iw==} engines: {node: '>= 14.10.0'}