diff --git a/Cargo.lock b/Cargo.lock index ec370fb405..34e69c2c22 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,15 +17,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" -[[package]] -name = "aead" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331" -dependencies = [ - "generic-array", -] - [[package]] name = "aead" version = "0.4.3" @@ -33,28 +24,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" dependencies = [ "generic-array", - "rand_core 0.6.4", -] - -[[package]] -name = "aead" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c192eb8f11fc081b0fe4259ba5af04217d4e0faddd02417310a927911abd7c8" -dependencies = [ - "crypto-common", - "generic-array", -] - -[[package]] -name = "aes" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561" -dependencies = [ - "aes-soft", - "aesni", - "cipher 0.2.5", ] [[package]] @@ -64,81 +33,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" dependencies = [ "cfg-if", - "cipher 0.3.0", + "cipher", "cpufeatures", "opaque-debug", ] -[[package]] -name = "aes" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433cfd6710c9986c576a25ca913c39d66a6474107b406f34f91d4a8923395241" -dependencies = [ - "cfg-if", - "cipher 0.4.4", - "cpufeatures", -] - [[package]] name = "aes-gcm" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df5f85a83a7d8b0442b6aa7b504b8212c1733da07b98aae43d4bc21b2cb3cdf6" dependencies = [ - "aead 0.4.3", - "aes 0.7.5", - "cipher 0.3.0", - "ctr 0.8.0", - "ghash 0.4.4", - "subtle", -] - -[[package]] -name = "aes-gcm" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e1366e0c69c9f927b1fa5ce2c7bf9eafc8f9268c0b9800729e8b267612447c" -dependencies = [ - "aead 0.5.1", - "aes 0.8.2", - "cipher 0.4.4", - "ctr 0.9.2", - "ghash 0.5.0", + "aead", + "aes", + "cipher", + "ctr", + "ghash", "subtle", ] -[[package]] -name = "aes-soft" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072" -dependencies = [ - "cipher 0.2.5", - "opaque-debug", -] - -[[package]] -name = "aesni" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce" -dependencies = [ - "cipher 0.2.5", - "opaque-debug", -] - -[[package]] -name = "ahash" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" -dependencies = [ - "getrandom 0.2.8", - "once_cell", - "version_check", -] - [[package]] name = "ahash" version = "0.8.3" @@ -237,12 +150,6 @@ version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" -[[package]] -name = "arc-swap" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" - [[package]] name = "ark-crypto-primitives" version = "0.4.0" @@ -260,7 +167,7 @@ dependencies = [ "derivative", "digest 0.10.7", "rayon", - "sha2 0.10.8", + "sha2", "tracing", ] @@ -452,7 +359,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" dependencies = [ "num-traits", - "rand 0.8.5", + "rand", "rayon", ] @@ -477,29 +384,13 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" -[[package]] -name = "asn1-rs" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30ff05a702273012438132f449575dbc804e27b2f3cbe3069aa237d26c98fa33" -dependencies = [ - "asn1-rs-derive 0.1.0", - "asn1-rs-impl", - "displaydoc", - "nom", - "num-traits", - "rusticata-macros", - "thiserror", - "time", -] - [[package]] name = "asn1-rs" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f6fd5ddaf0351dff5b8da21b2fb4ff8e08ddd02857f0bf69c47639106c0fff0" dependencies = [ - "asn1-rs-derive 0.4.0", + "asn1-rs-derive", "asn1-rs-impl", "displaydoc", "nom", @@ -509,18 +400,6 @@ dependencies = [ "time", ] -[[package]] -name = "asn1-rs-derive" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db8b7511298d5b7784b40b092d9e9dcd3a627a5707e4b5e507931ab0d44eeebf" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", - "synstructure", -] - [[package]] name = "asn1-rs-derive" version = "0.4.0" @@ -544,12 +423,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "asn1_der" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e22d1f4b888c298a027c99dc9048015fac177587de20fc30232a057dfbe24a21" - [[package]] name = "async-io" version = "1.12.0" @@ -587,7 +460,7 @@ checksum = "ad445822218ce64be7a341abfb0b1ea43b5c23aa83902542a4542e78309d8e5e" dependencies = [ "async-stream-impl", "futures-core", - "pin-project-lite 0.2.13", + "pin-project-lite", ] [[package]] @@ -609,7 +482,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -622,7 +495,20 @@ dependencies = [ "futures-sink", "futures-util", "memchr", - "pin-project-lite 0.2.13", + "pin-project-lite", +] + +[[package]] +name = "asynchronous-codec" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a860072022177f903e59730004fb5dc13db9275b79bb2aef7ba8ce831956c233" +dependencies = [ + "bytes", + "futures-sink", + "futures-util", + "memchr", + "pin-project-lite", ] [[package]] @@ -635,10 +521,15 @@ dependencies = [ ] [[package]] -name = "atomic-waker" -version = "1.1.0" +name = "attohttpc" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "debc29dde2e69f9e47506b525f639ed42300fc014a3e007832592448fa8e4599" +checksum = "8d9a9bf8b79a749ee0b911b91b671cc2b6c670bdbc7e3dfd537576ddc94bb2a2" +dependencies = [ + "http", + "log", + "url", +] [[package]] name = "autocfg" @@ -665,7 +556,7 @@ dependencies = [ "memchr", "mime", "percent-encoding", - "pin-project-lite 0.2.13", + "pin-project-lite", "rustversion", "serde", "sync_wrapper", @@ -712,12 +603,6 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" -[[package]] -name = "base16ct" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" - [[package]] name = "base64" version = "0.13.1" @@ -751,15 +636,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7dfdb4953a096c551ce9ace855a604d702e6e62d77fac690575ae347571717f5" -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - [[package]] name = "bindgen" version = "0.68.1" @@ -777,7 +653,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -856,27 +732,14 @@ dependencies = [ ] [[package]] -name = "block-modes" -version = "0.7.0" +name = "bs58" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57a0e8073e8baa88212fb5823574c02ebccb395136ba9a164ab89379ec6072f0" +checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" dependencies = [ - "block-padding", - "cipher 0.2.5", + "tinyvec", ] -[[package]] -name = "block-padding" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" - -[[package]] -name = "bs58" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" - [[package]] name = "bumpalo" version = "3.12.0" @@ -900,19 +763,11 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" - -[[package]] -name = "ccm" -version = "0.3.0" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aca1a8fbc20b50ac9673ff014abfb2b5f4085ee1a850d408f14a159c5853ac7" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ - "aead 0.3.2", - "cipher 0.2.5", - "subtle", + "libc", ] [[package]] @@ -938,7 +793,7 @@ checksum = "45565fc9416b9896014f5732ac776f810ee53a66730c17e4020c3ec064a8f88f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -948,7 +803,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c80e5460aa66fe3b91d40bcbdab953a597b60053e34d684ac6903f863b680a6" dependencies = [ "cfg-if", - "cipher 0.3.0", + "cipher", "cpufeatures", "zeroize", ] @@ -959,9 +814,9 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a18446b09be63d457bbec447509e85f662f32952b035ce892290396bc0b0cff5" dependencies = [ - "aead 0.4.3", + "aead", "chacha20", - "cipher 0.3.0", + "cipher", "poly1305", "zeroize", ] @@ -979,15 +834,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "cipher" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" -dependencies = [ - "generic-array", -] - [[package]] name = "cipher" version = "0.3.0" @@ -997,16 +843,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "cipher" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" -dependencies = [ - "crypto-common", - "inout", -] - [[package]] name = "clang-sys" version = "1.6.0" @@ -1049,7 +885,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -1232,21 +1068,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crc" -version = "3.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe" -dependencies = [ - "crc-catalog", -] - -[[package]] -name = "crc-catalog" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cace84e55f07e7301bae1c519df89cdad8cc3cd868413d3fdbdeca9ff3db484" - [[package]] name = "crc32fast" version = "1.3.2" @@ -1292,7 +1113,7 @@ dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", - "memoffset 0.8.0", + "memoffset", "scopeguard", ] @@ -1311,18 +1132,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" -[[package]] -name = "crypto-bigint" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" -dependencies = [ - "generic-array", - "rand_core 0.6.4", - "subtle", - "zeroize", -] - [[package]] name = "crypto-common" version = "0.1.6" @@ -1330,60 +1139,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", - "rand_core 0.6.4", "typenum", ] -[[package]] -name = "crypto-mac" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" -dependencies = [ - "generic-array", - "subtle", -] - [[package]] name = "ctr" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" dependencies = [ - "cipher 0.3.0", -] - -[[package]] -name = "ctr" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" -dependencies = [ - "cipher 0.4.4", -] - -[[package]] -name = "cuckoofilter" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b810a8449931679f64cd7eef1bbd0fa315801b6d5d9cdc1ace2804d6529eee18" -dependencies = [ - "byteorder", - "fnv", - "rand 0.7.3", -] - -[[package]] -name = "curve25519-dalek" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" -dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.5.1", - "subtle", - "zeroize", + "cipher", ] [[package]] @@ -1411,7 +1176,7 @@ checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -1503,7 +1268,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -1525,7 +1290,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core 0.20.3", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -1556,36 +1321,21 @@ dependencies = [ [[package]] name = "der" -version = "0.6.1" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" +checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" dependencies = [ "const-oid", - "pem-rfc7468", "zeroize", ] -[[package]] -name = "der-parser" -version = "7.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe398ac75057914d7d07307bf67dc7f3f574a26783b4fc7805a20ffa9f506e82" -dependencies = [ - "asn1-rs 0.3.1", - "displaydoc", - "nom", - "num-bigint 0.4.3", - "num-traits", - "rusticata-macros", -] - [[package]] name = "der-parser" version = "8.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dbd676fbbab537128ef0278adb5576cf363cff6aa22a7b24effe97347cfab61e" dependencies = [ - "asn1-rs 0.5.2", + "asn1-rs", "displaydoc", "nom", "num-bigint 0.4.3", @@ -1614,34 +1364,13 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "derive_builder" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07adf7be193b71cc36b193d0f5fe60b918a3a9db4dad0449f57bcfd519704a3" -dependencies = [ - "derive_builder_macro 0.11.2", -] - [[package]] name = "derive_builder" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d67778784b508018359cbc8696edb3db78160bab2c2a28ba7f56ef6932997f8" dependencies = [ - "derive_builder_macro 0.12.0", -] - -[[package]] -name = "derive_builder_core" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f91d4cfa921f1c05904dc3c57b4a32c38aed3340cce209f3a6fd1478babafc4" -dependencies = [ - "darling 0.14.3", - "proc-macro2", - "quote", - "syn 1.0.109", + "derive_builder_macro", ] [[package]] @@ -1656,23 +1385,13 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "derive_builder_macro" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f0314b72bed045f3a68671b3c86328386762c93f82d98c65c3cb5e5f573dd68" -dependencies = [ - "derive_builder_core 0.11.2", - "syn 1.0.109", -] - [[package]] name = "derive_builder_macro" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebcda35c7a396850a55ffeac740804b40ffec779b98fffbb1738f4033f0ee79e" dependencies = [ - "derive_builder_core 0.12.0", + "derive_builder_core", "syn 1.0.109", ] @@ -1754,47 +1473,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65d09067bfacaa79114679b279d7f5885b53295b1e2cfb4e79c8e4bd3d633169" [[package]] -name = "ecdsa" -version = "0.14.8" +name = "ed25519" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" -dependencies = [ - "der", - "elliptic-curve", - "rfc6979", - "signature 1.6.4", -] - -[[package]] -name = "ed25519" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" -dependencies = [ - "signature 1.6.4", -] - -[[package]] -name = "ed25519" -version = "2.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60f6d271ca33075c88028be6f04d502853d63a5ece419d269c15315d4fc1cf1d" +checksum = "60f6d271ca33075c88028be6f04d502853d63a5ece419d269c15315d4fc1cf1d" dependencies = [ + "pkcs8", "serde", - "signature 2.1.0", + "signature", ] [[package]] name = "ed25519-dalek" -version = "1.0.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +checksum = "1f628eaec48bfd21b865dc2950cfa014450c01d2fa2b69a86c2fd5844ec523c0" dependencies = [ - "curve25519-dalek 3.2.0", - "ed25519 1.5.3", - "rand 0.7.3", + "curve25519-dalek", + "ed25519", + "rand_core", "serde", - "sha2 0.9.9", + "sha2", + "subtle", "zeroize", ] @@ -1804,43 +1504,21 @@ version = "4.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d9ce6874da5d4415896cd45ffbc4d1cfc0c4f9c079427bd870742c30f2f65a9" dependencies = [ - "curve25519-dalek 4.1.1", - "ed25519 2.2.2", + "curve25519-dalek", + "ed25519", "hashbrown 0.14.0", "hex", - "rand_core 0.6.4", + "rand_core", "serde", - "sha2 0.10.8", + "sha2", "zeroize", ] [[package]] name = "either" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" - -[[package]] -name = "elliptic-curve" -version = "0.12.3" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" -dependencies = [ - "base16ct", - "crypto-bigint", - "der", - "digest 0.10.7", - "ff", - "generic-array", - "group", - "hkdf", - "pem-rfc7468", - "pkcs8", - "rand_core 0.6.4", - "sec1", - "subtle", - "zeroize", -] +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "embedded-io" @@ -1865,14 +1543,14 @@ dependencies = [ [[package]] name = "enum-as-inner" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9720bba047d567ffc8a3cba48bf19126600e249ab7f128e9233e6376976a116" +checksum = "5ffccbb6966c05b32ef8fbac435df276c4ae4d3dc55a8cd0eb9745e6c12f546a" dependencies = [ "heck", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.39", ] [[package]] @@ -1917,16 +1595,6 @@ dependencies = [ "instant", ] -[[package]] -name = "ff" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" -dependencies = [ - "rand_core 0.6.4", - "subtle", -] - [[package]] name = "fiat-crypto" version = "0.2.2" @@ -1946,7 +1614,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" dependencies = [ "crc32fast", - "libz-sys", "miniz_oxide", ] @@ -2001,6 +1668,15 @@ dependencies = [ "futures-util", ] +[[package]] +name = "futures-bounded" +version = "0.2.1" +source = "git+https://github.com/jsdanielh/rust-libp2p.git?branch=libp2p_0.53.1#a68748fb1170e536a725b1e10a1b762aefac8176" +dependencies = [ + "futures-timer", + "futures-util", +] + [[package]] name = "futures-channel" version = "0.3.29" @@ -2046,7 +1722,7 @@ dependencies = [ "futures-io", "memchr", "parking", - "pin-project-lite 0.2.13", + "pin-project-lite", "waker-fn", ] @@ -2058,18 +1734,17 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] name = "futures-rustls" -version = "0.22.2" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2411eed028cdf8c8034eaf21f9915f956b6c3abec4d4c7949ee67f0721127bd" +checksum = "35bd3cf68c183738046838e300353e4716c674dc5e56890de4826801a6622a28" dependencies = [ "futures-io", - "rustls 0.20.8", - "webpki 0.22.0", + "rustls", ] [[package]] @@ -2084,6 +1759,17 @@ version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" +[[package]] +name = "futures-ticker" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9763058047f713632a52e916cc7f6a4b3fc6e9fc1ff8c5b1dc49e5a89041682e" +dependencies = [ + "futures", + "futures-timer", + "instant", +] + [[package]] name = "futures-timer" version = "3.0.2" @@ -2107,7 +1793,7 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project-lite 0.2.13", + "pin-project-lite", "pin-utils", "slab", ] @@ -2124,25 +1810,14 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - -[[package]] -name = "getrandom" -version = "0.2.8" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" dependencies = [ "cfg-if", "js-sys", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", "wasm-bindgen", ] @@ -2153,17 +1828,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" dependencies = [ "opaque-debug", - "polyval 0.5.3", -] - -[[package]] -name = "ghash" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d930750de5717d2dd0b8c0d42c076c0e884c81a73e6cab859bbd2339c71e3e40" -dependencies = [ - "opaque-debug", - "polyval 0.6.0", + "polyval", ] [[package]] @@ -2190,17 +1855,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "group" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" -dependencies = [ - "ff", - "rand_core 0.6.4", - "subtle", -] - [[package]] name = "h2" version = "0.3.17" @@ -2234,9 +1888,6 @@ name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -dependencies = [ - "ahash 0.7.6", -] [[package]] name = "hashbrown" @@ -2244,7 +1895,7 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ - "ahash 0.8.3", + "ahash", ] [[package]] @@ -2253,7 +1904,7 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" dependencies = [ - "ahash 0.8.3", + "ahash", "allocator-api2", ] @@ -2343,22 +1994,58 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b07f60793ff0a4d9cef0f18e63b5357e06209987153a64648c972c1e5aff336f" [[package]] -name = "hkdf" -version = "0.12.3" +name = "hickory-proto" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" +checksum = "091a6fbccf4860009355e3efc52ff4acf37a63489aad7435372d44ceeb6fbbcf" +dependencies = [ + "async-trait", + "cfg-if", + "data-encoding", + "enum-as-inner", + "futures-channel", + "futures-io", + "futures-util", + "idna", + "ipnet", + "once_cell", + "rand", + "socket2 0.5.5", + "thiserror", + "tinyvec", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "hickory-resolver" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35b8f021164e6a984c9030023544c57789c51760065cd510572fedcfb04164e8" dependencies = [ - "hmac 0.12.1", + "cfg-if", + "futures-util", + "hickory-proto", + "ipconfig", + "lru-cache", + "once_cell", + "parking_lot 0.12.1", + "rand", + "resolv-conf", + "smallvec", + "thiserror", + "tokio", + "tracing", ] [[package]] -name = "hmac" -version = "0.11.0" +name = "hkdf" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" +checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" dependencies = [ - "crypto-mac", - "digest 0.9.0", + "hmac", ] [[package]] @@ -2400,7 +2087,7 @@ checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ "bytes", "http", - "pin-project-lite 0.2.13", + "pin-project-lite", ] [[package]] @@ -2437,7 +2124,7 @@ dependencies = [ "httparse", "httpdate", "itoa", - "pin-project-lite 0.2.13", + "pin-project-lite", "socket2 0.4.9", "tokio", "tower-service", @@ -2455,7 +2142,7 @@ dependencies = [ "http", "hyper", "log", - "rustls 0.21.6", + "rustls", "rustls-native-certs", "tokio", "tokio-rustls", @@ -2468,7 +2155,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ "hyper", - "pin-project-lite 0.2.13", + "pin-project-lite", "tokio", "tokio-io-timeout", ] @@ -2516,17 +2203,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" -[[package]] -name = "idna" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "idna" version = "0.4.0" @@ -2549,9 +2225,9 @@ dependencies = [ [[package]] name = "if-watch" -version = "3.0.0" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba7abdbb86e485125dad06c2691e1e393bf3b08c7b743b43aa162a00fd39062e" +checksum = "bbb892e5777fe09e16f3d44de7802f4daa7267ecbe8c466f19d94e25bb0c303e" dependencies = [ "async-io", "core-foundation", @@ -2566,6 +2242,25 @@ dependencies = [ "windows", ] +[[package]] +name = "igd-next" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57e065e90a518ab5fedf79aa1e4b784e10f8e484a834f6bda85c42633a2cb7af" +dependencies = [ + "async-trait", + "attohttpc", + "bytes", + "futures", + "http", + "hyper", + "log", + "rand", + "tokio", + "url", + "xmltree", +] + [[package]] name = "indexmap" version = "1.9.2" @@ -2601,15 +2296,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "inout" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" -dependencies = [ - "generic-array", -] - [[package]] name = "instant" version = "0.1.12" @@ -2622,25 +2308,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "interceptor" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e8a11ae2da61704edada656798b61c94b35ecac2c58eb955156987d5e6be90b" -dependencies = [ - "async-trait", - "bytes", - "log", - "rand 0.8.5", - "rtcp", - "rtp", - "thiserror", - "tokio", - "waitgroup", - "webrtc-srtp", - "webrtc-util", -] - [[package]] name = "io-lifetimes" version = "1.0.11" @@ -2794,9 +2461,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "libloading" @@ -2827,162 +2494,186 @@ dependencies = [ [[package]] name = "libp2p" -version = "0.50.0" -source = "git+https://github.com/jsdanielh/rust-libp2p.git#94d669b3e4dd99d7735c2fd1cbc0412b8fad7353" +version = "0.53.1" +source = "git+https://github.com/jsdanielh/rust-libp2p.git?branch=libp2p_0.53.1#a68748fb1170e536a725b1e10a1b762aefac8176" dependencies = [ "bytes", + "either", "futures", "futures-timer", - "getrandom 0.2.8", + "getrandom", "instant", + "libp2p-allow-block-list", + "libp2p-connection-limits", "libp2p-core", "libp2p-dns", - "libp2p-floodsub", "libp2p-gossipsub", "libp2p-identify", + "libp2p-identity", "libp2p-kad", "libp2p-mdns", "libp2p-metrics", - "libp2p-mplex", "libp2p-noise", "libp2p-ping", "libp2p-quic", "libp2p-request-response", "libp2p-swarm", "libp2p-tcp", - "libp2p-webrtc", + "libp2p-upnp", "libp2p-websocket", + "libp2p-websocket-websys", "libp2p-yamux", "multiaddr", - "parking_lot 0.12.1", "pin-project", - "smallvec", + "rw-stream-sink", + "thiserror", +] + +[[package]] +name = "libp2p-allow-block-list" +version = "0.3.0" +source = "git+https://github.com/jsdanielh/rust-libp2p.git?branch=libp2p_0.53.1#a68748fb1170e536a725b1e10a1b762aefac8176" +dependencies = [ + "libp2p-core", + "libp2p-identity", + "libp2p-swarm", + "void", +] + +[[package]] +name = "libp2p-connection-limits" +version = "0.3.0" +source = "git+https://github.com/jsdanielh/rust-libp2p.git?branch=libp2p_0.53.1#a68748fb1170e536a725b1e10a1b762aefac8176" +dependencies = [ + "libp2p-core", + "libp2p-identity", + "libp2p-swarm", + "void", ] [[package]] name = "libp2p-core" -version = "0.38.0" -source = "git+https://github.com/jsdanielh/rust-libp2p.git#94d669b3e4dd99d7735c2fd1cbc0412b8fad7353" +version = "0.41.1" +source = "git+https://github.com/jsdanielh/rust-libp2p.git?branch=libp2p_0.53.1#a68748fb1170e536a725b1e10a1b762aefac8176" dependencies = [ - "asn1_der", - "bs58", - "ed25519-dalek", "either", "fnv", "futures", "futures-timer", "instant", - "log", + "libp2p-identity", "multiaddr", "multihash", "multistream-select", "once_cell", "parking_lot 0.12.1", "pin-project", - "prost 0.11.8", - "prost-build", - "rand 0.8.5", + "quick-protobuf", + "rand", "rw-stream-sink", - "sec1", "serde", - "sha2 0.10.8", "smallvec", "thiserror", - "unsigned-varint", + "tracing", + "unsigned-varint 0.7.2", "void", - "zeroize", ] [[package]] name = "libp2p-dns" -version = "0.38.0" -source = "git+https://github.com/jsdanielh/rust-libp2p.git#94d669b3e4dd99d7735c2fd1cbc0412b8fad7353" -dependencies = [ - "futures", - "libp2p-core", - "log", - "parking_lot 0.12.1", - "smallvec", - "trust-dns-resolver", -] - -[[package]] -name = "libp2p-floodsub" version = "0.41.0" -source = "git+https://github.com/jsdanielh/rust-libp2p.git#94d669b3e4dd99d7735c2fd1cbc0412b8fad7353" +source = "git+https://github.com/jsdanielh/rust-libp2p.git?branch=libp2p_0.53.1#a68748fb1170e536a725b1e10a1b762aefac8176" dependencies = [ - "cuckoofilter", - "fnv", + "async-trait", "futures", + "hickory-resolver", "libp2p-core", - "libp2p-swarm", - "log", - "prost 0.11.8", - "prost-build", - "rand 0.8.5", + "libp2p-identity", + "parking_lot 0.12.1", "smallvec", - "thiserror", + "tracing", ] [[package]] name = "libp2p-gossipsub" -version = "0.43.0" -source = "git+https://github.com/jsdanielh/rust-libp2p.git#94d669b3e4dd99d7735c2fd1cbc0412b8fad7353" +version = "0.46.0" +source = "git+https://github.com/jsdanielh/rust-libp2p.git?branch=libp2p_0.53.1#a68748fb1170e536a725b1e10a1b762aefac8176" dependencies = [ - "asynchronous-codec", - "base64 0.13.1", + "asynchronous-codec 0.6.1", + "base64 0.21.5", "byteorder", "bytes", + "either", "fnv", "futures", - "futures-timer", + "futures-ticker", + "getrandom", "hex_fmt", "instant", "libp2p-core", + "libp2p-identity", "libp2p-swarm", - "log", - "pin-project", - "prometheus-client 0.18.1", - "prost 0.11.8", - "prost-build", - "prost-codec", - "rand 0.8.5", + "prometheus-client", + "quick-protobuf", + "quick-protobuf-codec", + "rand", "regex", "serde", - "sha2 0.10.8", + "sha2", "smallvec", - "thiserror", - "unsigned-varint", - "wasm-timer", + "tracing", + "unsigned-varint 0.7.2", + "void", ] [[package]] name = "libp2p-identify" -version = "0.41.0" -source = "git+https://github.com/jsdanielh/rust-libp2p.git#94d669b3e4dd99d7735c2fd1cbc0412b8fad7353" +version = "0.44.0" +source = "git+https://github.com/jsdanielh/rust-libp2p.git?branch=libp2p_0.53.1#a68748fb1170e536a725b1e10a1b762aefac8176" dependencies = [ - "asynchronous-codec", + "asynchronous-codec 0.6.1", + "either", "futures", + "futures-bounded", "futures-timer", "libp2p-core", + "libp2p-identity", "libp2p-swarm", - "log", "lru", - "prost 0.11.8", - "prost-build", - "prost-codec", + "quick-protobuf", + "quick-protobuf-codec", "smallvec", "thiserror", + "tracing", "void", ] +[[package]] +name = "libp2p-identity" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "999ec70441b2fb35355076726a6bc466c932e9bdc66f6a11c6c0aa17c7ab9be0" +dependencies = [ + "bs58", + "ed25519-dalek", + "hkdf", + "multihash", + "quick-protobuf", + "rand", + "serde", + "sha2", + "thiserror", + "tracing", + "zeroize", +] + [[package]] name = "libp2p-kad" -version = "0.42.0" -source = "git+https://github.com/jsdanielh/rust-libp2p.git#94d669b3e4dd99d7735c2fd1cbc0412b8fad7353" +version = "0.45.1" +source = "git+https://github.com/jsdanielh/rust-libp2p.git?branch=libp2p_0.53.1#a68748fb1170e536a725b1e10a1b762aefac8176" dependencies = [ "arrayvec 0.7.4", - "asynchronous-codec", + "asynchronous-codec 0.6.1", "bytes", "either", "fnv", @@ -2990,296 +2681,275 @@ dependencies = [ "futures-timer", "instant", "libp2p-core", + "libp2p-identity", "libp2p-swarm", - "log", - "prost 0.11.8", - "prost-build", - "rand 0.8.5", + "quick-protobuf", + "quick-protobuf-codec", + "rand", "serde", - "sha2 0.10.8", + "sha2", "smallvec", "thiserror", + "tracing", "uint", - "unsigned-varint", + "unsigned-varint 0.7.2", "void", ] [[package]] name = "libp2p-mdns" -version = "0.42.0" -source = "git+https://github.com/jsdanielh/rust-libp2p.git#94d669b3e4dd99d7735c2fd1cbc0412b8fad7353" +version = "0.45.0" +source = "git+https://github.com/jsdanielh/rust-libp2p.git?branch=libp2p_0.53.1#a68748fb1170e536a725b1e10a1b762aefac8176" dependencies = [ "data-encoding", "futures", + "hickory-proto", "if-watch", "libp2p-core", + "libp2p-identity", "libp2p-swarm", - "log", - "rand 0.8.5", + "rand", "smallvec", - "socket2 0.4.9", + "socket2 0.5.5", "tokio", - "trust-dns-proto", + "tracing", "void", ] [[package]] name = "libp2p-metrics" -version = "0.11.0" -source = "git+https://github.com/jsdanielh/rust-libp2p.git#94d669b3e4dd99d7735c2fd1cbc0412b8fad7353" +version = "0.14.1" +source = "git+https://github.com/jsdanielh/rust-libp2p.git?branch=libp2p_0.53.1#a68748fb1170e536a725b1e10a1b762aefac8176" dependencies = [ + "futures", + "instant", "libp2p-core", "libp2p-gossipsub", "libp2p-identify", + "libp2p-identity", "libp2p-kad", "libp2p-ping", "libp2p-swarm", - "prometheus-client 0.18.1", + "pin-project", + "prometheus-client", ] [[package]] -name = "libp2p-mplex" -version = "0.38.0" -source = "git+https://github.com/jsdanielh/rust-libp2p.git#94d669b3e4dd99d7735c2fd1cbc0412b8fad7353" +name = "libp2p-noise" +version = "0.44.0" +source = "git+https://github.com/jsdanielh/rust-libp2p.git?branch=libp2p_0.53.1#a68748fb1170e536a725b1e10a1b762aefac8176" dependencies = [ - "asynchronous-codec", + "asynchronous-codec 0.7.0", "bytes", + "curve25519-dalek", "futures", "libp2p-core", - "log", - "nohash-hasher", - "parking_lot 0.12.1", - "rand 0.8.5", - "smallvec", - "unsigned-varint", -] - -[[package]] -name = "libp2p-noise" -version = "0.41.0" -source = "git+https://github.com/jsdanielh/rust-libp2p.git#94d669b3e4dd99d7735c2fd1cbc0412b8fad7353" -dependencies = [ - "bytes", - "curve25519-dalek 3.2.0", - "futures", - "libp2p-core", - "log", + "libp2p-identity", + "multiaddr", + "multihash", "once_cell", - "prost 0.11.8", - "prost-build", - "rand 0.8.5", - "sha2 0.10.8", + "quick-protobuf", + "rand", + "sha2", "snow", "static_assertions", "thiserror", - "x25519-dalek 1.1.1", + "tracing", + "x25519-dalek", "zeroize", ] [[package]] name = "libp2p-ping" -version = "0.41.0" -source = "git+https://github.com/jsdanielh/rust-libp2p.git#94d669b3e4dd99d7735c2fd1cbc0412b8fad7353" +version = "0.44.0" +source = "git+https://github.com/jsdanielh/rust-libp2p.git?branch=libp2p_0.53.1#a68748fb1170e536a725b1e10a1b762aefac8176" dependencies = [ + "either", "futures", "futures-timer", "instant", "libp2p-core", + "libp2p-identity", "libp2p-swarm", - "log", - "rand 0.8.5", + "rand", + "tracing", "void", ] [[package]] name = "libp2p-quic" -version = "0.7.0-alpha" -source = "git+https://github.com/jsdanielh/rust-libp2p.git#94d669b3e4dd99d7735c2fd1cbc0412b8fad7353" +version = "0.10.1" +source = "git+https://github.com/jsdanielh/rust-libp2p.git?branch=libp2p_0.53.1#a68748fb1170e536a725b1e10a1b762aefac8176" dependencies = [ "bytes", "futures", "futures-timer", "if-watch", "libp2p-core", + "libp2p-identity", "libp2p-tls", - "log", "parking_lot 0.12.1", - "quinn-proto", - "rand 0.8.5", - "rustls 0.20.8", + "quinn", + "rand", + "ring 0.16.20", + "rustls", + "socket2 0.5.5", "thiserror", "tokio", + "tracing", ] [[package]] name = "libp2p-request-response" -version = "0.23.0" -source = "git+https://github.com/jsdanielh/rust-libp2p.git#94d669b3e4dd99d7735c2fd1cbc0412b8fad7353" +version = "0.26.0" +source = "git+https://github.com/jsdanielh/rust-libp2p.git?branch=libp2p_0.53.1#a68748fb1170e536a725b1e10a1b762aefac8176" dependencies = [ "async-trait", - "bytes", "futures", + "futures-bounded", + "futures-timer", "instant", "libp2p-core", + "libp2p-identity", "libp2p-swarm", - "log", - "rand 0.8.5", + "rand", "smallvec", - "unsigned-varint", + "tracing", + "void", ] [[package]] name = "libp2p-swarm" -version = "0.41.0" -source = "git+https://github.com/jsdanielh/rust-libp2p.git#94d669b3e4dd99d7735c2fd1cbc0412b8fad7353" +version = "0.44.0" +source = "git+https://github.com/jsdanielh/rust-libp2p.git?branch=libp2p_0.53.1#a68748fb1170e536a725b1e10a1b762aefac8176" dependencies = [ "either", "fnv", "futures", "futures-timer", - "getrandom 0.2.8", + "getrandom", "instant", "libp2p-core", + "libp2p-identity", "libp2p-swarm-derive", - "log", - "pin-project", - "rand 0.8.5", + "multistream-select", + "once_cell", + "rand", "smallvec", - "thiserror", "tokio", + "tracing", "void", "wasm-bindgen-futures", ] [[package]] name = "libp2p-swarm-derive" -version = "0.30.2" -source = "git+https://github.com/jsdanielh/rust-libp2p.git#94d669b3e4dd99d7735c2fd1cbc0412b8fad7353" +version = "0.34.0" +source = "git+https://github.com/jsdanielh/rust-libp2p.git?branch=libp2p_0.53.1#a68748fb1170e536a725b1e10a1b762aefac8176" dependencies = [ "heck", + "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.39", ] [[package]] name = "libp2p-tcp" -version = "0.38.0" -source = "git+https://github.com/jsdanielh/rust-libp2p.git#94d669b3e4dd99d7735c2fd1cbc0412b8fad7353" +version = "0.41.0" +source = "git+https://github.com/jsdanielh/rust-libp2p.git?branch=libp2p_0.53.1#a68748fb1170e536a725b1e10a1b762aefac8176" dependencies = [ "futures", "futures-timer", "if-watch", "libc", "libp2p-core", - "log", - "socket2 0.4.9", + "libp2p-identity", + "socket2 0.5.5", "tokio", + "tracing", ] [[package]] name = "libp2p-tls" -version = "0.1.0-alpha" -source = "git+https://github.com/jsdanielh/rust-libp2p.git#94d669b3e4dd99d7735c2fd1cbc0412b8fad7353" +version = "0.3.0" +source = "git+https://github.com/jsdanielh/rust-libp2p.git?branch=libp2p_0.53.1#a68748fb1170e536a725b1e10a1b762aefac8176" dependencies = [ "futures", "futures-rustls", "libp2p-core", - "rcgen 0.10.0", - "ring", - "rustls 0.20.8", + "libp2p-identity", + "rcgen", + "ring 0.16.20", + "rustls", + "rustls-webpki", "thiserror", - "webpki 0.22.0", - "x509-parser 0.14.0", + "x509-parser", "yasna", ] [[package]] -name = "libp2p-webrtc" -version = "0.4.0-alpha" -source = "git+https://github.com/jsdanielh/rust-libp2p.git#94d669b3e4dd99d7735c2fd1cbc0412b8fad7353" +name = "libp2p-upnp" +version = "0.2.0" +source = "git+https://github.com/jsdanielh/rust-libp2p.git?branch=libp2p_0.53.1#a68748fb1170e536a725b1e10a1b762aefac8176" dependencies = [ - "async-trait", - "asynchronous-codec", - "bytes", "futures", "futures-timer", - "hex", - "if-watch", + "igd-next", "libp2p-core", - "libp2p-noise", - "log", - "multihash", - "prost 0.11.8", - "prost-build", - "prost-codec", - "rand 0.8.5", - "rcgen 0.9.3", - "serde", - "stun", - "thiserror", - "tinytemplate", + "libp2p-swarm", "tokio", - "tokio-util", - "webrtc", + "tracing", + "void", ] [[package]] name = "libp2p-websocket" -version = "0.40.0" -source = "git+https://github.com/jsdanielh/rust-libp2p.git#94d669b3e4dd99d7735c2fd1cbc0412b8fad7353" +version = "0.43.0" +source = "git+https://github.com/jsdanielh/rust-libp2p.git?branch=libp2p_0.53.1#a68748fb1170e536a725b1e10a1b762aefac8176" dependencies = [ "either", "futures", "futures-rustls", "libp2p-core", - "log", + "libp2p-identity", "parking_lot 0.12.1", - "quicksink", + "pin-project-lite", "rw-stream-sink", "soketto", + "tracing", "url", "webpki-roots", ] [[package]] -name = "libp2p-websys-transport" -version = "0.1.3" -source = "git+https://github.com/jsdanielh/libp2p-websys-transport.git#e43ccc661caf6f57e9d800366febee2c7f6c35a6" +name = "libp2p-websocket-websys" +version = "0.3.1" +source = "git+https://github.com/jsdanielh/rust-libp2p.git?branch=libp2p_0.53.1#a68748fb1170e536a725b1e10a1b762aefac8176" dependencies = [ + "bytes", "futures", "js-sys", - "libp2p", + "libp2p-core", "parking_lot 0.12.1", "send_wrapper 0.6.0", "thiserror", + "tracing", "wasm-bindgen", "web-sys", ] [[package]] name = "libp2p-yamux" -version = "0.42.0" -source = "git+https://github.com/jsdanielh/rust-libp2p.git#94d669b3e4dd99d7735c2fd1cbc0412b8fad7353" +version = "0.45.0" +source = "git+https://github.com/jsdanielh/rust-libp2p.git?branch=libp2p_0.53.1#a68748fb1170e536a725b1e10a1b762aefac8176" dependencies = [ "futures", "libp2p-core", - "log", - "parking_lot 0.12.1", "thiserror", + "tracing", "yamux", ] -[[package]] -name = "libz-sys" -version = "1.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf" -dependencies = [ - "cc", - "pkg-config", - "vcpkg", -] - [[package]] name = "link-cplusplus" version = "1.0.8" @@ -3342,11 +3012,11 @@ dependencies = [ [[package]] name = "lru" -version = "0.8.1" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909" +checksum = "1efa59af2ddfad1854ae27d75009d538d0998b4b2fd47083e743ac1a10e46c60" dependencies = [ - "hashbrown 0.12.3", + "hashbrown 0.14.0", ] [[package]] @@ -3373,27 +3043,12 @@ dependencies = [ "regex-automata 0.1.10", ] -[[package]] -name = "matches" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" - [[package]] name = "matchit" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b87248edafb776e59e6ee64a79086f65890d3510f2c656c000bf2a7e8a0aea40" -[[package]] -name = "md-5" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" -dependencies = [ - "digest 0.10.7", -] - [[package]] name = "mdbx-sys" version = "12.8.0" @@ -3411,15 +3066,6 @@ version = "2.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" -[[package]] -name = "memoffset" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg", -] - [[package]] name = "memoffset" version = "0.8.0" @@ -3462,14 +3108,13 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.6" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" dependencies = [ "libc", - "log", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.45.0", + "wasi", + "windows-sys 0.48.0", ] [[package]] @@ -3492,19 +3137,20 @@ dependencies = [ [[package]] name = "multiaddr" -version = "0.16.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4aebdb21e90f81d13ed01dc84123320838e53963c2ca94b60b305d3fa64f31e" +checksum = "8b852bc02a2da5feed68cd14fa50d0774b92790a5bdbfa932a813926c8472070" dependencies = [ "arrayref", "byteorder", "data-encoding", + "libp2p-identity", "multibase", "multihash", "percent-encoding", "serde", "static_assertions", - "unsigned-varint", + "unsigned-varint 0.7.2", "url", ] @@ -3521,50 +3167,26 @@ dependencies = [ [[package]] name = "multihash" -version = "0.16.3" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c346cf9999c631f002d8f977c4eaeaa0e6386f16007202308d0b3757522c2cc" +checksum = "076d548d76a0e2a0d4ab471d0b1c36c577786dfc4471242035d97a12a735c492" dependencies = [ "core2", - "digest 0.10.7", - "multihash-derive", "serde", - "serde-big-array 0.3.3", - "sha2 0.10.8", - "unsigned-varint", -] - -[[package]] -name = "multihash-derive" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6d4752e6230d8ef7adf7bd5d8c4b1f6561c1014c5ba9a37445ccefe18aa1db" -dependencies = [ - "proc-macro-crate", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", - "synstructure", + "unsigned-varint 0.7.2", ] -[[package]] -name = "multimap" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" - [[package]] name = "multistream-select" -version = "0.12.1" -source = "git+https://github.com/jsdanielh/rust-libp2p.git#94d669b3e4dd99d7735c2fd1cbc0412b8fad7353" +version = "0.13.0" +source = "git+https://github.com/jsdanielh/rust-libp2p.git?branch=libp2p_0.53.1#a68748fb1170e536a725b1e10a1b762aefac8176" dependencies = [ "bytes", "futures", - "log", "pin-project", "smallvec", - "unsigned-varint", + "tracing", + "unsigned-varint 0.7.2", ] [[package]] @@ -3673,7 +3295,7 @@ dependencies = [ "nimiq-utils", "nimiq-vrf", "parking_lot 0.12.1", - "rand 0.8.5", + "rand", "serde", "strum_macros", "tempfile", @@ -3741,9 +3363,9 @@ dependencies = [ "nimiq-zkp", "nimiq-zkp-primitives", "parking_lot 0.12.1", - "prometheus-client 0.22.0", - "rand 0.8.5", - "rand_chacha 0.3.1", + "prometheus-client", + "rand", + "rand_chacha", "serde", "tempfile", "thiserror", @@ -3807,9 +3429,9 @@ dependencies = [ "nimiq-test-utils", "nimiq-utils", "parking_lot 0.12.1", - "rand 0.8.5", + "rand", "serde", - "serde-big-array 0.5.1", + "serde-big-array", "thiserror", "tracing", ] @@ -3832,7 +3454,7 @@ dependencies = [ "hex", "nimiq-serde", "nimiq-test-log", - "rand 0.8.5", + "rand", "serde", "serde_json", ] @@ -3873,7 +3495,7 @@ dependencies = [ "nimiq-zkp-component", "parking_lot 0.12.1", "pin-project", - "rand 0.8.5", + "rand", "serde", "thiserror", "tokio", @@ -3940,7 +3562,7 @@ dependencies = [ "serde", "thiserror", "time", - "toml 0.8.8", + "toml", "tracing", "tracing-subscriber 0.3.18", ] @@ -3961,7 +3583,7 @@ dependencies = [ "nimiq-test-log", "nimiq-utils", "parking_lot 0.12.1", - "rand 0.8.5", + "rand", "serde", "thiserror", "tokio", @@ -3983,7 +3605,7 @@ dependencies = [ "nimiq-test-log", "rust-argon2", "serde", - "sha2 0.10.8", + "sha2", ] [[package]] @@ -3992,7 +3614,7 @@ version = "0.1.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -4039,7 +3661,7 @@ dependencies = [ "nimiq-jsonrpc-server", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -4079,7 +3701,7 @@ dependencies = [ name = "nimiq-keys" version = "0.1.0" dependencies = [ - "curve25519-dalek 4.1.1", + "curve25519-dalek", "data-encoding", "ed25519-zebra", "hex", @@ -4091,11 +3713,11 @@ dependencies = [ "nimiq-test-log", "nimiq-test-utils", "nimiq-utils", - "rand 0.8.5", - "rand_core 0.6.4", + "rand", + "rand_core", "serde", - "serde-big-array 0.5.1", - "sha2 0.10.8", + "serde-big-array", + "sha2", "thiserror", ] @@ -4105,7 +3727,7 @@ version = "0.1.0" dependencies = [ "clap", "console-subscriber", - "derive_builder 0.12.0", + "derive_builder", "directories", "hex", "log-panics", @@ -4139,8 +3761,8 @@ dependencies = [ "nimiq-zkp-component", "nimiq-zkp-primitives", "parking_lot 0.12.1", - "rand 0.8.5", - "rand_chacha 0.3.1", + "rand", + "rand_chacha", "rustls-pemfile", "serde", "serde_json", @@ -4149,7 +3771,7 @@ dependencies = [ "thiserror", "time", "tokio", - "toml 0.8.8", + "toml", "tracing", "tracing-loki", "tracing-subscriber 0.3.18", @@ -4176,7 +3798,7 @@ dependencies = [ "nimiq-vrf", "nimiq-zkp", "parking_lot 0.12.1", - "rand 0.8.5", + "rand", "thiserror", "tokio", "tokio-stream", @@ -4201,7 +3823,7 @@ dependencies = [ "hex", "nimiq-serde", "serde", - "serde-big-array 0.5.1", + "serde-big-array", ] [[package]] @@ -4233,8 +3855,8 @@ dependencies = [ "nimiq-utils", "nimiq-vrf", "parking_lot 0.12.1", - "prometheus-client 0.22.0", - "rand 0.8.5", + "prometheus-client", + "rand", "serde", "thiserror", "tokio", @@ -4257,7 +3879,7 @@ dependencies = [ "nimiq-network-interface", "nimiq-network-libp2p", "parking_lot 0.12.1", - "prometheus-client 0.22.0", + "prometheus-client", "tokio", "tokio-metrics", "tracing", @@ -4315,7 +3937,6 @@ dependencies = [ "instant", "ip_network", "libp2p", - "libp2p-websys-transport", "nimiq-bls", "nimiq-hash", "nimiq-macros", @@ -4327,15 +3948,17 @@ dependencies = [ "nimiq-validator-network", "parking_lot 0.12.1", "pin-project", - "pin-project-lite 0.2.13", - "prometheus-client 0.22.0", - "rand 0.8.5", + "pin-project-lite", + "prometheus-client", + "rand", "serde", - "serde-big-array 0.5.1", + "serde-big-array", "thiserror", "tokio", "tokio-stream", "tracing", + "unsigned-varint 0.8.0", + "void", "wasm-timer", ] @@ -4371,8 +3994,8 @@ dependencies = [ "hex", "nimiq-hash", "nimiq-primitives", - "rand 0.8.5", - "rand_chacha 0.3.1", + "rand", + "rand_chacha", ] [[package]] @@ -4399,14 +4022,14 @@ dependencies = [ "nimiq-vrf", "nimiq_rpc", "percentage", - "rand 0.8.5", + "rand", "serde", "serde_derive", "serde_json", "thiserror", "time", "tokio", - "toml 0.8.8", + "toml", "tracing", "tracing-subscriber 0.3.18", "url", @@ -4549,7 +4172,7 @@ dependencies = [ "hex", "postcard", "serde", - "serde-big-array 0.5.1", + "serde-big-array", "serde_derive", ] @@ -4568,11 +4191,11 @@ dependencies = [ "nimiq-primitives", "nimiq-transaction", "nimiq-transaction-builder", - "rand 0.8.5", + "rand", "serde", "tokio", "tokio-metrics", - "toml 0.8.8", + "toml", "tracing", ] @@ -4601,7 +4224,7 @@ dependencies = [ "nimiq-collections", "nimiq-macros", "nimiq-test-log", - "rand 0.8.5", + "rand", "serde", "tokio", "tokio-stream", @@ -4629,7 +4252,7 @@ dependencies = [ "darling 0.20.3", "nimiq-test-log", "quote", - "syn 2.0.38", + "syn 2.0.39", "tokio", ] @@ -4676,8 +4299,8 @@ dependencies = [ "nimiq-zkp-primitives", "parking_lot 0.12.1", "paste", - "rand 0.8.5", - "rand_chacha 0.3.1", + "rand", + "rand_chacha", "serde", "tokio", "tokio-stream", @@ -4698,7 +4321,7 @@ dependencies = [ "nimiq-serde", "nimiq-transaction", "nimiq-utils", - "rand 0.8.5", + "rand", "thiserror", "tracing", ] @@ -4744,7 +4367,7 @@ dependencies = [ "nimiq-test-log", "nimiq-transaction", "nimiq-utils", - "rand 0.8.5", + "rand", "serde", "thiserror", ] @@ -4771,7 +4394,7 @@ dependencies = [ "clear_on_drop", "futures-util", "hex", - "libp2p-core", + "libp2p-identity", "nimiq-collections", "nimiq-database-value", "nimiq-hash", @@ -4780,8 +4403,8 @@ dependencies = [ "nimiq-test-log", "nimiq-test-utils", "parking_lot 0.12.1", - "rand 0.8.5", - "rand_core 0.6.4", + "rand", + "rand_core", "serde", "thiserror", "tracing", @@ -4825,7 +4448,7 @@ dependencies = [ "nimiq-validator-network", "nimiq-vrf", "parking_lot 0.12.1", - "rand 0.8.5", + "rand", "rayon", "serde", "tokio", @@ -4858,7 +4481,7 @@ name = "nimiq-vrf" version = "0.1.0" dependencies = [ "byteorder", - "curve25519-dalek 4.1.1", + "curve25519-dalek", "hex", "nimiq-hash", "nimiq-keys", @@ -4866,9 +4489,9 @@ dependencies = [ "nimiq-serde", "nimiq-test-log", "nimiq-test-utils", - "rand 0.8.5", + "rand", "serde", - "sha2 0.10.8", + "sha2", "tracing", ] @@ -4876,7 +4499,7 @@ dependencies = [ name = "nimiq-wallet" version = "0.1.0" dependencies = [ - "curve25519-dalek 4.1.1", + "curve25519-dalek", "hex", "itertools 0.11.0", "nimiq-database", @@ -4959,8 +4582,8 @@ dependencies = [ "nimiq-zkp-primitives", "once_cell", "parking_lot 0.12.1", - "rand 0.8.5", - "rand_chacha 0.3.1", + "rand", + "rand_chacha", "serde", "thiserror", "tracing", @@ -4999,8 +4622,8 @@ dependencies = [ "nimiq-test-utils", "nimiq-transaction", "nimiq-zkp-primitives", - "rand 0.8.5", - "rand_chacha 0.3.1", + "rand", + "rand_chacha", "rayon", "serde", "tracing", @@ -5044,7 +4667,7 @@ dependencies = [ "nimiq-zkp-circuits", "nimiq-zkp-primitives", "parking_lot 0.12.1", - "rand 0.8.5", + "rand", "serde", "tempfile", "thiserror", @@ -5077,7 +4700,7 @@ dependencies = [ "nimiq-primitives", "nimiq-serde", "nimiq-utils", - "rand 0.8.5", + "rand", "rayon", "serde", "thiserror", @@ -5134,7 +4757,6 @@ dependencies = [ "bitflags 1.3.2", "cfg-if", "libc", - "memoffset 0.6.5", ] [[package]] @@ -5282,22 +4904,13 @@ dependencies = [ "memchr", ] -[[package]] -name = "oid-registry" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38e20717fa0541f39bd146692035c37bedfa532b3e5071b35761082407546b2a" -dependencies = [ - "asn1-rs 0.3.1", -] - [[package]] name = "oid-registry" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9bedf36ffb6ba96c2eb7144ef6270557b52e54b20c0a8e1eb2ff99a6c6959bff" dependencies = [ - "asn1-rs 0.5.2", + "asn1-rs", ] [[package]] @@ -5368,28 +4981,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" -[[package]] -name = "p256" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51f44edd08f51e2ade572f141051021c5af22677e42b7dd28a88155151c33594" -dependencies = [ - "ecdsa", - "elliptic-curve", - "sha2 0.10.8", -] - -[[package]] -name = "p384" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc8c5bf642dde52bb9e87c0ecd8ca5a76faac2eeed98dedb7c717997e1080aa" -dependencies = [ - "ecdsa", - "elliptic-curve", - "sha2 0.10.8", -] - [[package]] name = "parking" version = "2.0.0" @@ -5461,20 +5052,12 @@ checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" [[package]] name = "pem" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" -dependencies = [ - "base64 0.13.1", -] - -[[package]] -name = "pem-rfc7468" -version = "0.6.0" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d159833a9105500e0398934e205e0773f0b27529557134ecfc51c27646adac" +checksum = "3163d2912b7c3b52d651a055f2c7eec9ba5cd22d26ef75b8dd3a59980b185923" dependencies = [ - "base64ct", + "base64 0.21.5", + "serde", ] [[package]] @@ -5519,15 +5102,9 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] -[[package]] -name = "pin-project-lite" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" - [[package]] name = "pin-project-lite" version = "0.2.13" @@ -5542,9 +5119,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkcs8" -version = "0.9.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" dependencies = [ "der", "spki", @@ -5574,7 +5151,7 @@ dependencies = [ "concurrent-queue", "libc", "log", - "pin-project-lite 0.2.13", + "pin-project-lite", "windows-sys 0.45.0", ] @@ -5586,7 +5163,7 @@ checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede" dependencies = [ "cpufeatures", "opaque-debug", - "universal-hash 0.4.1", + "universal-hash", ] [[package]] @@ -5598,19 +5175,7 @@ dependencies = [ "cfg-if", "cpufeatures", "opaque-debug", - "universal-hash 0.4.1", -] - -[[package]] -name = "polyval" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef234e08c11dfcb2e56f79fd70f6f2eb7f025c0ce2333e82f4f0518ecad30c6" -dependencies = [ - "cfg-if", - "cpufeatures", - "opaque-debug", - "universal-hash 0.5.0", + "universal-hash", ] [[package]] @@ -5643,50 +5208,6 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" -[[package]] -name = "prettyplease" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebcd279d20a4a0a2404a33056388e950504d891c855c7975b9a8fef75f3bf04" -dependencies = [ - "proc-macro2", - "syn 1.0.109", -] - -[[package]] -name = "proc-macro-crate" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e17d47ce914bf4de440332250b0edd23ce48c005f59fab39d3335866b114f11a" -dependencies = [ - "thiserror", - "toml 0.5.11", -] - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - [[package]] name = "proc-macro2" version = "1.0.69" @@ -5696,18 +5217,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "prometheus-client" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83cd1b99916654a69008fd66b4f9397fbe08e6e51dfe23d4417acf5d3b8cb87c" -dependencies = [ - "dtoa", - "itoa", - "parking_lot 0.12.1", - "prometheus-client-derive-text-encode", -] - [[package]] name = "prometheus-client" version = "0.22.0" @@ -5731,17 +5240,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "prometheus-client-derive-text-encode" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66a455fbcb954c1a7decf3c586e860fd7889cddf4b8e164be736dbac95a953cd" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "prost" version = "0.11.8" @@ -5762,40 +5260,6 @@ dependencies = [ "prost-derive 0.12.1", ] -[[package]] -name = "prost-build" -version = "0.11.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c828f93f5ca4826f97fedcbd3f9a536c16b12cff3dbbb4a007f932bbad95b12" -dependencies = [ - "bytes", - "heck", - "itertools 0.10.5", - "lazy_static", - "log", - "multimap", - "petgraph", - "prettyplease", - "prost 0.11.8", - "prost-types 0.11.8", - "regex", - "syn 1.0.109", - "tempfile", - "which", -] - -[[package]] -name = "prost-codec" -version = "0.3.0" -source = "git+https://github.com/jsdanielh/rust-libp2p.git#94d669b3e4dd99d7735c2fd1cbc0412b8fad7353" -dependencies = [ - "asynchronous-codec", - "bytes", - "prost 0.11.8", - "thiserror", - "unsigned-varint", -] - [[package]] name = "prost-derive" version = "0.11.8" @@ -5819,7 +5283,7 @@ dependencies = [ "itertools 0.11.0", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -5847,32 +5311,72 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] -name = "quicksink" -version = "0.1.2" +name = "quick-protobuf" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77de3c815e5a160b1539c6592796801df2043ae35e123b46d73380cfa57af858" +checksum = "9d6da84cc204722a989e01ba2f6e1e276e190f22263d0cb6ce8526fcdb0d2e1f" dependencies = [ - "futures-core", - "futures-sink", - "pin-project-lite 0.1.12", + "byteorder", +] + +[[package]] +name = "quick-protobuf-codec" +version = "0.2.0" +source = "git+https://github.com/jsdanielh/rust-libp2p.git?branch=libp2p_0.53.1#a68748fb1170e536a725b1e10a1b762aefac8176" +dependencies = [ + "asynchronous-codec 0.6.1", + "bytes", + "quick-protobuf", + "thiserror", + "unsigned-varint 0.7.2", +] + +[[package]] +name = "quinn" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cc2c5017e4b43d5995dcea317bc46c1e09404c0a9664d2908f7f02dfe943d75" +dependencies = [ + "bytes", + "futures-io", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "thiserror", + "tokio", + "tracing", ] [[package]] name = "quinn-proto" -version = "0.9.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c956be1b23f4261676aed05a0046e204e8a6836e50203902683a718af0797989" +checksum = "141bf7dfde2fbc246bfd3fe12f2455aa24b0fbd9af535d8c86c7bd1381ff2b1a" dependencies = [ "bytes", - "rand 0.8.5", - "ring", + "rand", + "ring 0.16.20", "rustc-hash", - "rustls 0.20.8", + "rustls", "slab", "thiserror", "tinyvec", "tracing", - "webpki 0.22.0", +] + +[[package]] +name = "quinn-udp" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "055b4e778e8feb9f93c4e439f71dc2156ef13360b432b799e179a8c4cdf0b1d7" +dependencies = [ + "bytes", + "libc", + "socket2 0.5.5", + "tracing", + "windows-sys 0.48.0", ] [[package]] @@ -5890,19 +5394,6 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc", -] - [[package]] name = "rand" version = "0.8.5" @@ -5910,18 +5401,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", + "rand_chacha", + "rand_core", ] [[package]] @@ -5931,16 +5412,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", + "rand_core", ] [[package]] @@ -5949,16 +5421,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.8", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core 0.5.1", + "getrandom", ] [[package]] @@ -5983,25 +5446,12 @@ dependencies = [ [[package]] name = "rcgen" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6413f3de1edee53342e6138e75b56d32e7bc6e332b3bd62d497b1929d4cfbcdd" -dependencies = [ - "pem", - "ring", - "time", - "x509-parser 0.13.2", - "yasna", -] - -[[package]] -name = "rcgen" -version = "0.10.0" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffbe84efe2f38dea12e9bfc1f65377fdf03e53a18cb3b995faedf7934c7e785b" +checksum = "52c4f3084aa3bc7dfbba4eff4fab2a54db4324965d8872ab933565e6fbd83bc6" dependencies = [ "pem", - "ring", + "ring 0.16.20", "time", "yasna", ] @@ -6030,7 +5480,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "getrandom 0.2.8", + "getrandom", "redox_syscall 0.2.16", "thiserror", ] @@ -6102,7 +5552,7 @@ dependencies = [ "native-tls", "once_cell", "percent-encoding", - "pin-project-lite 0.2.13", + "pin-project-lite", "serde", "serde_json", "serde_urlencoded", @@ -6126,17 +5576,6 @@ dependencies = [ "quick-error", ] -[[package]] -name = "rfc6979" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" -dependencies = [ - "crypto-bigint", - "hmac 0.12.1", - "zeroize", -] - [[package]] name = "ring" version = "0.16.20" @@ -6147,20 +5586,23 @@ dependencies = [ "libc", "once_cell", "spin 0.5.2", - "untrusted", + "untrusted 0.7.1", "web-sys", "winapi", ] [[package]] -name = "rtcp" -version = "0.7.2" +name = "ring" +version = "0.17.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1919efd6d4a6a85d13388f9487549bb8e359f17198cc03ffd72f79b553873691" +checksum = "fb0205304757e5d899b9c2e448b867ffd03ae7f988002e47cd24954391394d0b" dependencies = [ - "bytes", - "thiserror", - "webrtc-util", + "cc", + "getrandom", + "libc", + "spin 0.9.8", + "untrusted 0.9.0", + "windows-sys 0.48.0", ] [[package]] @@ -6178,20 +5620,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "rtp" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2a095411ff00eed7b12e4c6a118ba984d113e1079582570d56a5ee723f11f80" -dependencies = [ - "async-trait", - "bytes", - "rand 0.8.5", - "serde", - "thiserror", - "webrtc-util", -] - [[package]] name = "rust-argon2" version = "2.0.0" @@ -6249,39 +5677,14 @@ dependencies = [ [[package]] name = "rustls" -version = "0.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" -dependencies = [ - "base64 0.13.1", - "log", - "ring", - "sct 0.6.1", - "webpki 0.21.4", -] - -[[package]] -name = "rustls" -version = "0.20.8" +version = "0.21.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" +checksum = "629648aced5775d558af50b2b4c7b02983a04b312126d45eeead26e7caa498b9" dependencies = [ "log", - "ring", - "sct 0.7.0", - "webpki 0.22.0", -] - -[[package]] -name = "rustls" -version = "0.21.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1feddffcfcc0b33f5c6ce9a29e341e4cd59c3f78e7ee45f4a40c038b1d6cbb" -dependencies = [ - "log", - "ring", + "ring 0.17.5", "rustls-webpki", - "sct 0.7.0", + "sct", ] [[package]] @@ -6307,12 +5710,12 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.101.4" +version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d93931baf2d282fff8d3a532bbfd7653f734643161b87e3e01e59a04439bf0d" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "ring", - "untrusted", + "ring 0.17.5", + "untrusted 0.9.0", ] [[package]] @@ -6323,8 +5726,8 @@ checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" [[package]] name = "rw-stream-sink" -version = "0.3.0" -source = "git+https://github.com/jsdanielh/rust-libp2p.git#94d669b3e4dd99d7735c2fd1cbc0412b8fad7353" +version = "0.4.0" +source = "git+https://github.com/jsdanielh/rust-libp2p.git?branch=libp2p_0.53.1#a68748fb1170e536a725b1e10a1b762aefac8176" dependencies = [ "futures", "pin-project", @@ -6364,36 +5767,14 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" -[[package]] -name = "sct" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "sct" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "sdp" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d22a5ef407871893fd72b4562ee15e4742269b173959db4b8df6f538c414e13" -dependencies = [ - "rand 0.8.5", - "substring", - "thiserror", - "url", + "ring 0.16.20", + "untrusted 0.7.1", ] [[package]] @@ -6405,21 +5786,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.38", -] - -[[package]] -name = "sec1" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" -dependencies = [ - "base16ct", - "der", - "generic-array", - "pkcs8", - "subtle", - "zeroize", + "syn 2.0.39", ] [[package]] @@ -6472,15 +5839,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde-big-array" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd31f59f6fe2b0c055371bb2f16d7f0aa7d8881676c04a55b1596d1a17cd10a4" -dependencies = [ - "serde", -] - [[package]] name = "serde-big-array" version = "0.5.1" @@ -6520,7 +5878,7 @@ checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -6531,7 +5889,7 @@ checksum = "e578a843d40b4189a4d66bba51d7684f57da5bd7c304c64e14bd63efbef49509" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -6554,7 +5912,7 @@ checksum = "3081f5ffbb02284dda55132aa26daecedd7372a42417bbbab6f14ab7d6bb9145" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -6604,7 +5962,7 @@ dependencies = [ "darling 0.20.3", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -6631,19 +5989,6 @@ dependencies = [ "digest 0.10.7", ] -[[package]] -name = "sha2" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug", -] - [[package]] name = "sha2" version = "0.10.8" @@ -6689,16 +6034,6 @@ dependencies = [ "libc", ] -[[package]] -name = "signature" -version = "1.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" -dependencies = [ - "digest 0.10.7", - "rand_core 0.6.4", -] - [[package]] name = "signature" version = "2.1.0" @@ -6716,9 +6051,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.10.0" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" [[package]] name = "snap" @@ -6732,14 +6067,14 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c9d1425eb528a21de2755c75af4c9b5d57f50a0d4c3b7f1828a4cd03f8ba155" dependencies = [ - "aes-gcm 0.9.4", + "aes-gcm", "blake2", "chacha20poly1305", - "curve25519-dalek 4.1.1", - "rand_core 0.6.4", - "ring", + "curve25519-dalek", + "rand_core", + "ring 0.16.20", "rustc_version", - "sha2 0.10.8", + "sha2", "subtle", ] @@ -6755,9 +6090,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.3" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", "windows-sys 0.48.0", @@ -6771,11 +6106,10 @@ checksum = "41d1c5305e39e09653383c2c7244f2f78b3bcae37cf50c64cb4789c9f5096ec2" dependencies = [ "base64 0.13.1", "bytes", - "flate2", "futures", "httparse", "log", - "rand 0.8.5", + "rand", "sha-1", ] @@ -6796,9 +6130,9 @@ dependencies = [ [[package]] name = "spki" -version = "0.6.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" +checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" dependencies = [ "base64ct", "der", @@ -6832,35 +6166,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.38", -] - -[[package]] -name = "stun" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7e94b1ec00bad60e6410e058b52f1c66de3dc5fe4d62d09b3e52bb7d3b73e25" -dependencies = [ - "base64 0.13.1", - "crc", - "lazy_static", - "md-5", - "rand 0.8.5", - "ring", - "subtle", - "thiserror", - "tokio", - "url", - "webrtc-util", -] - -[[package]] -name = "substring" -version = "1.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ee6433ecef213b2e72f587ef64a2f5943e7cd16fbd82dbe8bc07486c534c86" -dependencies = [ - "autocfg", + "syn 2.0.39", ] [[package]] @@ -6882,9 +6188,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.38" +version = "2.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" dependencies = [ "proc-macro2", "quote", @@ -6976,7 +6282,7 @@ checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -7030,16 +6336,6 @@ dependencies = [ "time-core", ] -[[package]] -name = "tinytemplate" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" -dependencies = [ - "serde", - "serde_json", -] - [[package]] name = "tinyvec" version = "1.6.0" @@ -7057,19 +6353,18 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.32.0" +version = "1.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" +checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" dependencies = [ "backtrace", "bytes", "libc", "mio", "num_cpus", - "parking_lot 0.12.1", - "pin-project-lite 0.2.13", + "pin-project-lite", "signal-hook-registry", - "socket2 0.5.3", + "socket2 0.5.5", "tokio-macros", "tracing", "windows-sys 0.48.0", @@ -7081,29 +6376,29 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" dependencies = [ - "pin-project-lite 0.2.13", + "pin-project-lite", "tokio", ] [[package]] name = "tokio-macros" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] name = "tokio-metrics" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4b2fc67d5dec41db679b9b052eb572269616926040b7831e32c8a152df77b84" +checksum = "eace09241d62c98b7eeb1107d4c5c64ca3bd7da92e8c218c153ab3a78f9be112" dependencies = [ "futures-util", - "pin-project-lite 0.2.13", + "pin-project-lite", "tokio", "tokio-stream", ] @@ -7124,7 +6419,7 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls 0.21.6", + "rustls", "tokio", ] @@ -7135,7 +6430,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" dependencies = [ "futures-core", - "pin-project-lite 0.2.13", + "pin-project-lite", "tokio", "tokio-util", ] @@ -7160,22 +6455,12 @@ checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" dependencies = [ "bytes", "futures-core", - "futures-io", "futures-sink", - "pin-project-lite 0.2.13", + "pin-project-lite", "tokio", "tracing", ] -[[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "serde", -] - [[package]] name = "toml" version = "0.8.8" @@ -7247,8 +6532,8 @@ dependencies = [ "futures-util", "indexmap 1.9.2", "pin-project", - "pin-project-lite 0.2.13", - "rand 0.8.5", + "pin-project-lite", + "rand", "slab", "tokio", "tokio-util", @@ -7277,7 +6562,7 @@ checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if", "log", - "pin-project-lite 0.2.13", + "pin-project-lite", "tracing-attributes", "tracing-core", ] @@ -7398,52 +6683,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "trust-dns-proto" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f7f83d1e4a0e4358ac54c5c3681e5d7da5efc5a7a632c90bb6d6669ddd9bc26" -dependencies = [ - "async-trait", - "cfg-if", - "data-encoding", - "enum-as-inner", - "futures-channel", - "futures-io", - "futures-util", - "idna 0.2.3", - "ipnet", - "lazy_static", - "rand 0.8.5", - "smallvec", - "socket2 0.4.9", - "thiserror", - "tinyvec", - "tokio", - "tracing", - "url", -] - -[[package]] -name = "trust-dns-resolver" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aff21aa4dcefb0a1afbfac26deb0adc93888c7d295fb63ab273ef276ba2b7cfe" -dependencies = [ - "cfg-if", - "futures-util", - "ipconfig", - "lazy_static", - "lru-cache", - "parking_lot 0.12.1", - "resolv-conf", - "smallvec", - "thiserror", - "tokio", - "tracing", - "trust-dns-proto", -] - [[package]] name = "try-lock" version = "0.2.4" @@ -7469,7 +6708,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -7484,32 +6723,13 @@ dependencies = [ "http", "httparse", "log", - "rand 0.8.5", + "rand", "sha1", "thiserror", "url", "utf-8", ] -[[package]] -name = "turn" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4712ee30d123ec7ae26d1e1b218395a16c87cdbaf4b3925d170d684af62ea5e8" -dependencies = [ - "async-trait", - "base64 0.13.1", - "futures", - "log", - "md-5", - "rand 0.8.5", - "ring", - "stun", - "thiserror", - "tokio", - "webrtc-util", -] - [[package]] name = "typenum" version = "1.16.0" @@ -7587,26 +6807,20 @@ dependencies = [ ] [[package]] -name = "universal-hash" -version = "0.5.0" +name = "unsigned-varint" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d3160b73c9a19f7e2939a2fdad446c57c1bbbbf4d919d3213ff1267a580d8b5" +checksum = "6889a77d49f1f013504cec6bf97a2c730394adedaeb1deb5ea08949a50541105" dependencies = [ - "crypto-common", - "subtle", + "asynchronous-codec 0.6.1", + "bytes", ] [[package]] name = "unsigned-varint" -version = "0.7.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d86a8dc7f45e4c1b0d30e43038c38f274e77af056aa5f74b93c2cf9eb3c1c836" -dependencies = [ - "asynchronous-codec", - "bytes", - "futures-io", - "futures-util", -] +checksum = "eb066959b24b5196ae73cb057f45598450d2c5f71460e98c49b738086eff9c06" [[package]] name = "untrusted" @@ -7614,6 +6828,12 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "url" version = "2.4.1" @@ -7621,7 +6841,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", - "idna 0.4.0", + "idna", "percent-encoding", "serde", ] @@ -7638,15 +6858,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" -[[package]] -name = "uuid" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1674845326ee10d37ca60470760d4288a6f80f304007d92e5c53bab78c9cfd79" -dependencies = [ - "getrandom 0.2.8", -] - [[package]] name = "valuable" version = "0.1.0" @@ -7671,15 +6882,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -[[package]] -name = "waitgroup" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1f50000a783467e6c0200f9d10642f4bc424e39efc1b770203e88b488f79292" -dependencies = [ - "atomic-waker", -] - [[package]] name = "waker-fn" version = "1.1.0" @@ -7727,12 +6929,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -7760,7 +6956,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", "wasm-bindgen-shared", ] @@ -7816,7 +7012,7 @@ checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -7849,7 +7045,7 @@ checksum = "493fcbab756bb764fa37e6bee8cec2dd709eb4273d06d0c282a5e74275ded735" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -7876,257 +7072,11 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "webpki" -version = "0.21.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "webpki" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "webpki-roots" -version = "0.22.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" -dependencies = [ - "webpki 0.22.0", -] - -[[package]] -name = "webrtc" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d3bc9049bdb2cea52f5fd4f6f728184225bdb867ed0dc2410eab6df5bdd67bb" -dependencies = [ - "arc-swap", - "async-trait", - "bytes", - "hex", - "interceptor", - "lazy_static", - "log", - "rand 0.8.5", - "rcgen 0.9.3", - "regex", - "ring", - "rtcp", - "rtp", - "rustls 0.19.1", - "sdp", - "serde", - "serde_json", - "sha2 0.10.8", - "stun", - "thiserror", - "time", - "tokio", - "turn", - "url", - "waitgroup", - "webrtc-data", - "webrtc-dtls", - "webrtc-ice", - "webrtc-mdns", - "webrtc-media", - "webrtc-sctp", - "webrtc-srtp", - "webrtc-util", -] - -[[package]] -name = "webrtc-data" -version = "0.6.0" +version = "0.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef36a4d12baa6e842582fe9ec16a57184ba35e1a09308307b67d43ec8883100" -dependencies = [ - "bytes", - "derive_builder 0.11.2", - "log", - "thiserror", - "tokio", - "webrtc-sctp", - "webrtc-util", -] - -[[package]] -name = "webrtc-dtls" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942be5bd85f072c3128396f6e5a9bfb93ca8c1939ded735d177b7bcba9a13d05" -dependencies = [ - "aes 0.6.0", - "aes-gcm 0.10.1", - "async-trait", - "bincode", - "block-modes", - "byteorder", - "ccm", - "curve25519-dalek 3.2.0", - "der-parser 8.2.0", - "elliptic-curve", - "hkdf", - "hmac 0.12.1", - "log", - "oid-registry 0.6.1", - "p256", - "p384", - "rand 0.8.5", - "rand_core 0.6.4", - "rcgen 0.9.3", - "ring", - "rustls 0.19.1", - "sec1", - "serde", - "sha1", - "sha2 0.10.8", - "signature 1.6.4", - "subtle", - "thiserror", - "tokio", - "webpki 0.21.4", - "webrtc-util", - "x25519-dalek 2.0.0-pre.1", - "x509-parser 0.13.2", -] - -[[package]] -name = "webrtc-ice" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "465a03cc11e9a7d7b4f9f99870558fe37a102b65b93f8045392fef7c67b39e80" -dependencies = [ - "arc-swap", - "async-trait", - "crc", - "log", - "rand 0.8.5", - "serde", - "serde_json", - "stun", - "thiserror", - "tokio", - "turn", - "url", - "uuid", - "waitgroup", - "webrtc-mdns", - "webrtc-util", -] - -[[package]] -name = "webrtc-mdns" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f08dfd7a6e3987e255c4dbe710dde5d94d0f0574f8a21afa95d171376c143106" -dependencies = [ - "log", - "socket2 0.4.9", - "thiserror", - "tokio", - "webrtc-util", -] - -[[package]] -name = "webrtc-media" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee2a3c157a040324e5049bcbd644ffc9079e6738fa2cfab2bcff64e5cc4c00d7" -dependencies = [ - "byteorder", - "bytes", - "derive_builder 0.11.2", - "displaydoc", - "rand 0.8.5", - "rtp", - "thiserror", - "webrtc-util", -] - -[[package]] -name = "webrtc-sctp" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d47adcd9427eb3ede33d5a7f3424038f63c965491beafcc20bc650a2f6679c0" -dependencies = [ - "arc-swap", - "async-trait", - "bytes", - "crc", - "log", - "rand 0.8.5", - "thiserror", - "tokio", - "webrtc-util", -] - -[[package]] -name = "webrtc-srtp" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6183edc4c1c6c0175f8812eefdce84dfa0aea9c3ece71c2bf6ddd3c964de3da5" -dependencies = [ - "aead 0.4.3", - "aes 0.7.5", - "aes-gcm 0.9.4", - "async-trait", - "byteorder", - "bytes", - "ctr 0.8.0", - "hmac 0.11.0", - "log", - "rtcp", - "rtp", - "sha-1", - "subtle", - "thiserror", - "tokio", - "webrtc-util", -] - -[[package]] -name = "webrtc-util" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f1db1727772c05cf7a2cfece52c3aca8045ca1e176cd517d323489aa3c6d87" -dependencies = [ - "async-trait", - "bitflags 1.3.2", - "bytes", - "cc", - "ipnet", - "lazy_static", - "libc", - "log", - "nix", - "rand 0.8.5", - "thiserror", - "tokio", - "winapi", -] - -[[package]] -name = "which" -version = "4.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269" -dependencies = [ - "either", - "libc", - "once_cell", -] +checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" [[package]] name = "widestring" @@ -8167,15 +7117,21 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows" -version = "0.34.0" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca229916c5ee38c2f2bc1e9d8f04df975b4bd93f9955dc69fabb5d91270045c9" +dependencies = [ + "windows-core", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-core" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45296b64204227616fdbf2614cefa4c236b98ee64dfaaaa435207ed99fe7829f" +checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" dependencies = [ - "windows_aarch64_msvc 0.34.0", - "windows_i686_gnu 0.34.0", - "windows_i686_msvc 0.34.0", - "windows_x86_64_gnu 0.34.0", - "windows_x86_64_msvc 0.34.0", + "windows-targets 0.48.5", ] [[package]] @@ -8208,7 +7164,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.0", + "windows-targets 0.48.5", ] [[package]] @@ -8228,17 +7184,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -8249,15 +7205,9 @@ checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.34.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17cffbe740121affb56fad0fc0e421804adf0ae00891205213b5cecd30db881d" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" @@ -8267,15 +7217,9 @@ checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" - -[[package]] -name = "windows_i686_gnu" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2564fde759adb79129d9b4f54be42b32c89970c18ebf93124ca8870a498688ed" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" @@ -8285,15 +7229,9 @@ checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" - -[[package]] -name = "windows_i686_msvc" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cd9d32ba70453522332c14d38814bceeb747d80b3958676007acadd7e166956" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" @@ -8303,15 +7241,9 @@ checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfce6deae227ee8d356d19effc141a509cc503dfd1f850622ec4b0f84428e1f4" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" @@ -8321,9 +7253,9 @@ checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" @@ -8333,15 +7265,9 @@ checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.34.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d19538ccc21819d01deaf88d6a17eae6596a12e9aafdbb97916fb49896d89de9" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" @@ -8351,9 +7277,9 @@ checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winnow" @@ -8384,91 +7310,77 @@ dependencies = [ [[package]] name = "x25519-dalek" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a0c105152107e3b96f6a00a65e86ce82d9b125230e1c4302940eca58ff71f4f" -dependencies = [ - "curve25519-dalek 3.2.0", - "rand_core 0.5.1", - "zeroize", -] - -[[package]] -name = "x25519-dalek" -version = "2.0.0-pre.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5da623d8af10a62342bcbbb230e33e58a63255a58012f8653c578e54bab48df" +checksum = "fb66477291e7e8d2b0ff1bcb900bf29489a9692816d79874bea351e7a8b6de96" dependencies = [ - "curve25519-dalek 3.2.0", - "rand_core 0.6.4", + "curve25519-dalek", + "rand_core", + "serde", "zeroize", ] [[package]] name = "x509-parser" -version = "0.13.2" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb9bace5b5589ffead1afb76e43e34cff39cd0f3ce7e170ae0c29e53b88eb1c" +checksum = "7069fba5b66b9193bd2c5d3d4ff12b839118f6bcbef5328efafafb5395cf63da" dependencies = [ - "asn1-rs 0.3.1", - "base64 0.13.1", + "asn1-rs", "data-encoding", - "der-parser 7.0.0", + "der-parser", "lazy_static", "nom", - "oid-registry 0.4.0", - "ring", + "oid-registry", "rusticata-macros", "thiserror", "time", ] [[package]] -name = "x509-parser" -version = "0.14.0" +name = "xml-rs" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0ecbeb7b67ce215e40e3cc7f2ff902f94a223acf44995934763467e7b1febc8" +checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a" + +[[package]] +name = "xmltree" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7d8a75eaf6557bb84a65ace8609883db44a29951042ada9b393151532e41fcb" dependencies = [ - "asn1-rs 0.5.2", - "base64 0.13.1", - "data-encoding", - "der-parser 8.2.0", - "lazy_static", - "nom", - "oid-registry 0.6.1", - "rusticata-macros", - "thiserror", - "time", + "xml-rs", ] [[package]] name = "yamux" -version = "0.10.2" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d9ba232399af1783a58d8eb26f6b5006fbefe2dc9ef36bd283324792d03ea5" +checksum = "0329ef377816896f014435162bb3711ea7a07729c23d0960e6f8048b21b8fe91" dependencies = [ "futures", "log", "nohash-hasher", "parking_lot 0.12.1", - "rand 0.8.5", + "pin-project", + "rand", "static_assertions", ] [[package]] name = "yasna" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aed2e7a52e3744ab4d0c05c20aa065258e84c49fd4226f5191b2ed29712710b4" +checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd" dependencies = [ "time", ] [[package]] name = "zeroize" -version = "1.5.7" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" dependencies = [ "zeroize_derive", ] diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 0e65f79bd6..9ce6239faf 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -91,6 +91,5 @@ tokio-console = ["console-subscriber", "logging", "tokio/tracing"] tokio-websocket = ["nimiq-network-libp2p/tokio-websocket"] validator = ["database-storage", "nimiq-mempool", "nimiq-validator", "nimiq-validator-network", "nimiq-rpc-server"] wallet = ["database-storage", "nimiq-wallet"] -wasm-websocket = ["nimiq-network-libp2p/wasm-websocket"] web-logging = ["nimiq-log", "time/wasm-bindgen", "tracing-subscriber", "tracing-web"] zkp-prover = ["nimiq-zkp/zkp-prover", "nimiq-zkp-circuits/zkp-prover", "nimiq-zkp-component/zkp-prover", "nimiq-zkp-primitives/zkp-prover"] diff --git a/network-interface/Cargo.toml b/network-interface/Cargo.toml index 3f7bda574b..3a1393b985 100644 --- a/network-interface/Cargo.toml +++ b/network-interface/Cargo.toml @@ -21,7 +21,7 @@ async-trait = "0.1" bitflags = { version = "2.0", features = ["serde"] } futures = { package = "futures-util", version = "0.3" } log = { package = "tracing", version = "0.1", features = ["log"] } -multiaddr = "0.16" +multiaddr = "0.18" serde = "1.0" thiserror = "1.0" tokio = { version = "1.32", features = ["rt"] } diff --git a/network-libp2p/Cargo.toml b/network-libp2p/Cargo.toml index 30d69cbeae..acf3d2b675 100644 --- a/network-libp2p/Cargo.toml +++ b/network-libp2p/Cargo.toml @@ -24,7 +24,6 @@ futures = { package = "futures-util", version = "0.3" } hex = "0.4" instant = { version = "0.1", features = [ "wasm-bindgen" ] } ip_network = "0.4" -libp2p-websys-transport = { git = "https://github.com/jsdanielh/libp2p-websys-transport.git", optional = true } log = { package = "tracing", version = "0.1", features = ["log"] } parking_lot = "0.12" pin-project = "1.1" @@ -36,6 +35,8 @@ serde-big-array = "0.5" thiserror = "1.0" tokio = { version = "1.32", features = ["macros", "rt", "tracing"] } tokio-stream = "0.1" +unsigned-varint = "0.8" +void = "1.0" wasm-timer = "0.2" nimiq-bls = { workspace = true } @@ -51,8 +52,9 @@ nimiq-utils = { workspace = true, features = [ ] } nimiq-validator-network = { workspace = true } +# For now we need to use a fork [target.'cfg(not(target_family = "wasm"))'.dependencies] -libp2p = { git = "https://github.com/jsdanielh/rust-libp2p.git", default-features = false, features = [ +libp2p = { git = "https://github.com/jsdanielh/rust-libp2p.git", branch = "libp2p_0.53.1", default-features = false, features = [ "gossipsub", "identify", "kad", @@ -61,11 +63,13 @@ libp2p = { git = "https://github.com/jsdanielh/rust-libp2p.git", default-feature "ping", "request-response", "serde", + "tokio", "yamux", ] } +# For now we need to use a fork [target.'cfg(target_family = "wasm")'.dependencies] -libp2p = { git = "https://github.com/jsdanielh/rust-libp2p.git", default-features = false, features = [ +libp2p = { git = "https://github.com/jsdanielh/rust-libp2p.git", branch = "libp2p_0.53.1", default-features = false, features = [ "gossipsub", "identify", "kad", @@ -76,6 +80,7 @@ libp2p = { git = "https://github.com/jsdanielh/rust-libp2p.git", default-feature "serde", "yamux", "wasm-bindgen", + "websocket-websys", ] } [dev-dependencies] @@ -88,4 +93,3 @@ nimiq-test-log = { workspace = true } metrics = ["prometheus-client"] tokio-time = ["tokio/time"] tokio-websocket = ["libp2p/dns", "libp2p/tcp", "libp2p/tokio", "libp2p/websocket"] -wasm-websocket = ["libp2p-websys-transport"] diff --git a/network-libp2p/src/behaviour.rs b/network-libp2p/src/behaviour.rs index 37e1618786..e0d477520d 100644 --- a/network-libp2p/src/behaviour.rs +++ b/network-libp2p/src/behaviour.rs @@ -1,141 +1,64 @@ use std::{iter, sync::Arc}; use libp2p::{ - core::either::EitherError, - gossipsub::{ - error::GossipsubHandlerError, Gossipsub, GossipsubEvent, MessageAuthenticity, - PeerScoreParams, PeerScoreThresholds, - }, - identify::{Behaviour as IdentifyBehaviour, Config as IdentifyConfig, Event as IdentifyEvent}, - kad::{store::MemoryStore, Kademlia, KademliaEvent}, - ping::{ - Behaviour as PingBehaviour, Config as PingConfig, Event as PingEvent, - Failure as PingFailure, - }, - request_response::{ - ProtocolSupport, RequestResponse, RequestResponseConfig, - RequestResponseEvent as ReqResEvent, - }, - swarm::{ConnectionHandlerUpgrErr, NetworkBehaviour}, - Multiaddr, PeerId, + connection_limits, gossipsub, identify, + kad::{self, store::MemoryStore}, + ping, request_response, + swarm::NetworkBehaviour, + Multiaddr, PeerId, StreamProtocol, }; use nimiq_utils::time::OffsetTime; use parking_lot::RwLock; use crate::{ - connection_pool::{ - behaviour::{ConnectionPoolBehaviour, ConnectionPoolEvent}, - handler::ConnectionPoolHandlerError, - }, - discovery::{ - behaviour::{DiscoveryBehaviour, DiscoveryEvent}, - handler::DiscoveryHandlerError, - peer_contacts::PeerContactBook, - }, - dispatch::codecs::typed::{IncomingRequest, MessageCodec, OutgoingResponse, ReqResProtocol}, + connection_pool, + discovery::{self, peer_contacts::PeerContactBook}, + dispatch::codecs::typed::MessageCodec, Config, }; -pub type NimiqNetworkBehaviourError = EitherError< - EitherError< - EitherError< - EitherError< - EitherError< - EitherError, - GossipsubHandlerError, - >, - std::io::Error, - >, - PingFailure, - >, - ConnectionPoolHandlerError, - >, - ConnectionHandlerUpgrErr, ->; - -pub type RequestResponseEvent = ReqResEvent; - -#[derive(Debug)] -pub enum NimiqEvent { - Dht(KademliaEvent), - Discovery(DiscoveryEvent), - Gossip(GossipsubEvent), - Identify(IdentifyEvent), - Ping(PingEvent), - Pool(ConnectionPoolEvent), - RequestResponse(RequestResponseEvent), -} - -impl From for NimiqEvent { - fn from(event: KademliaEvent) -> Self { - Self::Dht(event) - } -} - -impl From for NimiqEvent { - fn from(event: DiscoveryEvent) -> Self { - Self::Discovery(event) - } -} - -impl From for NimiqEvent { - fn from(event: GossipsubEvent) -> Self { - Self::Gossip(event) - } -} - -impl From for NimiqEvent { - fn from(event: IdentifyEvent) -> Self { - Self::Identify(event) - } -} - -impl From for NimiqEvent { - fn from(event: ConnectionPoolEvent) -> Self { - Self::Pool(event) - } -} - -impl From for NimiqEvent { - fn from(event: PingEvent) -> Self { - Self::Ping(event) - } -} - -impl From for NimiqEvent { - fn from(event: RequestResponseEvent) -> Self { - Self::RequestResponse(event) - } -} - +/// Maximum simultaneous libp2p connections per peer +const MAX_CONNECTIONS_PER_PEER: u32 = 2; + +/// Network behaviour. +/// This is composed of several other behaviours that build a tree of behaviours using +/// the `NetworkBehaviour` macro and the order of listed behaviours matters. +/// The first behaviours are behaviours that can close connections before establishing them +/// such as connection limits and the connection pool. They must be at the top since they +/// other behaviours such as request-response do not handle well that a connection is +/// denied in a behaviour that is "after". +/// See: https://github.com/libp2p/rust-libp2p/pull/4777#discussion_r1389951783. #[derive(NetworkBehaviour)] -#[behaviour(out_event = "NimiqEvent")] -pub struct NimiqBehaviour { - pub dht: Kademlia, - pub discovery: DiscoveryBehaviour, - pub gossipsub: Gossipsub, - pub identify: IdentifyBehaviour, - pub ping: PingBehaviour, - pub pool: ConnectionPoolBehaviour, - pub request_response: RequestResponse, +pub struct Behaviour { + pub connection_limits: connection_limits::Behaviour, + pub pool: connection_pool::Behaviour, + pub discovery: discovery::Behaviour, + pub dht: kad::Behaviour, + pub gossipsub: gossipsub::Behaviour, + pub identify: identify::Behaviour, + pub ping: ping::Behaviour, + pub request_response: request_response::Behaviour, } -impl NimiqBehaviour { +impl Behaviour { pub fn new( config: Config, clock: Arc, contacts: Arc>, - peer_score_params: PeerScoreParams, + peer_score_params: gossipsub::PeerScoreParams, ) -> Self { let public_key = config.keypair.public(); let peer_id = public_key.to_peer_id(); // DHT behaviour let store = MemoryStore::new(peer_id); - let dht = Kademlia::with_config(peer_id, store, config.kademlia); + let mut dht = kad::Behaviour::with_config(peer_id, store, config.kademlia); + // Fixme: This could be avoided with a protocol such as Autonat that properly set external addresses to the + // swarm and also avoids us to add addresses that are purely connection candidates. + dht.set_mode(Some(kad::Mode::Server)); // Discovery behaviour - let discovery = DiscoveryBehaviour::new( + let discovery = discovery::Behaviour::new( config.discovery.clone(), config.keypair.clone(), Arc::clone(&contacts), @@ -143,24 +66,27 @@ impl NimiqBehaviour { ); // Gossipsub behaviour - let thresholds = PeerScoreThresholds::default(); - let mut gossipsub = Gossipsub::new(MessageAuthenticity::Author(peer_id), config.gossipsub) - .expect("Wrong configuration"); + let thresholds = gossipsub::PeerScoreThresholds::default(); + let mut gossipsub = gossipsub::Behaviour::new( + gossipsub::MessageAuthenticity::Author(peer_id), + config.gossipsub, + ) + .expect("Wrong configuration"); gossipsub .with_peer_score(peer_score_params, thresholds) .expect("Valid score params and thresholds"); // Identify behaviour - let identify_config = IdentifyConfig::new("/albatross/2.0".to_string(), public_key); - let identify = IdentifyBehaviour::new(identify_config); + let identify_config = identify::Config::new("/albatross/2.0".to_string(), public_key); + let identify = identify::Behaviour::new(identify_config); // Ping behaviour: // - Send a ping every 15 seconds and timeout at 20 seconds. // - The ping behaviour will close the connection if a ping timeouts. - let ping = PingBehaviour::new(PingConfig::new()); + let ping = ping::Behaviour::new(ping::Config::new()); // Connection pool behaviour - let pool = ConnectionPoolBehaviour::new( + let pool = connection_pool::Behaviour::new( Arc::clone(&contacts), peer_id, config.seeds, @@ -168,11 +94,21 @@ impl NimiqBehaviour { ); // Request Response behaviour - let codec = MessageCodec::default(); - let protocol = ReqResProtocol::Version1; - let config = RequestResponseConfig::default(); - let request_response = - RequestResponse::new(codec, iter::once((protocol, ProtocolSupport::Full)), config); + let protocol = StreamProtocol::new("/nimiq/reqres/0.0.1"); + let config = request_response::Config::default(); + let request_response = request_response::Behaviour::new( + iter::once((protocol, request_response::ProtocolSupport::Full)), + config, + ); + + // Connection limits behaviour + let limits = connection_limits::ConnectionLimits::default() + .with_max_pending_incoming(Some(16)) + .with_max_pending_outgoing(Some(16)) + .with_max_established_incoming(Some(4800)) + .with_max_established_outgoing(Some(4800)) + .with_max_established_per_peer(Some(MAX_CONNECTIONS_PER_PEER)); + let connection_limits = connection_limits::Behaviour::new(limits); Self { dht, @@ -182,6 +118,7 @@ impl NimiqBehaviour { ping, pool, request_response, + connection_limits, } } diff --git a/network-libp2p/src/config.rs b/network-libp2p/src/config.rs index e7bd88879e..8c30e8319a 100644 --- a/network-libp2p/src/config.rs +++ b/network-libp2p/src/config.rs @@ -4,16 +4,11 @@ use std::{ time::Duration, }; -use libp2p::{ - gossipsub::{GossipsubConfig, GossipsubConfigBuilder, MessageId}, - identity::Keypair, - kad::{KademliaBucketInserts, KademliaConfig, KademliaStoreInserts}, - Multiaddr, -}; +use libp2p::{gossipsub, identity::Keypair, kad, Multiaddr}; use nimiq_hash::Blake2bHash; use nimiq_network_interface::peer_info::Services; -use crate::discovery::{behaviour::DiscoveryConfig, peer_contacts::PeerContact}; +use crate::discovery::{self, peer_contacts::PeerContact}; /// TLS settings for configuring a secure WebSocket pub struct TlsConfig { @@ -29,9 +24,9 @@ pub struct Config { pub keypair: Keypair, pub peer_contact: PeerContact, pub seeds: Vec, - pub discovery: DiscoveryConfig, - pub kademlia: KademliaConfig, - pub gossipsub: GossipsubConfig, + pub discovery: discovery::Config, + pub kademlia: kad::Config, + pub gossipsub: gossipsub::Config, pub memory_transport: bool, pub required_services: Services, pub tls: Option, @@ -49,7 +44,7 @@ impl Config { ) -> Self { // Hardcoding the minimum number of peers in mesh network before adding more // TODO: Maybe change this to a mesh limits configuration argument of this function - let gossipsub = GossipsubConfigBuilder::default() + let gossipsub = gossipsub::ConfigBuilder::default() .mesh_n_low(3) .validate_messages() .max_transmit_size(1_000_000) // TODO find a reasonable value for this parameter @@ -61,25 +56,25 @@ impl Config { let mut s = DefaultHasher::new(); message.topic.hash(&mut s); message.data.hash(&mut s); - MessageId::from(s.finish().to_string()) + gossipsub::MessageId::from(s.finish().to_string()) }) .build() .expect("Invalid Gossipsub config"); - let mut kademlia = KademliaConfig::default(); - kademlia.set_kbucket_inserts(KademliaBucketInserts::OnConnected); + let mut kademlia = kad::Config::default(); + kademlia.set_kbucket_inserts(kad::BucketInserts::OnConnected); kademlia.set_record_ttl(Some(Duration::from_secs(5 * 60))); kademlia.set_publication_interval(Some(Duration::from_secs(60))); // Since we have a record TTL of 5 minutes, record replication is not needed right now kademlia.set_replication_interval(None); - kademlia.set_record_filtering(KademliaStoreInserts::FilterBoth); + kademlia.set_record_filtering(kad::StoreInserts::FilterBoth); Self { keypair, peer_contact, seeds, - discovery: DiscoveryConfig::new(genesis_hash, required_services), + discovery: discovery::Config::new(genesis_hash, required_services), kademlia, gossipsub, memory_transport, diff --git a/network-libp2p/src/connection_pool/behaviour.rs b/network-libp2p/src/connection_pool/behaviour.rs index e60651e639..88a84c058c 100644 --- a/network-libp2p/src/connection_pool/behaviour.rs +++ b/network-libp2p/src/connection_pool/behaviour.rs @@ -10,11 +10,12 @@ use futures::StreamExt; use instant::Instant; use ip_network::IpNetwork; use libp2p::{ - core::{connection::ConnectionId, multiaddr::Protocol, ConnectedPoint}, + core::{multiaddr::Protocol, ConnectedPoint, Endpoint}, swarm::{ + behaviour::{ConnectionClosed, ConnectionEstablished, DialFailure}, dial_opts::{DialOpts, PeerCondition}, - ConnectionHandler, DialError, IntoConnectionHandler, NetworkBehaviour, - NetworkBehaviourAction, NotifyHandler, PollParameters, + dummy, CloseConnection, ConnectionDenied, ConnectionId, DialError, FromSwarm, + NetworkBehaviour, THandler, THandlerInEvent, THandlerOutEvent, ToSwarm, }, Multiaddr, PeerId, TransportError, }; @@ -22,20 +23,21 @@ use nimiq_macros::store_waker; use nimiq_network_interface::{network::CloseReason, peer_info::Services}; use parking_lot::RwLock; use rand::{seq::IteratorRandom, thread_rng}; +use void::Void; use wasm_timer::Interval; -use super::handler::{ConnectionPoolHandler, ConnectionPoolHandlerError}; +use super::Error; use crate::discovery::peer_contacts::PeerContactBook; #[derive(Clone, Debug)] -struct ConnectionPoolLimits { +struct Limits { ip_count: HashMap, ip_subnet_count: HashMap, peer_count: usize, } #[derive(Clone, Debug)] -struct ConnectionPoolConfig { +struct Config { peer_count_desired: usize, peer_count_max: usize, peer_count_per_ip_max: usize, @@ -56,7 +58,7 @@ struct IpInfo { ip: IpAddr, } -impl Default for ConnectionPoolConfig { +impl Default for Config { fn default() -> Self { Self { peer_count_desired: 12, @@ -150,7 +152,12 @@ impl ConnectionState { /// Also if the connection ID has been marked more that `self.max_failures` /// as failed then the connection ID will be marked as down. fn mark_failed(&mut self, id: T) { - self.dialing.remove(&id); + let dialing = self.dialing.remove(&id); + if dialing && self.connected.contains(&id) { + // We attempted a dial to an already connected peer. + // This could happen dialing a peer that is also dialing us + return; + } // TODO Ignore failures if down? @@ -222,13 +229,12 @@ impl std::fmt::Display for ConnectionState { /// Connection pool behaviour events #[derive(Debug)] -pub enum ConnectionPoolEvent { +pub enum Event { /// A peer has joined PeerJoined { peer_id: PeerId }, } -type PoolNetworkBehaviourAction = - NetworkBehaviourAction; +type PoolToSwarm = ToSwarm; /// Connection pool behaviour /// @@ -237,7 +243,7 @@ type PoolNetworkBehaviourAction = /// the peer is connected, is being dialed, is down or has failed. /// Also watches if we have received more connections than the allowed /// configured maximum per peer, IP or subnet. -pub struct ConnectionPoolBehaviour { +pub struct Behaviour { /// Peer contact book. This is the data structure where information of all /// known peers is store. This information includes known addresses and /// services of each of the peers. @@ -259,16 +265,16 @@ pub struct ConnectionPoolBehaviour { addresses: ConnectionState, /// Queue of actions this behaviour will emit for handler execution. - actions: VecDeque, + actions: VecDeque, /// Tells whether the connection pool behaviour is active or not active: bool, /// Counters per connection limits - limits: ConnectionPoolLimits, + limits: Limits, /// Configuration for the connection pool behaviour - config: ConnectionPoolConfig, + config: Config, /// Waker to signal when this behaviour needs to be polled again waker: Option, @@ -277,19 +283,19 @@ pub struct ConnectionPoolBehaviour { housekeeping_timer: Interval, } -impl ConnectionPoolBehaviour { +impl Behaviour { pub fn new( contacts: Arc>, own_peer_id: PeerId, seeds: Vec, required_services: Services, ) -> Self { - let limits = ConnectionPoolLimits { + let limits = Limits { ip_count: HashMap::new(), ip_subnet_count: HashMap::new(), peer_count: 0, }; - let config = ConnectionPoolConfig::default(); + let config = Config::default(); let housekeeping_timer = wasm_timer::Interval::new(config.housekeeping_interval); Self { @@ -350,12 +356,10 @@ impl ConnectionPoolBehaviour { // Dial peers from the contact book. for peer_id in self.choose_peers_to_dial() { self.peer_ids.mark_dialing(peer_id); - let handler = self.new_handler(); - self.actions.push_back(NetworkBehaviourAction::Dial { + self.actions.push_back(ToSwarm::Dial { opts: DialOpts::peer_id(peer_id) .condition(PeerCondition::Disconnected) .build(), - handler, }); } @@ -363,10 +367,8 @@ impl ConnectionPoolBehaviour { for address in self.choose_seeds_to_dial() { debug!(%address, "Dialing seed"); self.addresses.mark_dialing(address.clone()); - let handler = self.new_handler(); - self.actions.push_back(NetworkBehaviourAction::Dial { + self.actions.push_back(ToSwarm::Dial { opts: DialOpts::unknown_peer_id().address(address).build(), - handler, }); } } @@ -403,12 +405,10 @@ impl ConnectionPoolBehaviour { /// - The close reason `MaliciousPeer` will cause the peer to be banned. /// - Going offline will signal the network to stop connecting to peers. pub fn close_connection(&mut self, peer_id: PeerId, reason: CloseReason) { - self.actions - .push_back(NetworkBehaviourAction::NotifyHandler { - peer_id, - handler: NotifyHandler::Any, - event: ConnectionPoolHandlerError::Other(reason), - }); + self.actions.push_back(ToSwarm::CloseConnection { + peer_id, + connection: CloseConnection::All, + }); self.wake(); match reason { @@ -539,37 +539,20 @@ impl ConnectionPoolBehaviour { } } } -} - -impl NetworkBehaviour for ConnectionPoolBehaviour { - type ConnectionHandler = ConnectionPoolHandler; - type OutEvent = ConnectionPoolEvent; - - fn new_handler(&mut self) -> Self::ConnectionHandler { - ConnectionPoolHandler::default() - } - - fn addresses_of_peer(&mut self, peer_id: &PeerId) -> Vec { - self.contacts - .read() - .get(peer_id) - .map(|e| e.contact().addresses.clone()) - .unwrap_or_default() - } - fn inject_connection_established( + fn on_connection_established( &mut self, peer_id: &PeerId, connection_id: &ConnectionId, endpoint: &ConnectedPoint, - failed_addresses: Option<&Vec>, + failed_addresses: &[Multiaddr], other_established: usize, ) { + let address = endpoint.get_remote_address(); + // Mark failed addresses as such. - if let Some(addresses) = failed_addresses { - for address in addresses { - self.addresses.mark_failed(address.clone()); - } + for address in failed_addresses { + self.addresses.mark_failed(address.clone()); } // Ignore connection if another connection to this peer already exists. @@ -589,96 +572,28 @@ impl NetworkBehaviour for ConnectionPoolBehaviour { // does it. if *peer_id <= self.own_peer_id { // Notify the handler that the connection must be closed - self.actions - .push_back(NetworkBehaviourAction::NotifyHandler { - peer_id: *peer_id, - handler: NotifyHandler::One(*connection_id), - event: ConnectionPoolHandlerError::AlreadyConnected, - }); + self.actions.push_back(ToSwarm::CloseConnection { + peer_id: *peer_id, + connection: CloseConnection::One(*connection_id), + }); self.wake(); } return; } - let address = endpoint.get_remote_address(); - let mut close_reason = None; - if self.addresses.is_banned(address.clone()) { - debug!(%address, "Address is banned"); - close_reason = Some(ConnectionPoolHandlerError::BannedIp); - } else if self.peer_ids.is_banned(*peer_id) { - debug!(%peer_id, "Peer is banned"); - close_reason = Some(ConnectionPoolHandlerError::BannedPeer); - } - // Get IP from multiaddress if it exists. let ip_info = self.get_ip_info_from_multiaddr(address); - - // If we have an IP, check connection limits per IP. - if let Some(ip_info) = ip_info.clone() { - if self.config.peer_count_per_ip_max - < self - .limits - .ip_count - .get(&ip_info.ip) - .unwrap_or(&0) - .saturating_add(1) - { - // Subnet mask - debug!(ip=%ip_info.ip, limit=self.config.peer_count_per_ip_max, "Max peer connections per IP limit reached"); - close_reason = Some(ConnectionPoolHandlerError::MaxPeerPerIPConnectionsReached); - } - - // If we have the subnet IP, check connection limits per subnet - if let Some(subnet_ip) = ip_info.subnet_ip { - if self.config.peer_count_per_subnet_max - < self - .limits - .ip_subnet_count - .get(&subnet_ip) - .unwrap_or(&0) - .saturating_add(1) - { - // Subnet mask - debug!(%subnet_ip, limit=self.config.peer_count_per_subnet_max, "Max peer connections per IP subnet limit reached"); - close_reason = Some(ConnectionPoolHandlerError::MaxSubnetConnectionsReached); - } - } - } - - // Check for the maximum peer count limit - if self.config.peer_count_max < self.limits.peer_count.saturating_add(1) { - debug!( - connections = self.limits.peer_count, - "Max peer connections limit reached" - ); - close_reason = Some(ConnectionPoolHandlerError::MaxPeerConnectionsReached); - } - if let Some(ip_info) = ip_info { - if close_reason.is_none() { - // Increment peer counts per IP if we are not going to close the connection - if let Some(subnet_ip) = ip_info.subnet_ip { - let value = self.limits.ip_subnet_count.entry(subnet_ip).or_insert(0); - *value = value.saturating_add(1); - } - - let value = self.limits.ip_count.entry(ip_info.ip).or_insert(0); + // Increment peer counts per IP + if let Some(subnet_ip) = ip_info.subnet_ip { + let value = self.limits.ip_subnet_count.entry(subnet_ip).or_insert(0); *value = value.saturating_add(1); - - self.limits.peer_count = self.limits.peer_count.saturating_add(1); } - } - if let Some(close_reason) = close_reason { - // Notify the handler that the connection must be closed - self.actions - .push_back(NetworkBehaviourAction::NotifyHandler { - peer_id: *peer_id, - handler: NotifyHandler::One(*connection_id), - event: close_reason, - }); - self.wake(); - return; + let value = self.limits.ip_count.entry(ip_info.ip).or_insert(0); + *value = value.saturating_add(1); + + self.limits.peer_count = self.limits.peer_count.saturating_add(1); } // Peer is connected, mark it as such. @@ -686,20 +601,18 @@ impl NetworkBehaviour for ConnectionPoolBehaviour { self.addresses.mark_connected(address.clone()); self.actions - .push_back(NetworkBehaviourAction::GenerateEvent( - ConnectionPoolEvent::PeerJoined { peer_id: *peer_id }, - )); + .push_back(ToSwarm::GenerateEvent(Event::PeerJoined { + peer_id: *peer_id, + })); self.wake(); self.maintain_peers(); } - fn inject_connection_closed( + fn on_connection_closed( &mut self, peer_id: &PeerId, - _conn: &ConnectionId, endpoint: &ConnectedPoint, - _handler: ::Handler, remaining_established: usize, ) { // Check there are no more remaining connections to this peer @@ -741,20 +654,7 @@ impl NetworkBehaviour for ConnectionPoolBehaviour { self.maintain_peers(); } - fn inject_event( - &mut self, - _peer_id: PeerId, - _connection: ConnectionId, - _event: <::Handler as ConnectionHandler>::OutEvent, - ) { - } - - fn inject_dial_failure( - &mut self, - peer_id: Option, - _handler: Self::ConnectionHandler, - error: &DialError, - ) { + fn on_dial_failure(&mut self, peer_id: Option, error: &DialError) { let error_msg = match error { DialError::Transport(errors) => { let str = errors @@ -779,20 +679,16 @@ impl NetworkBehaviour for ConnectionPoolBehaviour { format!("No transport: {}", str) } - DialError::ConnectionIo(error) => error.to_string(), e => e.to_string(), }; match error { - DialError::Banned - | DialError::ConnectionLimit(_) - | DialError::LocalPeerId - | DialError::InvalidPeerId(_) + DialError::LocalPeerId { .. } | DialError::WrongPeerId { .. } | DialError::Aborted - | DialError::ConnectionIo(_) | DialError::Transport(_) - | DialError::NoAddresses => { + | DialError::NoAddresses + | DialError::Denied { .. } => { let peer_id = match peer_id { Some(id) => id, // Not interested in dial failures to unknown peers right now. @@ -804,7 +700,9 @@ impl NetworkBehaviour for ConnectionPoolBehaviour { self.maintain_peers(); } DialError::DialPeerConditionFalse( - PeerCondition::Disconnected | PeerCondition::NotDialing, + PeerCondition::Disconnected + | PeerCondition::NotDialing + | PeerCondition::DisconnectedAndNotDialing, ) => { // We might (still) be connected, or about to be connected, thus do not report the // failure. @@ -814,12 +712,162 @@ impl NetworkBehaviour for ConnectionPoolBehaviour { } } } +} + +impl NetworkBehaviour for Behaviour { + type ConnectionHandler = dummy::ConnectionHandler; + type ToSwarm = Event; + + fn on_swarm_event(&mut self, event: FromSwarm) { + match event { + FromSwarm::ConnectionEstablished(ConnectionEstablished { + peer_id, + connection_id, + endpoint, + failed_addresses, + other_established, + }) => { + self.on_connection_established( + &peer_id, + &connection_id, + endpoint, + failed_addresses, + other_established, + ); + } + FromSwarm::ConnectionClosed(ConnectionClosed { + peer_id, + endpoint, + remaining_established, + .. + }) => { + self.on_connection_closed(&peer_id, endpoint, remaining_established); + } + FromSwarm::DialFailure(DialFailure { peer_id, error, .. }) => { + self.on_dial_failure(peer_id, error) + } + _ => {} + } + } + + fn on_connection_handler_event( + &mut self, + _peer_id: PeerId, + _connection_id: ConnectionId, + event: THandlerOutEvent, + ) { + void::unreachable(event) + } + + fn handle_pending_outbound_connection( + &mut self, + _connection_id: ConnectionId, + maybe_peer: Option, + _addresses: &[Multiaddr], + _effective_role: Endpoint, + ) -> Result, ConnectionDenied> { + let peer_id = match maybe_peer { + None => return Ok(vec![]), + Some(peer) => peer, + }; + + Ok(self + .contacts + .read() + .get(&peer_id) + .map(|e| e.contact().addresses.clone()) + .unwrap_or_default()) + } + + fn handle_pending_inbound_connection( + &mut self, + _connection_id: ConnectionId, + _local_addr: &Multiaddr, + remote_addr: &Multiaddr, + ) -> Result<(), ConnectionDenied> { + if self.addresses.is_banned(remote_addr.clone()) { + debug!(%remote_addr, "Address is banned"); + return Err(ConnectionDenied::new(Error::BannedIp)); + } + + // Get IP from multiaddress if it exists. + let ip_info = self.get_ip_info_from_multiaddr(remote_addr); + + // If we have an IP, check connection limits per IP. + if let Some(ip_info) = ip_info.clone() { + if self.config.peer_count_per_ip_max + < self + .limits + .ip_count + .get(&ip_info.ip) + .unwrap_or(&0) + .saturating_add(1) + { + // Subnet mask + debug!(ip=%ip_info.ip, limit=self.config.peer_count_per_ip_max, "Max peer connections per IP limit reached"); + return Err(ConnectionDenied::new(Error::MaxPeerPerIPConnectionsReached)); + } + + // If we have the subnet IP, check connection limits per subnet + if let Some(subnet_ip) = ip_info.subnet_ip { + if self.config.peer_count_per_subnet_max + < self + .limits + .ip_subnet_count + .get(&subnet_ip) + .unwrap_or(&0) + .saturating_add(1) + { + // Subnet mask + debug!(%subnet_ip, limit=self.config.peer_count_per_subnet_max, "Max peer connections per IP subnet limit reached"); + return Err(ConnectionDenied::new(Error::MaxSubnetConnectionsReached)); + } + } + } + + // Check for the maximum peer count limit + if self.config.peer_count_max < self.limits.peer_count.saturating_add(1) { + debug!( + connections = self.limits.peer_count, + "Max peer connections limit reached" + ); + return Err(ConnectionDenied::new(Error::MaxPeerConnectionsReached)); + } + + Ok(()) + } + + fn handle_established_inbound_connection( + &mut self, + _connection_id: ConnectionId, + peer: PeerId, + _local_addr: &Multiaddr, + _remote_addr: &Multiaddr, + ) -> Result, ConnectionDenied> { + // Peer IDs checks are performed here since it is in this point where we have + // this information. + if self.peer_ids.is_banned(peer) { + debug!(peer_id=%peer, "Peer is banned"); + return Err(ConnectionDenied::new(Error::BannedPeer)); + } + + Ok(dummy::ConnectionHandler) + } + + fn handle_established_outbound_connection( + &mut self, + _connection_id: ConnectionId, + _peer: PeerId, + _addr: &Multiaddr, + _role_override: Endpoint, + ) -> Result, ConnectionDenied> { + Ok(dummy::ConnectionHandler) + } fn poll( &mut self, cx: &mut Context<'_>, - _params: &mut impl PollParameters, - ) -> Poll> { + ) -> Poll>> { // Dispatch pending actions. if let Some(action) = self.actions.pop_front() { return Poll::Ready(action); diff --git a/network-libp2p/src/connection_pool/handler.rs b/network-libp2p/src/connection_pool/handler.rs deleted file mode 100644 index 4cf4fa6b51..0000000000 --- a/network-libp2p/src/connection_pool/handler.rs +++ /dev/null @@ -1,112 +0,0 @@ -use std::task::{Context, Poll}; - -use libp2p::{ - core::upgrade::{DeniedUpgrade, InboundUpgrade, OutboundUpgrade}, - swarm::{ - ConnectionHandler, ConnectionHandlerEvent, ConnectionHandlerUpgrErr, KeepAlive, - NegotiatedSubstream, SubstreamProtocol, - }, -}; -use nimiq_network_interface::network::CloseReason; -use thiserror::Error; - -#[derive(Default)] -pub struct ConnectionPoolHandler { - /// If set to `Some` it indicates that the current connection handler - /// must be closed with the reason specified. - close_reason: Option, -} - -/// Connection Pool errors -#[derive(Clone, Debug, Error)] -pub enum ConnectionPoolHandlerError { - /// There is already a connection for this Peer - #[error("Peer is already connected")] - AlreadyConnected, - - /// Ip is banned - #[error("IP is banned")] - BannedIp, - - /// Peer is banned - #[error("Peer is banned")] - BannedPeer, - - /// Maximum connections per subnet has been reached - #[error("Maximum connections per subnet has been reached")] - MaxSubnetConnectionsReached, - - /// Maximum peer connections has been reached - #[error("Maximum peer connections has been reached")] - MaxPeerConnectionsReached, - - ///Maximum peers connections per IP has been reached - #[error("Maximum peers connections per IP has been reached")] - MaxPeerPerIPConnectionsReached, - - /// The application sent the network to close the connection with the - /// provided reason - #[error("Application sent a close action with reason: {0:?}")] - Other(CloseReason), -} - -// Implement ConnectionHandler without an actual protocol, which -// implies a DeniedUpgrade protocol -impl ConnectionHandler for ConnectionPoolHandler { - type InEvent = ConnectionPoolHandlerError; // Only receive errors as events for this handler - type OutEvent = (); - type Error = ConnectionPoolHandlerError; - type InboundProtocol = DeniedUpgrade; - type OutboundProtocol = DeniedUpgrade; - type InboundOpenInfo = (); - type OutboundOpenInfo = (); - - fn listen_protocol(&self) -> SubstreamProtocol { - SubstreamProtocol::new(DeniedUpgrade, ()) - } - - fn inject_fully_negotiated_inbound( - &mut self, - _: >::Output, - _info: (), - ) { - unreachable!("`DeniedUpgrade` is never successful.") - } - - fn inject_fully_negotiated_outbound( - &mut self, - _: >::Output, - _info: (), - ) { - unreachable!("`DeniedUpgrade` is never successful.") - } - - fn inject_event(&mut self, close_reason: ConnectionPoolHandlerError) { - if self.close_reason.is_none() { - self.close_reason = Some(close_reason); - } - } - - fn inject_dial_upgrade_error( - &mut self, - _info: Self::OutboundOpenInfo, - _error: ConnectionHandlerUpgrErr< - >::Error, - >, - ) { - } - - fn connection_keep_alive(&self) -> KeepAlive { - KeepAlive::Yes - } - - fn poll( - &mut self, - _cx: &mut Context, - ) -> Poll> { - if let Some(reason) = self.close_reason.take() { - return Poll::Ready(ConnectionHandlerEvent::Close(reason)); - } - Poll::Pending - } -} diff --git a/network-libp2p/src/connection_pool/mod.rs b/network-libp2p/src/connection_pool/mod.rs index 9029272e88..90978f8168 100644 --- a/network-libp2p/src/connection_pool/mod.rs +++ b/network-libp2p/src/connection_pool/mod.rs @@ -1,2 +1,27 @@ pub mod behaviour; -pub mod handler; +pub use behaviour::{Behaviour, Event}; +use thiserror::Error; + +/// Connection Pool errors +#[derive(Clone, Debug, Error)] +pub enum Error { + /// Ip is banned + #[error("IP is banned")] + BannedIp, + + /// Peer is banned + #[error("Peer is banned")] + BannedPeer, + + /// Maximum connections per subnet has been reached + #[error("Maximum connections per subnet has been reached")] + MaxSubnetConnectionsReached, + + /// Maximum peer connections has been reached + #[error("Maximum peer connections has been reached")] + MaxPeerConnectionsReached, + + ///Maximum peers connections per IP has been reached + #[error("Maximum peers connections per IP has been reached")] + MaxPeerPerIPConnectionsReached, +} diff --git a/network-libp2p/src/discovery/behaviour.rs b/network-libp2p/src/discovery/behaviour.rs index d33ec0996b..8525a19bb2 100644 --- a/network-libp2p/src/discovery/behaviour.rs +++ b/network-libp2p/src/discovery/behaviour.rs @@ -7,11 +7,12 @@ use std::{ use futures::StreamExt; use libp2p::{ - core::connection::{ConnectedPoint, ConnectionId}, + core::Endpoint, identity::Keypair, swarm::{ - AddressScore, KeepAlive, NetworkBehaviour, NetworkBehaviourAction, NotifyHandler, - PollParameters, + behaviour::{ConnectionClosed, ConnectionEstablished}, + CloseConnection, ConnectionDenied, ConnectionId, FromSwarm, NetworkBehaviour, + NotifyHandler, ToSwarm, }, Multiaddr, PeerId, }; @@ -22,12 +23,12 @@ use parking_lot::RwLock; use wasm_timer::Interval; use super::{ - handler::{DiscoveryHandler, HandlerInEvent, HandlerOutEvent}, + handler::{Handler, HandlerInEvent, HandlerOutEvent}, peer_contacts::{PeerContact, PeerContactBook}, }; #[derive(Clone, Debug)] -pub struct DiscoveryConfig { +pub struct Config { /// Genesis hash for the network we want to be connected to. pub genesis_hash: Blake2bHash, @@ -51,10 +52,10 @@ pub struct DiscoveryConfig { pub house_keeping_interval: Duration, /// Whether to keep the connection alive, even if no other behaviour uses it. - pub keep_alive: KeepAlive, + pub keep_alive: bool, } -impl DiscoveryConfig { +impl Config { pub fn new(genesis_hash: Blake2bHash, required_services: Services) -> Self { Self { genesis_hash, @@ -64,13 +65,13 @@ impl DiscoveryConfig { update_limit: 64, required_services, house_keeping_interval: Duration::from_secs(60), - keep_alive: KeepAlive::Yes, + keep_alive: true, } } } #[derive(Clone, Debug)] -pub enum DiscoveryEvent { +pub enum Event { Established { peer_id: PeerId, peer_address: Multiaddr, @@ -79,7 +80,7 @@ pub enum DiscoveryEvent { Update, } -type DiscoveryNetworkBehaviourAction = NetworkBehaviourAction; +type DiscoveryToSwarm = ToSwarm; /// Network behaviour for peer exchange. /// @@ -90,9 +91,9 @@ type DiscoveryNetworkBehaviourAction = NetworkBehaviourAction, /// Queue with events to emit. - pub events: VecDeque, + pub events: VecDeque, /// Timer to do house-keeping in the peer address book. house_keeping_timer: Interval, } -impl DiscoveryBehaviour { +impl Behaviour { pub fn new( - config: DiscoveryConfig, + config: Config, keypair: Keypair, peer_contact_book: Arc>, clock: Arc, @@ -139,92 +140,147 @@ impl DiscoveryBehaviour { } } -impl NetworkBehaviour for DiscoveryBehaviour { - type ConnectionHandler = DiscoveryHandler; - type OutEvent = DiscoveryEvent; +impl NetworkBehaviour for Behaviour { + type ConnectionHandler = Handler; + type ToSwarm = Event; - fn new_handler(&mut self) -> Self::ConnectionHandler { - DiscoveryHandler::new( + fn handle_established_inbound_connection( + &mut self, + _connection_id: ConnectionId, + _peer: PeerId, + _local_addr: &Multiaddr, + _remote_addr: &Multiaddr, + ) -> Result { + Ok(Handler::new( self.config.clone(), self.keypair.clone(), self.peer_contact_book(), - ) + )) } - fn addresses_of_peer(&mut self, peer_id: &PeerId) -> Vec { - self.peer_contact_book - .read() - .get(peer_id) - .map(|addresses_opt| addresses_opt.addresses().cloned().collect()) - .unwrap_or_default() + fn handle_established_outbound_connection( + &mut self, + _connection_id: ConnectionId, + _peer: PeerId, + _addr: &Multiaddr, + _role_override: Endpoint, + ) -> Result { + Ok(Handler::new( + self.config.clone(), + self.keypair.clone(), + self.peer_contact_book(), + )) } - fn inject_connection_closed( + fn handle_pending_outbound_connection( &mut self, - peer_id: &PeerId, - _: &ConnectionId, - _: &ConnectedPoint, - _: Self::ConnectionHandler, - remaining_established: usize, - ) { - if remaining_established == 0 { - // There are no more remaining connections to this peer - self.connected_peers.remove(peer_id); + _connection_id: ConnectionId, + maybe_peer: Option, + _addresses: &[Multiaddr], + _effective_role: Endpoint, + ) -> Result, ConnectionDenied> { + let peer_id = match maybe_peer { + None => return Ok(vec![]), + Some(peer) => peer, + }; + + Ok(self + .peer_contact_book + .read() + .get(&peer_id) + .map(|e| e.contact().addresses.clone()) + .unwrap_or_default()) + } + + fn poll(&mut self, cx: &mut Context) -> Poll { + // Emit events + if let Some(event) = self.events.pop_front() { + return Poll::Ready(event); } + + // Poll house-keeping timer + match self.house_keeping_timer.poll_next_unpin(cx) { + Poll::Ready(Some(_)) => { + trace!("Doing house-keeping in peer address book"); + let mut peer_address_book = self.peer_contact_book.write(); + peer_address_book.update_own_contact(&self.keypair); + peer_address_book.house_keeping(); + } + Poll::Ready(None) => unreachable!(), + Poll::Pending => {} + } + + Poll::Pending } - fn inject_connection_established( - &mut self, - peer_id: &PeerId, - connection_id: &ConnectionId, - endpoint: &ConnectedPoint, - failed_addresses: Option<&Vec>, - other_established: usize, - ) { - let peer_address = endpoint.get_remote_address().clone(); - - // Signal to the handler the address that got us a connection - self.events - .push_back(NetworkBehaviourAction::NotifyHandler { - peer_id: *peer_id, - handler: NotifyHandler::One(*connection_id), - event: HandlerInEvent::ConnectionAddress(peer_address.clone()), - }); - - if other_established == 0 { - trace!(%peer_id, ?connection_id, ?endpoint, "DiscoveryBehaviour::inject_connection_established:"); - - // This is the first connection to this peer - self.connected_peers.insert(*peer_id); - - // Report the observed addresses of the endpoint if a peer successfully connected to us - if endpoint.is_listener() { - self.events - .push_back(NetworkBehaviourAction::NotifyHandler { - peer_id: *peer_id, - handler: NotifyHandler::One(*connection_id), - event: HandlerInEvent::ObservedAddress(peer_address), - }); - // Peer failed to connect with some of our own addresses, remove them from our own addresses - if let Some(failed_addresses) = failed_addresses { - if !failed_addresses.is_empty() { - debug!( - ?failed_addresses, - "Removing failed address from own addresses" - ); - self.peer_contact_book - .write() - .remove_own_addresses(failed_addresses.clone(), &self.keypair) + fn on_swarm_event(&mut self, event: FromSwarm) { + match event { + FromSwarm::ConnectionClosed(ConnectionClosed { + peer_id, + remaining_established, + .. + }) => { + if remaining_established == 0 { + // There are no more remaining connections to this peer + self.connected_peers.remove(&peer_id); + } + } + FromSwarm::ConnectionEstablished(ConnectionEstablished { + peer_id, + connection_id, + endpoint, + failed_addresses, + other_established, + }) => { + let peer_address = endpoint.get_remote_address().clone(); + + // Signal to the handler the address that got us a connection + self.events.push_back(ToSwarm::NotifyHandler { + peer_id, + handler: NotifyHandler::One(connection_id), + event: HandlerInEvent::ConnectionAddress(peer_address.clone()), + }); + + if other_established == 0 { + trace!(%peer_id, ?connection_id, ?endpoint, "Behaviour::inject_connection_established:"); + + // This is the first connection to this peer + self.connected_peers.insert(peer_id); + + // Report the observed addresses of the endpoint if a peer successfully connected to us + if endpoint.is_listener() { + self.events.push_back(ToSwarm::NotifyHandler { + peer_id, + handler: NotifyHandler::One(connection_id), + event: HandlerInEvent::ObservedAddress(peer_address), + }); + // Peer failed to connect with some of our own addresses, remove them from our own addresses + if !failed_addresses.is_empty() { + debug!( + ?failed_addresses, + "Removing failed address from own addresses" + ); + self.peer_contact_book.write().remove_own_addresses( + failed_addresses.iter().cloned(), + &self.keypair, + ) + } } + } else { + trace!(%peer_id, "Behaviour::inject_connection_established: Already have a connection established to peer"); } } - } else { - trace!(%peer_id, "DiscoveryBehaviour::inject_connection_established: Already have a connection established to peer"); + _ => {} } } - fn inject_event(&mut self, peer_id: PeerId, _connection: ConnectionId, event: HandlerOutEvent) { - trace!(%peer_id, ?event, "inject_event"); + fn on_connection_handler_event( + &mut self, + peer_id: PeerId, + _connection: ConnectionId, + event: HandlerOutEvent, + ) { + trace!(%peer_id, ?event, "on_connection_handler_event"); match event { HandlerOutEvent::PeerExchangeEstablished { @@ -232,50 +288,25 @@ impl NetworkBehaviour for DiscoveryBehaviour { peer_contact: signed_peer_contact, } => { if let Some(peer_contact) = self.peer_contact_book.read().get(&peer_id) { - self.events.push_back(NetworkBehaviourAction::GenerateEvent( - DiscoveryEvent::Established { + self.events + .push_back(ToSwarm::GenerateEvent(Event::Established { peer_id: signed_peer_contact.public_key().clone().to_peer_id(), peer_address, peer_contact: peer_contact.contact().clone(), - }, - )); + })); } } HandlerOutEvent::ObservedAddresses { observed_addresses } => { - let score = AddressScore::Infinite; for address in observed_addresses { self.events - .push_back(NetworkBehaviourAction::ReportObservedAddr { address, score }); + .push_back(ToSwarm::NewExternalAddrCandidate(address)); } } - HandlerOutEvent::Update => self.events.push_back( - NetworkBehaviourAction::GenerateEvent(DiscoveryEvent::Update), - ), - } - } - - fn poll( - &mut self, - cx: &mut Context, - _params: &mut impl PollParameters, - ) -> Poll> { - // Emit events - if let Some(event) = self.events.pop_front() { - return Poll::Ready(event); - } - - // Poll house-keeping timer - match self.house_keeping_timer.poll_next_unpin(cx) { - Poll::Ready(Some(_)) => { - trace!("Doing house-keeping in peer address book"); - let mut peer_address_book = self.peer_contact_book.write(); - peer_address_book.update_own_contact(&self.keypair); - peer_address_book.house_keeping(); - } - Poll::Ready(None) => unreachable!(), - Poll::Pending => {} + HandlerOutEvent::Update => self.events.push_back(ToSwarm::GenerateEvent(Event::Update)), + HandlerOutEvent::Error(_) => self.events.push_back(ToSwarm::CloseConnection { + peer_id, + connection: CloseConnection::All, + }), } - - Poll::Pending } } diff --git a/network-libp2p/src/discovery/handler.rs b/network-libp2p/src/discovery/handler.rs index e68c096471..4b2367cfd6 100644 --- a/network-libp2p/src/discovery/handler.rs +++ b/network-libp2p/src/discovery/handler.rs @@ -10,8 +10,10 @@ use instant::Instant; use libp2p::{ identity::Keypair, swarm::{ - ConnectionHandler, ConnectionHandlerEvent, ConnectionHandlerUpgrErr, KeepAlive, - NegotiatedSubstream, SubstreamProtocol, + handler::{ + ConnectionEvent, DialUpgradeError, FullyNegotiatedInbound, FullyNegotiatedOutbound, + }, + ConnectionHandler, ConnectionHandlerEvent, Stream, SubstreamProtocol, }, Multiaddr, }; @@ -25,7 +27,7 @@ use thiserror::Error; use wasm_timer::Interval; use super::{ - behaviour::DiscoveryConfig, + behaviour::Config, message_codec::{MessageReader, MessageWriter}, peer_contacts::{PeerContactBook, SignedPeerContact}, protocol::{ChallengeNonce, DiscoveryMessage, DiscoveryProtocol}, @@ -39,7 +41,7 @@ pub enum HandlerInEvent { ObservedAddress(Multiaddr), } -#[derive(Clone, Debug)] +#[derive(Debug)] pub enum HandlerOutEvent { /// List of observed addresses for the peer ObservedAddresses { @@ -51,10 +53,12 @@ pub enum HandlerOutEvent { peer_contact: SignedPeerContact, }, Update, + /// An error occurred + Error(Error), } #[derive(Debug, Error)] -pub enum DiscoveryHandlerError { +pub enum Error { #[error("IO error: {0}")] Io(#[from] std::io::Error), @@ -80,7 +84,7 @@ pub enum DiscoveryHandlerError { ChallengeResponseFailed, #[error("Signing error: {0}")] - Signing(#[from] libp2p::identity::error::SigningError), + Signing(#[from] libp2p::identity::SigningError), #[error("Received too frequent updates: {}", .interval.as_secs())] TooFrequentUpdates { interval: Duration }, @@ -89,7 +93,7 @@ pub enum DiscoveryHandlerError { UpdateLimitExceeded { num_peer_contacts: usize }, } -impl DiscoveryHandlerError { +impl Error { /// Short-hand to create an IO error variant with an ConnectionReset error. pub fn connection_reset() -> Self { Self::Io(std::io::ErrorKind::ConnectionReset.into()) @@ -117,9 +121,9 @@ pub enum HandlerState { Established, } -pub struct DiscoveryHandler { +pub struct Handler { /// Configuration for peer discovery. - config: DiscoveryConfig, + config: Config, /// Identity keypair for this node. keypair: Keypair, @@ -152,18 +156,18 @@ pub struct DiscoveryHandler { last_update_time: Option, /// The inbound message stream. - inbound: Option>, + inbound: Option>, /// The outbound message stream. - outbound: Option>, + outbound: Option>, /// Waker used when opening a substream. waker: Option, } -impl DiscoveryHandler { +impl Handler { pub fn new( - config: DiscoveryConfig, + config: Config, keypair: Keypair, peer_contact_book: Arc>, ) -> Self { @@ -232,10 +236,9 @@ impl DiscoveryHandler { } } -impl ConnectionHandler for DiscoveryHandler { - type InEvent = HandlerInEvent; - type OutEvent = HandlerOutEvent; - type Error = DiscoveryHandlerError; +impl ConnectionHandler for Handler { + type FromBehaviour = HandlerInEvent; + type ToBehaviour = HandlerOutEvent; type InboundProtocol = DiscoveryProtocol; type OutboundProtocol = DiscoveryProtocol; type InboundOpenInfo = (); @@ -245,39 +248,45 @@ impl ConnectionHandler for DiscoveryHandler { SubstreamProtocol::new(DiscoveryProtocol, ()) } - fn inject_fully_negotiated_inbound( + fn on_connection_event( &mut self, - protocol: MessageReader, - _info: (), + event: ConnectionEvent< + Self::InboundProtocol, + Self::OutboundProtocol, + Self::InboundOpenInfo, + Self::OutboundOpenInfo, + >, ) { - if self.inbound.is_some() { - panic!("Inbound already connected"); + match event { + ConnectionEvent::FullyNegotiatedInbound(FullyNegotiatedInbound { + protocol, .. + }) => { + if self.inbound.is_some() { + panic!("Inbound already connected"); + } + self.inbound = Some(protocol); + self.check_initialized(); + } + ConnectionEvent::FullyNegotiatedOutbound(FullyNegotiatedOutbound { + protocol, .. + }) => { + if self.outbound.is_some() { + panic!("Outbound already connected"); + } + if self.state != HandlerState::OpenSubstream { + panic!("Unexpected outbound"); + } + self.outbound = Some(protocol); + self.check_initialized(); + } + ConnectionEvent::DialUpgradeError(DialUpgradeError { error, .. }) => { + error!(%error, "inject_dial_upgrade_error"); + } + _ => {} } - - self.inbound = Some(protocol); - - self.check_initialized(); } - fn inject_fully_negotiated_outbound( - &mut self, - protocol: MessageWriter, - _info: (), - ) { - if self.outbound.is_some() { - panic!("Outbound already connected"); - } - - if self.state != HandlerState::OpenSubstream { - panic!("Unexpected outbound"); - } - - self.outbound = Some(protocol); - - self.check_initialized(); - } - - fn inject_event(&mut self, event: HandlerInEvent) { + fn on_behaviour_event(&mut self, event: HandlerInEvent) { match event { HandlerInEvent::ConnectionAddress(address) => { self.peer_address = Some(address); @@ -290,31 +299,23 @@ impl ConnectionHandler for DiscoveryHandler { } } - fn inject_dial_upgrade_error( - &mut self, - _info: Self::OutboundOpenInfo, - error: ConnectionHandlerUpgrErr, - ) { - error!(%error, "inject_dial_upgrade_error"); - } - - fn connection_keep_alive(&self) -> KeepAlive { + fn connection_keep_alive(&self) -> bool { self.config.keep_alive } fn poll( &mut self, cx: &mut Context, - ) -> Poll< - ConnectionHandlerEvent, - > { + ) -> Poll> { loop { // Send message // This should be done first, so we can flush the outbound sink's buffer. if let Some(outbound) = self.outbound.as_mut() { match outbound.poll_ready_unpin(cx) { Poll::Ready(Err(e)) => { - return Poll::Ready(ConnectionHandlerEvent::Close(e.into())) + return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour( + HandlerOutEvent::Error(e.into()), + )) } // Make sure the outbound sink is ready before we continue. @@ -355,12 +356,14 @@ impl ConnectionHandler for DiscoveryHandler { genesis_hash: self.config.genesis_hash.clone(), limit: self.config.update_limit, services: self.config.required_services, - // TODO: If we really include this here, put this in `DiscoveryConfig` + // TODO: If we really include this here, put this in `Config` user_agent: "TODO".to_string(), }; if let Err(e) = self.send(&msg) { - return Poll::Ready(ConnectionHandlerEvent::Close(e.into())); + return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour( + HandlerOutEvent::Error(e.into()), + )); } self.state = HandlerState::ReceiveHandshake; @@ -381,12 +384,16 @@ impl ConnectionHandler for DiscoveryHandler { } => { // Check if the received genesis hash matches. if genesis_hash != self.config.genesis_hash { - return Poll::Ready(ConnectionHandlerEvent::Close( - DiscoveryHandlerError::GenesisHashMismatch { - expected: self.config.genesis_hash.clone(), - received: genesis_hash, - }, - )); + return Poll::Ready( + ConnectionHandlerEvent::NotifyBehaviour( + HandlerOutEvent::Error( + Error::GenesisHashMismatch { + expected: self.config.genesis_hash.clone(), + received: genesis_hash, + }, + ), + ), + ); } let mut peer_contact_book = self.peer_contact_book.write(); @@ -420,35 +427,39 @@ impl ConnectionHandler for DiscoveryHandler { drop(peer_contact_book); if let Err(e) = self.send(&msg) { - return Poll::Ready(ConnectionHandlerEvent::Close( - e.into(), - )); + return Poll::Ready( + ConnectionHandlerEvent::NotifyBehaviour( + HandlerOutEvent::Error(e.into()), + ), + ); } self.state = HandlerState::ReceiveHandshakeAck; - return Poll::Ready(ConnectionHandlerEvent::Custom( + return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour( HandlerOutEvent::ObservedAddresses { observed_addresses }, )); } _ => { - return Poll::Ready(ConnectionHandlerEvent::Close( - DiscoveryHandlerError::UnexpectedMessage { + return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour( + HandlerOutEvent::Error(Error::UnexpectedMessage { message, state: self.state, - }, + }), )) } } } Poll::Ready(None) => { - return Poll::Ready(ConnectionHandlerEvent::Close( - DiscoveryHandlerError::connection_reset(), + return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour( + HandlerOutEvent::Error(Error::connection_reset()), )) } Poll::Ready(Some(Err(e))) => { - return Poll::Ready(ConnectionHandlerEvent::Close(e.into())) + return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour( + HandlerOutEvent::Error(e.into()), + )) } Poll::Pending => break, } @@ -467,11 +478,15 @@ impl ConnectionHandler for DiscoveryHandler { } => { // Check the peer contact for a valid signature. if !peer_contact.verify() { - return Poll::Ready(ConnectionHandlerEvent::Close( - DiscoveryHandlerError::InvalidPeerContactSignature { - peer_contact, - }, - )); + return Poll::Ready( + ConnectionHandlerEvent::NotifyBehaviour( + HandlerOutEvent::Error( + Error::InvalidPeerContactSignature { + peer_contact, + }, + ), + ), + ); } // TODO: Do we need to check other stuff in the peer contact? @@ -483,9 +498,13 @@ impl ConnectionHandler for DiscoveryHandler { &self.challenge_nonce, peer_contact.public_key(), ) { - return Poll::Ready(ConnectionHandlerEvent::Close( - DiscoveryHandlerError::ChallengeResponseFailed, - )); + return Poll::Ready( + ConnectionHandlerEvent::NotifyBehaviour( + HandlerOutEvent::Error( + Error::ChallengeResponseFailed, + ), + ), + ); } let mut peer_contact_book = self.peer_contact_book.write(); @@ -520,7 +539,7 @@ impl ConnectionHandler for DiscoveryHandler { self.state = HandlerState::Established; // Return an event that we established PEX with a new peer. - return Poll::Ready(ConnectionHandlerEvent::Custom( + return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour( HandlerOutEvent::PeerExchangeEstablished { peer_contact, peer_address: self @@ -532,22 +551,24 @@ impl ConnectionHandler for DiscoveryHandler { } _ => { - return Poll::Ready(ConnectionHandlerEvent::Close( - DiscoveryHandlerError::UnexpectedMessage { + return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour( + HandlerOutEvent::Error(Error::UnexpectedMessage { message, state: self.state, - }, + }), )) } } } Poll::Ready(None) => { - return Poll::Ready(ConnectionHandlerEvent::Close( - DiscoveryHandlerError::connection_reset(), + return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour( + HandlerOutEvent::Error(Error::connection_reset()), )) } Poll::Ready(Some(Err(e))) => { - return Poll::Ready(ConnectionHandlerEvent::Close(e.into())) + return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour( + HandlerOutEvent::Error(e.into()), + )) } Poll::Pending => break, } @@ -565,22 +586,28 @@ impl ConnectionHandler for DiscoveryHandler { let interval = now - last_update_time; if interval < self.config.min_recv_update_interval { // TODO: Should we just close, or ban? - return Poll::Ready(ConnectionHandlerEvent::Close( - DiscoveryHandlerError::TooFrequentUpdates { - interval, - }, - )); + return Poll::Ready( + ConnectionHandlerEvent::NotifyBehaviour( + HandlerOutEvent::Error( + Error::TooFrequentUpdates { interval }, + ), + ), + ); } } self.last_update_time = Some(now); // Check if the update is not too large. if peer_contacts.len() > self.config.update_limit as usize { - return Poll::Ready(ConnectionHandlerEvent::Close( - DiscoveryHandlerError::UpdateLimitExceeded { - num_peer_contacts: peer_contacts.len(), - }, - )); + return Poll::Ready( + ConnectionHandlerEvent::NotifyBehaviour( + HandlerOutEvent::Error( + Error::UpdateLimitExceeded { + num_peer_contacts: peer_contacts.len(), + }, + ), + ), + ); } // Insert the new peer contacts into the peer contact book. @@ -589,28 +616,30 @@ impl ConnectionHandler for DiscoveryHandler { self.config.required_services, ); - return Poll::Ready(ConnectionHandlerEvent::Custom( + return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour( HandlerOutEvent::Update, )); } _ => { - return Poll::Ready(ConnectionHandlerEvent::Close( - DiscoveryHandlerError::UnexpectedMessage { + return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour( + HandlerOutEvent::Error(Error::UnexpectedMessage { message, state: self.state, - }, + }), )) } } } Poll::Ready(None) => { - return Poll::Ready(ConnectionHandlerEvent::Close( - DiscoveryHandlerError::connection_reset(), + return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour( + HandlerOutEvent::Error(Error::connection_reset()), )) } Poll::Ready(Some(Err(e))) => { - return Poll::Ready(ConnectionHandlerEvent::Close(e.into())) + return Poll::Ready(ConnectionHandlerEvent::NotifyBehaviour( + HandlerOutEvent::Error(e.into()), + )) } Poll::Pending => {} } @@ -626,9 +655,11 @@ impl ConnectionHandler for DiscoveryHandler { let msg = DiscoveryMessage::PeerAddresses { peer_contacts }; if let Err(e) = self.send(&msg) { - return Poll::Ready(ConnectionHandlerEvent::Close( - e.into(), - )); + return Poll::Ready( + ConnectionHandlerEvent::NotifyBehaviour( + HandlerOutEvent::Error(e.into()), + ), + ); } } } diff --git a/network-libp2p/src/discovery/mod.rs b/network-libp2p/src/discovery/mod.rs index dee1955a3a..633b27348a 100644 --- a/network-libp2p/src/discovery/mod.rs +++ b/network-libp2p/src/discovery/mod.rs @@ -3,3 +3,6 @@ pub mod handler; pub mod message_codec; pub mod peer_contacts; pub mod protocol; + +pub use behaviour::{Behaviour, Config, Event}; +pub use handler::Error; diff --git a/network-libp2p/src/discovery/peer_contacts.rs b/network-libp2p/src/discovery/peer_contacts.rs index caeaa86273..5784297a77 100644 --- a/network-libp2p/src/discovery/peer_contacts.rs +++ b/network-libp2p/src/discovery/peer_contacts.rs @@ -6,7 +6,7 @@ use std::{ use instant::SystemTime; use libp2p::{ - gossipsub::Gossipsub, + gossipsub, identity::{Keypair, PublicKey}, Multiaddr, PeerId, }; @@ -344,7 +344,7 @@ impl PeerContactBook { /// Updates the score of every peer in the contact book with the gossipsub /// peer score. - pub fn update_scores(&self, gossipsub: &Gossipsub) { + pub fn update_scores(&self, gossipsub: &gossipsub::Behaviour) { let contacts = self.peer_contacts.iter(); for contact in contacts { @@ -427,14 +427,19 @@ impl PeerContactBook { mod serde_public_key { use libp2p::identity::PublicKey; - use serde::{de::Error, Deserialize, Deserializer, Serialize, Serializer}; + use serde::{ + de::Error, ser::Error as SerializationError, Deserialize, Deserializer, Serialize, + Serializer, + }; pub fn serialize(public_key: &PublicKey, serializer: S) -> Result where S: Serializer, { - match public_key { - PublicKey::Ed25519(pk) => Serialize::serialize(&pk.encode(), serializer), + if let Ok(pk) = public_key.clone().try_into_ed25519() { + Serialize::serialize(&pk.to_bytes(), serializer) + } else { + Err(S::Error::custom("Unsupported key type")) } } @@ -444,9 +449,9 @@ mod serde_public_key { { let hex_encoded: [u8; 32] = Deserialize::deserialize(deserializer)?; - let pk = libp2p::identity::ed25519::PublicKey::decode(&hex_encoded) + let pk = libp2p::identity::ed25519::PublicKey::try_from_bytes(&hex_encoded) .map_err(|_| D::Error::custom("Invalid value"))?; - Ok(PublicKey::Ed25519(pk)) + Ok(PublicKey::from(pk)) } } diff --git a/network-libp2p/src/discovery/protocol.rs b/network-libp2p/src/discovery/protocol.rs index c8ea53fe78..79a577ac31 100644 --- a/network-libp2p/src/discovery/protocol.rs +++ b/network-libp2p/src/discovery/protocol.rs @@ -86,7 +86,7 @@ pub enum DiscoveryMessage { pub struct DiscoveryProtocol; impl UpgradeInfo for DiscoveryProtocol { - type Info = &'static [u8]; + type Info = &'static str; type InfoIter = std::iter::Once; fn protocol_info(&self) -> Self::InfoIter { diff --git a/network-libp2p/src/dispatch/codecs/typed.rs b/network-libp2p/src/dispatch/codecs/typed.rs index e93f343716..5d6ed2b566 100644 --- a/network-libp2p/src/dispatch/codecs/typed.rs +++ b/network-libp2p/src/dispatch/codecs/typed.rs @@ -8,13 +8,9 @@ use std::{fmt::Debug, io}; -use futures::{AsyncRead, AsyncWrite, AsyncWriteExt}; -use libp2p::{ - core::{upgrade, ProtocolName}, - request_response::RequestResponseCodec, -}; - -use crate::REQRES_PROTOCOL; +use futures::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt}; +use libp2p::{request_response, StreamProtocol}; +use unsigned_varint; /// Maximum request size in bytes (5 kB) const MAX_REQUEST_SIZE: usize = 5 * 1024; @@ -27,22 +23,98 @@ pub struct MessageCodec {} pub type IncomingRequest = Vec; pub type OutgoingResponse = Vec; -#[derive(Debug, Clone)] -pub enum ReqResProtocol { - Version1, +async fn write_length_prefixed( + socket: &mut (impl AsyncWrite + Unpin), + data: impl AsRef<[u8]>, +) -> Result<(), io::Error> { + write_varint(socket, data.as_ref().len()).await?; + socket.write_all(data.as_ref()).await?; + socket.flush().await?; + + Ok(()) } -impl ProtocolName for ReqResProtocol { - fn protocol_name(&self) -> &[u8] { - match *self { - ReqResProtocol::Version1 => REQRES_PROTOCOL, +/// Writes a variable-length integer to the `socket`. +/// +/// > **Note**: Does **NOT** flush the socket. +async fn write_varint(socket: &mut (impl AsyncWrite + Unpin), len: usize) -> Result<(), io::Error> { + let mut len_data = unsigned_varint::encode::usize_buffer(); + let encoded_len = unsigned_varint::encode::usize(len, &mut len_data).len(); + socket.write_all(&len_data[..encoded_len]).await?; + + Ok(()) +} + +/// Reads a variable-length integer from the `socket`. +/// +/// As a special exception, if the `socket` is empty and EOFs right at the beginning, then we +/// return `Ok(0)`. +/// +/// > **Note**: This function reads bytes one by one from the `socket`. It is therefore encouraged +/// > to use some sort of buffering mechanism. +async fn read_varint(socket: &mut (impl AsyncRead + Unpin)) -> Result { + let mut buffer = unsigned_varint::encode::usize_buffer(); + let mut buffer_len = 0; + + loop { + match socket.read(&mut buffer[buffer_len..buffer_len + 1]).await? { + 0 => { + // Reaching EOF before finishing to read the length is an error, unless the EOF is + // at the very beginning of the substream, in which case we assume that the data is + // empty. + if buffer_len == 0 { + return Ok(0); + } else { + return Err(io::ErrorKind::UnexpectedEof.into()); + } + } + n => debug_assert_eq!(n, 1), + } + + buffer_len += 1; + + match unsigned_varint::decode::usize(&buffer[..buffer_len]) { + Ok((len, _)) => return Ok(len), + Err(unsigned_varint::decode::Error::Overflow) => { + return Err(io::Error::new( + io::ErrorKind::InvalidData, + "overflow in variable-length integer", + )); + } + Err(_) => {} } } } +/// Reads a length-prefixed message from the given socket. +/// +/// The `max_size` parameter is the maximum size in bytes of the message that we accept. This is +/// necessary in order to avoid DoS attacks where the remote sends us a message of several +/// gigabytes. +/// +/// > **Note**: Assumes that a variable-length prefix indicates the length of the message. This is +/// > compatible with what [`write_length_prefixed`] does. +async fn read_length_prefixed( + socket: &mut (impl AsyncRead + Unpin), + max_size: usize, +) -> io::Result> { + let len = read_varint(socket).await?; + if len > max_size { + return Err(io::Error::new( + io::ErrorKind::InvalidData, + format!("Received data size ({len} bytes) exceeds maximum ({max_size} bytes)"), + )); + } + + let mut buf = vec![0; len]; + socket.read_exact(&mut buf).await?; + + Ok(buf) +} + #[async_trait::async_trait] -impl RequestResponseCodec for MessageCodec { - type Protocol = ReqResProtocol; +impl request_response::Codec for MessageCodec { + type Protocol = StreamProtocol; type Request = IncomingRequest; type Response = OutgoingResponse; @@ -50,7 +122,7 @@ impl RequestResponseCodec for MessageCodec { where T: AsyncRead + Unpin + Send, { - let bytes = upgrade::read_length_prefixed(io, MAX_REQUEST_SIZE).await?; + let bytes = read_length_prefixed(io, MAX_REQUEST_SIZE).await?; Ok(bytes) } @@ -62,7 +134,7 @@ impl RequestResponseCodec for MessageCodec { where T: AsyncRead + Unpin + Send, { - let bytes = upgrade::read_length_prefixed(io, MAX_RESPONSE_SIZE).await?; + let bytes = read_length_prefixed(io, MAX_RESPONSE_SIZE).await?; Ok(bytes) } @@ -75,7 +147,7 @@ impl RequestResponseCodec for MessageCodec { where T: AsyncWrite + Send + Unpin, { - upgrade::write_length_prefixed(io, &req).await?; + write_length_prefixed(io, &req).await?; io.close().await } @@ -88,7 +160,7 @@ impl RequestResponseCodec for MessageCodec { where T: AsyncWrite + Unpin + Send, { - upgrade::write_length_prefixed(io, &res).await?; + write_length_prefixed(io, &res).await?; io.close().await } } diff --git a/network-libp2p/src/error.rs b/network-libp2p/src/error.rs index 38238a7006..3114607569 100644 --- a/network-libp2p/src/error.rs +++ b/network-libp2p/src/error.rs @@ -1,6 +1,6 @@ use thiserror::Error; -use crate::{behaviour::NimiqNetworkBehaviourError, dispatch::codecs::typed::MessageCodec}; +use crate::dispatch::codecs::typed::MessageCodec; #[derive(Debug, Error)] pub enum NetworkError { @@ -19,9 +19,6 @@ pub enum NetworkError { #[error("Serialization error: {0}")] Serialization(#[from] nimiq_serde::DeserializeError), - #[error("Network behaviour error: {0}")] - Behaviour(#[from] NimiqNetworkBehaviourError), - #[error("DHT store error: {0:?}")] DhtStore(libp2p::kad::store::Error), @@ -32,10 +29,10 @@ pub enum NetworkError { DhtPutRecord(libp2p::kad::PutRecordError), #[error("Gossipsub Publish error: {0:?}")] - GossipsubPublish(libp2p::gossipsub::error::PublishError), + GossipsubPublish(libp2p::gossipsub::PublishError), #[error("Gossipsub Subscription error: {0:?}")] - GossipsubSubscription(libp2p::gossipsub::error::SubscriptionError), + GossipsubSubscription(libp2p::gossipsub::SubscriptionError), #[error("Already subscribed to topic: {topic_name}")] AlreadySubscribed { topic_name: String }, @@ -52,9 +49,7 @@ pub enum NetworkError { error: &'static str, }, #[error("Response channel closed: {0:?}")] - ResponseChannelClosed( - ::Response, - ), + ResponseChannelClosed(::Response), } impl From> for NetworkError { @@ -87,14 +82,14 @@ impl From for NetworkError { } } -impl From for NetworkError { - fn from(e: libp2p::gossipsub::error::PublishError) -> Self { +impl From for NetworkError { + fn from(e: libp2p::gossipsub::PublishError) -> Self { Self::GossipsubPublish(e) } } -impl From for NetworkError { - fn from(e: libp2p::gossipsub::error::SubscriptionError) -> Self { +impl From for NetworkError { + fn from(e: libp2p::gossipsub::SubscriptionError) -> Self { Self::GossipsubSubscription(e) } } diff --git a/network-libp2p/src/lib.rs b/network-libp2p/src/lib.rs index e49912f967..2820566e9c 100644 --- a/network-libp2p/src/lib.rs +++ b/network-libp2p/src/lib.rs @@ -12,9 +12,7 @@ mod network; mod network_metrics; mod rate_limiting; -pub const REQRES_PROTOCOL: &[u8] = b"/nimiq/reqres/0.0.1"; -pub const MESSAGE_PROTOCOL: &[u8] = b"/nimiq/message/0.0.1"; -pub const DISCOVERY_PROTOCOL: &[u8] = b"/nimiq/discovery/0.0.1"; +pub const DISCOVERY_PROTOCOL: &str = "/nimiq/discovery/0.0.1"; pub use config::{Config, TlsConfig}; pub use error::NetworkError; @@ -25,9 +23,11 @@ pub use libp2p::{ PeerId, }; pub use network::Network; -use serde::{de::Error, Deserialize, Deserializer, Serialize, Serializer}; +use serde::{ + de::Error, ser::Error as SerializationError, Deserialize, Deserializer, Serialize, Serializer, +}; -/// Wrapper to libp2p Keypair indetity that implements SerDe Serialize/Deserialize +/// Wrapper to libp2p Keypair identity that implements SerDe Serialize/Deserialize #[derive(Clone, Debug)] pub struct Libp2pKeyPair(pub libp2p::identity::Keypair); @@ -36,10 +36,10 @@ impl Serialize for Libp2pKeyPair { where S: Serializer, { - match &self.0 { - Keypair::Ed25519(keypair) => { - serde_big_array::BigArray::serialize(&keypair.encode(), serializer) - } + if let Ok(pk) = self.0.clone().try_into_ed25519() { + serde_big_array::BigArray::serialize(&pk.to_bytes(), serializer) + } else { + Err(S::Error::custom("Unsupported key type")) } } } @@ -51,8 +51,9 @@ impl<'de> Deserialize<'de> for Libp2pKeyPair { { let mut hex_encoded: [u8; 64] = serde_big_array::BigArray::deserialize(deserializer)?; - let pk = libp2p::identity::ed25519::Keypair::decode(&mut hex_encoded) + let keypair = libp2p::identity::ed25519::Keypair::try_from_bytes(&mut hex_encoded) .map_err(|_| D::Error::custom("Invalid value"))?; - Ok(Libp2pKeyPair(Keypair::Ed25519(pk))) + + Ok(Libp2pKeyPair(Keypair::from(keypair))) } } diff --git a/network-libp2p/src/network.rs b/network-libp2p/src/network.rs index 8f215e815a..28a92b2d18 100644 --- a/network-libp2p/src/network.rs +++ b/network-libp2p/src/network.rs @@ -12,35 +12,31 @@ use bytes::Bytes; use futures::{future::BoxFuture, ready, stream::BoxStream, Stream, StreamExt}; #[cfg(not(feature = "tokio-time"))] use instant::Instant; +#[cfg(all(target_family = "wasm", not(feature = "tokio-websocket")))] +use libp2p::websocket_websys; use libp2p::{ core, core::{ muxing::StreamMuxerBox, transport::{Boxed, MemoryTransport}, }, - gossipsub::{ - error::PublishError, GossipsubEvent, GossipsubMessage, IdentTopic, MessageAcceptance, - MessageId, PeerScoreParams, TopicHash, TopicScoreParams, - }, - identify::Event as IdentifyEvent, + gossipsub, identify, identity::Keypair, kad::{ - store::RecordStore, GetRecordOk, InboundRequest, KademliaEvent, QueryId, QueryResult, - Quorum, Record, + self, store::RecordStore, GetRecordOk, InboundRequest, QueryId, QueryResult, Quorum, Record, }, noise, - ping::Success as PingSuccess, - request_response::{OutboundFailure, RequestId, RequestResponseMessage, ResponseChannel}, + request_response::{ + self, InboundRequestId, OutboundFailure, OutboundRequestId, ResponseChannel, + }, swarm::{ dial_opts::{DialOpts, PeerCondition}, - ConnectionLimits, NetworkInfo, SwarmBuilder, SwarmEvent, + NetworkInfo, SwarmEvent, }, - yamux, Multiaddr, PeerId, Swarm, Transport, + yamux, Multiaddr, PeerId, Swarm, SwarmBuilder, Transport, }; #[cfg(feature = "tokio-websocket")] use libp2p::{dns, tcp, websocket}; -#[cfg(all(feature = "wasm-websocket", not(feature = "tokio-websocket")))] -use libp2p_websys_transport::WebsocketTransport; use log::Instrument; use nimiq_bls::CompressedPublicKey; use nimiq_network_interface::{ @@ -69,18 +65,14 @@ use wasm_timer::Interval; #[cfg(feature = "metrics")] use crate::network_metrics::NetworkMetrics; use crate::{ - behaviour::{NimiqBehaviour, NimiqEvent, NimiqNetworkBehaviourError, RequestResponseEvent}, - connection_pool::behaviour::ConnectionPoolEvent, - discovery::{behaviour::DiscoveryEvent, peer_contacts::PeerContactBook}, + behaviour, connection_pool, + discovery::{behaviour::Event, peer_contacts::PeerContactBook}, dispatch::codecs::typed::{IncomingRequest, OutgoingResponse}, rate_limiting::{PendingDeletion, RateLimit}, Config, NetworkError, TlsConfig, }; -/// Maximum simultaneous libp2p connections per peer -const MAX_CONNECTIONS_PER_PEER: u32 = 2; - -type NimiqSwarm = Swarm; +type NimiqSwarm = Swarm; #[derive(Debug)] pub(crate) enum NetworkAction { @@ -106,7 +98,10 @@ pub(crate) enum NetworkAction { buffer_size: usize, validate: bool, output: oneshot::Sender< - Result, NetworkError>, + Result< + mpsc::Receiver<(gossipsub::Message, gossipsub::MessageId, PeerId)>, + NetworkError, + >, >, }, Unsubscribe { @@ -123,17 +118,17 @@ pub(crate) enum NetworkAction { }, ReceiveRequests { type_id: RequestType, - output: mpsc::Sender<(Bytes, RequestId, PeerId)>, + output: mpsc::Sender<(Bytes, InboundRequestId, PeerId)>, }, SendRequest { peer_id: PeerId, request: IncomingRequest, request_type_id: RequestType, response_channel: oneshot::Sender>, - output: oneshot::Sender, + output: oneshot::Sender, }, SendResponse { - request_id: RequestId, + request_id: InboundRequestId, response: OutgoingResponse, output: oneshot::Sender>, }, @@ -158,7 +153,7 @@ pub(crate) enum NetworkAction { struct ValidateMessage { pubsub_id: GossipsubId

, - acceptance: MessageAcceptance, + acceptance: gossipsub::MessageAcceptance, topic: &'static str, } @@ -170,9 +165,9 @@ impl ValidateMessage

{ Self { pubsub_id, acceptance: match acceptance { - MsgAcceptance::Accept => MessageAcceptance::Accept, - MsgAcceptance::Ignore => MessageAcceptance::Ignore, - MsgAcceptance::Reject => MessageAcceptance::Reject, + MsgAcceptance::Accept => gossipsub::MessageAcceptance::Accept, + MsgAcceptance::Ignore => gossipsub::MessageAcceptance::Ignore, + MsgAcceptance::Reject => gossipsub::MessageAcceptance::Reject, }, topic: ::NAME, } @@ -183,18 +178,24 @@ impl ValidateMessage

{ struct TaskState { dht_puts: HashMap>>, dht_gets: HashMap, NetworkError>>>, - gossip_topics: HashMap, bool)>, + gossip_topics: HashMap< + gossipsub::TopicHash, + ( + mpsc::Sender<(gossipsub::Message, gossipsub::MessageId, PeerId)>, + bool, + ), + >, is_bootstrapped: bool, - requests: HashMap>>, + requests: HashMap>>, #[cfg(feature = "metrics")] - requests_initiated: HashMap, - response_channels: HashMap>, - receive_requests: HashMap>, + requests_initiated: HashMap, + response_channels: HashMap>, + receive_requests: HashMap>, } #[derive(Clone, Debug)] pub struct GossipsubId { - message_id: MessageId, + message_id: gossipsub::MessageId, propagation_source: P, } @@ -246,17 +247,11 @@ impl Network { let contacts = Arc::new(RwLock::new(PeerContactBook::new( own_peer_contact.sign(&config.keypair), ))); - let params = PeerScoreParams { + let params = gossipsub::PeerScoreParams { ip_colocation_factor_threshold: 20.0, ..Default::default() }; - let swarm = Self::new_swarm( - clock, - config, - Arc::clone(&contacts), - params.clone(), - executor.clone(), - ); + let swarm = Self::new_swarm(clock, config, Arc::clone(&contacts), params.clone()); let local_peer_id = *Swarm::local_peer_id(&swarm); let connected_peers = Arc::new(RwLock::new(HashMap::new())); @@ -312,7 +307,7 @@ impl Network { // TODO: Use websocket over the memory transport #[cfg(feature = "tokio-websocket")] - let mut transport = websocket::WsConfig::new(dns::TokioDnsConfig::system( + let mut transport = websocket::WsConfig::new(dns::tokio::Transport::system( tcp::tokio::Transport::new(tcp::Config::default().nodelay(true)), )?); @@ -337,22 +332,18 @@ impl Network { let transport = MemoryTransport::default(); // Fixme: Handle wasm compatible transport - let noise_keys = noise::Keypair::::new() - .into_authentic(keypair) - .unwrap(); - - let mut yamux = yamux::YamuxConfig::default(); + let mut yamux = yamux::Config::default(); yamux.set_window_update_mode(yamux::WindowUpdateMode::on_read()); Ok(transport .upgrade(core::upgrade::Version::V1) - .authenticate(noise::NoiseConfig::xx(noise_keys).into_authenticated()) + .authenticate(noise::Config::new(keypair).unwrap()) .multiplex(yamux) .timeout(std::time::Duration::from_secs(20)) .boxed()) } else { #[cfg(feature = "tokio-websocket")] - let mut transport = websocket::WsConfig::new(dns::TokioDnsConfig::system( + let mut transport = websocket::WsConfig::new(dns::tokio::Transport::system( tcp::tokio::Transport::new(tcp::Config::default().nodelay(true)), )?); @@ -370,22 +361,18 @@ impl Network { .set_tls_config(websocket::tls::Config::new(priv_key, certificates).unwrap()); } - #[cfg(all(feature = "wasm-websocket", not(feature = "tokio-websocket")))] - let transport = WebsocketTransport::default(); + #[cfg(all(target_family = "wasm", not(feature = "tokio-websocket")))] + let transport = websocket_websys::Transport::default(); - #[cfg(all(not(feature = "tokio-websocket"), not(feature = "wasm-websocket")))] + #[cfg(all(not(feature = "tokio-websocket"), not(target_family = "wasm")))] let transport = MemoryTransport::default(); - let noise_keys = noise::Keypair::::new() - .into_authentic(keypair) - .unwrap(); - - let mut yamux = yamux::YamuxConfig::default(); + let mut yamux = yamux::Config::default(); yamux.set_window_update_mode(yamux::WindowUpdateMode::on_read()); Ok(transport .upgrade(core::upgrade::Version::V1) - .authenticate(noise::NoiseConfig::xx(noise_keys).into_authenticated()) + .authenticate(noise::Config::new(keypair).unwrap()) .multiplex(yamux) .timeout(std::time::Duration::from_secs(20)) .boxed()) @@ -396,34 +383,32 @@ impl Network { clock: Arc, config: Config, contacts: Arc>, - peer_score_params: PeerScoreParams, - executor: impl TaskExecutor + Clone + Send + 'static, - ) -> Swarm { - let local_peer_id = PeerId::from(config.keypair.public()); - + peer_score_params: gossipsub::PeerScoreParams, + ) -> Swarm { + let keypair = config.keypair.clone(); let transport = - Self::new_transport(&config.keypair, config.memory_transport, &config.tls).unwrap(); - - let behaviour = NimiqBehaviour::new(config, clock, contacts, peer_score_params); + Self::new_transport(&keypair, config.memory_transport, &config.tls).unwrap(); - let limits = ConnectionLimits::default() - .with_max_pending_incoming(Some(16)) - .with_max_pending_outgoing(Some(16)) - .with_max_established_incoming(Some(4800)) - .with_max_established_outgoing(Some(4800)) - .with_max_established_per_peer(Some(MAX_CONNECTIONS_PER_PEER)); + let behaviour = behaviour::Behaviour::new(config, clock, contacts, peer_score_params); // TODO add proper config - SwarmBuilder::with_executor( - transport, - behaviour, - local_peer_id, - Box::new(move |fut| { - executor.exec(fut); - }), - ) - .connection_limits(limits) - .build() + #[cfg(not(target_family = "wasm"))] + let swarm = SwarmBuilder::with_existing_identity(keypair) + .with_tokio() + .with_other_transport(|_| transport) + .unwrap() + .with_behaviour(|_| behaviour) + .unwrap() + .build(); + #[cfg(target_family = "wasm")] + let swarm = SwarmBuilder::with_existing_identity(keypair) + .with_wasm_bindgen() + .with_other_transport(|_| transport) + .unwrap() + .with_behaviour(|_| behaviour) + .unwrap() + .build(); + swarm } pub fn local_peer_id(&self) -> &PeerId { @@ -454,7 +439,7 @@ impl Network { validate_msg = validate_rx.recv() => { if let Some(validate_msg) = validate_msg { let topic = validate_msg.topic; - let result: Result = swarm + let result: Result = swarm .behaviour_mut() .gossipsub .report_message_validation_result( @@ -522,7 +507,7 @@ impl Network { validate_msg = validate_rx.recv() => { if let Some(validate_msg) = validate_msg { let topic = validate_msg.topic; - let result: Result = swarm + let result: Result = swarm .behaviour_mut() .gossipsub .report_message_validation_result( @@ -563,7 +548,7 @@ impl Network { } fn handle_event( - event: SwarmEvent, + event: SwarmEvent, events_tx: &broadcast::Sender>, swarm: &mut NimiqSwarm, state: &mut TaskState, @@ -574,16 +559,20 @@ impl Network { ) { match event { SwarmEvent::ConnectionEstablished { + connection_id, peer_id, endpoint, num_established, concurrent_dial_errors, + established_in, } => { debug!( + %connection_id, %peer_id, address = %endpoint.get_remote_address(), direction = if endpoint.is_dialer() { "outbound" } else { "inbound" }, connections = num_established, + ?established_in, "Connection established", ); @@ -621,12 +610,14 @@ impl Network { } SwarmEvent::ConnectionClosed { + connection_id, peer_id, endpoint, num_established, cause, } => { info!( + %connection_id, %peer_id, ?endpoint, connections = num_established, @@ -654,10 +645,12 @@ impl Network { } } SwarmEvent::IncomingConnection { + connection_id, local_addr, send_back_addr, } => { debug!( + %connection_id, address = %send_back_addr, listen_address = %local_addr, "Incoming connection", @@ -665,11 +658,13 @@ impl Network { } SwarmEvent::IncomingConnectionError { + connection_id, local_addr, send_back_addr, error, } => { debug!( + %connection_id, address = %send_back_addr, listen_address = %local_addr, %error, @@ -677,16 +672,20 @@ impl Network { ); } - SwarmEvent::Dialing(peer_id) => { + SwarmEvent::Dialing { + peer_id, + connection_id: _, + } => { // This event is only triggered if the network behaviour performs the dial - debug!(%peer_id, "Dialing peer"); + debug!(?peer_id, "Dialing peer"); } SwarmEvent::Behaviour(event) => { match event { - NimiqEvent::Dht(event) => { + behaviour::BehaviourEvent::ConnectionLimits(_) => {} + behaviour::BehaviourEvent::Dht(event) => { match event { - KademliaEvent::OutboundQueryProgressed { + kad::Event::OutboundQueryProgressed { id, result, stats: _, @@ -755,7 +754,7 @@ impl Network { _ => {} } } - KademliaEvent::InboundRequest { + kad::Event::InboundRequest { request: InboundRequest::PutRecord { source: _, @@ -804,10 +803,10 @@ impl Network { _ => {} } } - NimiqEvent::Discovery(event) => { + behaviour::BehaviourEvent::Discovery(event) => { swarm.behaviour_mut().pool.maintain_peers(); match event { - DiscoveryEvent::Established { + Event::Established { peer_id, peer_address, peer_contact, @@ -825,11 +824,11 @@ impl Network { error!(%peer_id, "Peer joined but it already exists"); } } - DiscoveryEvent::Update => {} + Event::Update => {} } } - NimiqEvent::Gossip(event) => match event { - GossipsubEvent::Message { + behaviour::BehaviourEvent::Gossipsub(event) => match event { + gossipsub::Event::Message { propagation_source, message_id, message, @@ -844,7 +843,7 @@ impl Network { .report_message_validation_result( &message_id, &propagation_source, - MessageAcceptance::Accept, + gossipsub::MessageAcceptance::Accept, ) { error!(%message_id, %error, "could not send message validation result to channel"); @@ -866,19 +865,19 @@ impl Network { #[cfg(feature = "metrics")] metrics.note_received_pubsub_message(&topic); } - GossipsubEvent::Subscribed { peer_id, topic } => { + gossipsub::Event::Subscribed { peer_id, topic } => { trace!(%peer_id, %topic, "peer subscribed to topic"); } - GossipsubEvent::Unsubscribed { peer_id, topic } => { + gossipsub::Event::Unsubscribed { peer_id, topic } => { trace!(%peer_id, %topic, "peer unsubscribed"); } - GossipsubEvent::GossipsubNotSupported { peer_id } => { + gossipsub::Event::GossipsubNotSupported { peer_id } => { debug!(%peer_id, "gossipsub not supported"); } }, - NimiqEvent::Identify(event) => { + behaviour::BehaviourEvent::Identify(event) => { match event { - IdentifyEvent::Received { peer_id, info } => { + identify::Event::Received { peer_id, info } => { debug!( %peer_id, address = %info.observed_addr, @@ -900,13 +899,13 @@ impl Network { } } } - IdentifyEvent::Pushed { peer_id } => { - trace!(%peer_id, "Pushed identity to peer"); + identify::Event::Pushed { peer_id, info } => { + trace!(%peer_id, ?info, "Pushed identity information to peer"); } - IdentifyEvent::Sent { peer_id } => { - trace!(%peer_id, "Sent identity to peer"); + identify::Event::Sent { peer_id } => { + trace!(%peer_id, "Sent identity information to peer"); } - IdentifyEvent::Error { peer_id, error } => { + identify::Event::Error { peer_id, error } => { error!( %peer_id, %error, @@ -915,34 +914,27 @@ impl Network { } } } - NimiqEvent::Ping(event) => { + behaviour::BehaviourEvent::Ping(event) => { match event.result { Err(error) => { log::debug!(%error, ?event.peer, "Ping failed with peer"); } - Ok(PingSuccess::Pong) => { - log::trace!(?event.peer, "Responded Ping from peer"); - } - Ok(PingSuccess::Ping { rtt }) => { - log::trace!( - ?event.peer, - ?rtt, - "Sent Ping and received response to/from peer", - ); + Ok(duration) => { + log::trace!(?event.peer, ?duration, "Successful ping from peer"); } }; } - NimiqEvent::Pool(event) => { + behaviour::BehaviourEvent::Pool(event) => { match event { - ConnectionPoolEvent::PeerJoined { peer_id: _ } => {} + connection_pool::Event::PeerJoined { peer_id: _ } => {} }; } - NimiqEvent::RequestResponse(event) => match event { - RequestResponseEvent::Message { + behaviour::BehaviourEvent::RequestResponse(event) => match event { + request_response::Event::Message { peer: peer_id, message, } => match message { - RequestResponseMessage::Request { + request_response::Message::Request { request_id, request, channel, @@ -1033,7 +1025,7 @@ impl Network { ); } } - RequestResponseMessage::Response { + request_response::Message::Response { request_id, response, } => { @@ -1061,7 +1053,7 @@ impl Network { } } }, - RequestResponseEvent::OutboundFailure { + request_response::Event::OutboundFailure { peer: peer_id, request_id, error, @@ -1084,7 +1076,7 @@ impl Network { ); } } - RequestResponseEvent::InboundFailure { + request_response::Event::InboundFailure { peer, request_id, error, @@ -1096,7 +1088,7 @@ impl Network { "Response to request sent from peer failed", ); } - RequestResponseEvent::ResponseSent { peer, request_id } => { + request_response::Event::ResponseSent { peer, request_id } => { trace!( %request_id, peer_id = %peer, @@ -1177,7 +1169,7 @@ impl Network { validate, output, } => { - let topic = IdentTopic::new(topic_name.clone()); + let topic = gossipsub::IdentTopic::new(topic_name.clone()); match swarm.behaviour_mut().gossipsub.subscribe(&topic) { // New subscription. Insert the sender into our subscription table. @@ -1189,7 +1181,7 @@ impl Network { match swarm .behaviour_mut() .gossipsub - .set_topic_params(topic, TopicScoreParams::default()) + .set_topic_params(topic, gossipsub::TopicScoreParams::default()) { Ok(_) => { if output.send(Ok(rx)).is_err() { @@ -1231,7 +1223,7 @@ impl Network { } } NetworkAction::Unsubscribe { topic_name, output } => { - let topic = IdentTopic::new(topic_name.clone()); + let topic = gossipsub::IdentTopic::new(topic_name.clone()); if state.gossip_topics.get_mut(&topic.hash()).is_some() { match swarm.behaviour_mut().gossipsub.unsubscribe(&topic) { @@ -1280,7 +1272,7 @@ impl Network { data, output, } => { - let topic = IdentTopic::new(topic_name.clone()); + let topic = gossipsub::IdentTopic::new(topic_name.clone()); if output .send( @@ -1290,7 +1282,7 @@ impl Network { .publish(topic, data) .map(|_| ()) .or_else(|e| match e { - PublishError::Duplicate => Ok(()), + gossipsub::PublishError::Duplicate => Ok(()), _ => Err(e), }) .map_err(Into::into), @@ -1546,18 +1538,20 @@ impl Network { fn receive_requests_impl( &self, - ) -> BoxStream<'static, (Req, RequestId, PeerId)> { + ) -> BoxStream<'static, (Req, InboundRequestId, PeerId)> { enum ReceiveStream { - WaitingForRegister(BoxFuture<'static, mpsc::Receiver<(Bytes, RequestId, PeerId)>>), - Registered(mpsc::Receiver<(Bytes, RequestId, PeerId)>), + WaitingForRegister( + BoxFuture<'static, mpsc::Receiver<(Bytes, InboundRequestId, PeerId)>>, + ), + Registered(mpsc::Receiver<(Bytes, InboundRequestId, PeerId)>), } impl Stream for ReceiveStream { - type Item = (Bytes, RequestId, PeerId); + type Item = (Bytes, InboundRequestId, PeerId); fn poll_next( self: Pin<&mut Self>, cx: &mut Context<'_>, - ) -> Poll> { + ) -> Poll> { let self_ = self.get_mut(); loop { use ReceiveStream::*; @@ -1652,6 +1646,9 @@ impl Network { OutboundFailure::UnsupportedProtocols => { RequestError::OutboundRequest(OutboundRequestError::UnsupportedProtocols) } + OutboundFailure::Io(error) => { + RequestError::OutboundRequest(OutboundRequestError::Other(error.to_string())) + } } } @@ -1676,7 +1673,7 @@ impl Network { fn is_under_the_rate_limits( peer_request_limits: Arc>>>, peer_id: PeerId, - request_id: RequestId, + request_id: InboundRequestId, ) -> bool { // Gets lock of peer requests limits read and write on it. let mut peer_request_limits = peer_request_limits.lock(); @@ -1788,7 +1785,7 @@ impl Network { async fn respond_with_error( action_tx: mpsc::Sender, - request_id: RequestId, + request_id: InboundRequestId, response: InboundRequestError, ) -> Result<(), NetworkError> { let (output_tx, output_rx) = oneshot::channel(); @@ -1891,7 +1888,7 @@ impl NetworkInterface for Network { type AddressType = Multiaddr; type Error = NetworkError; type PubsubId = GossipsubId; - type RequestId = RequestId; + type RequestId = InboundRequestId; fn get_peers(&self) -> Vec { self.connected_peers.read().keys().copied().collect() @@ -2133,13 +2130,15 @@ impl NetworkInterface for Network { .boxed() } - fn receive_requests(&self) -> BoxStream<'static, (Req, RequestId, PeerId)> { + fn receive_requests( + &self, + ) -> BoxStream<'static, (Req, InboundRequestId, PeerId)> { self.receive_requests_impl() } async fn respond( &self, - request_id: RequestId, + request_id: InboundRequestId, response: Req::Response, ) -> Result<(), Self::Error> { let (output_tx, output_rx) = oneshot::channel(); diff --git a/network-libp2p/tests/discovery.rs b/network-libp2p/tests/discovery.rs index a355005978..35aed1f0d4 100644 --- a/network-libp2p/tests/discovery.rs +++ b/network-libp2p/tests/discovery.rs @@ -8,18 +8,17 @@ use libp2p::{ upgrade::Version, }, identity::Keypair, - noise::{self, NoiseConfig}, + noise, swarm::{ dial_opts::{DialOpts, PeerCondition}, - KeepAlive, Swarm, SwarmEvent, + Swarm, SwarmEvent, }, - yamux::YamuxConfig, - PeerId, Transport, + yamux, PeerId, SwarmBuilder, Transport, }; use nimiq_hash::Blake2bHash; use nimiq_network_interface::peer_info::Services; use nimiq_network_libp2p::discovery::{ - behaviour::{DiscoveryBehaviour, DiscoveryConfig, DiscoveryEvent}, + self, peer_contacts::{PeerContact, PeerContactBook, SignedPeerContact}, }; use nimiq_test_log::test; @@ -29,7 +28,7 @@ use rand::{thread_rng, Rng}; struct TestNode { peer_id: PeerId, - swarm: Swarm, + swarm: Swarm, peer_contact_book: Arc>, address: Multiaddr, } @@ -44,18 +43,14 @@ impl TestNode { log::info!(%peer_id, %address); - let noise_keys = noise::Keypair::::new() - .into_authentic(&keypair) - .unwrap(); - let transport = base_transport .upgrade(Version::V1) // `Version::V1Lazy` Allows for 0-RTT negotiation - .authenticate(NoiseConfig::xx(noise_keys).into_authenticated()) - .multiplex(YamuxConfig::default()) + .authenticate(noise::Config::new(&keypair).unwrap()) + .multiplex(yamux::Config::default()) .timeout(Duration::from_secs(20)) .boxed(); - let config = DiscoveryConfig { + let config = discovery::Config { genesis_hash: Blake2bHash::default(), update_interval: Duration::from_secs(10), min_send_update_interval: Duration::from_secs(5), @@ -63,7 +58,7 @@ impl TestNode { required_services: Services::FULL_BLOCKS, min_recv_update_interval: Duration::from_secs(1), house_keeping_interval: Duration::from_secs(1), - keep_alive: KeepAlive::Yes, + keep_alive: true, }; let peer_contact = PeerContact { @@ -77,10 +72,20 @@ impl TestNode { let peer_contact_book = Arc::new(RwLock::new(PeerContactBook::new(peer_contact))); let clock = Arc::new(OffsetTime::new()); - let behaviour = - DiscoveryBehaviour::new(config, keypair, Arc::clone(&peer_contact_book), clock); + let behaviour = discovery::Behaviour::new( + config, + keypair.clone(), + Arc::clone(&peer_contact_book), + clock, + ); - let mut swarm = Swarm::with_threadpool_executor(transport, behaviour, peer_id); + let mut swarm = SwarmBuilder::with_existing_identity(keypair) + .with_tokio() + .with_other_transport(|_| transport) + .unwrap() + .with_behaviour(|_| behaviour) + .unwrap() + .build(); Swarm::listen_on(&mut swarm, address.clone()).unwrap(); @@ -181,7 +186,7 @@ pub async fn test_exchanging_peers() { .take_while(move |e| { log::info!(event = ?e, "Swarm event"); - if let SwarmEvent::Behaviour(DiscoveryEvent::Update) = e { + if let SwarmEvent::Behaviour(discovery::Event::Update) = e { t += 1; } @@ -223,7 +228,7 @@ pub async fn test_dialing_peer_from_contacts() { node2.swarm.for_each(|_| async {}).await; }); - if let Some(SwarmEvent::Behaviour(DiscoveryEvent::Established { + if let Some(SwarmEvent::Behaviour(discovery::Event::Established { peer_id, peer_address: _, peer_contact: _, diff --git a/network-libp2p/tests/helper.rs b/network-libp2p/tests/helper/mod.rs similarity index 98% rename from network-libp2p/tests/helper.rs rename to network-libp2p/tests/helper/mod.rs index 92e9027020..7f53c106bf 100644 --- a/network-libp2p/tests/helper.rs +++ b/network-libp2p/tests/helper/mod.rs @@ -10,6 +10,7 @@ pub fn assert_peer_joined(event: &NetworkEvent, wanted_peer_id: &PeerId) } } +#[allow(unused)] pub fn assert_peer_left(event: &NetworkEvent, wanted_peer_id: &PeerId) { if let NetworkEvent::PeerLeft(peer_id) = event { assert_eq!(peer_id, wanted_peer_id); diff --git a/network-libp2p/tests/network.rs b/network-libp2p/tests/network.rs index 4a31ed896b..421f3bec4c 100644 --- a/network-libp2p/tests/network.rs +++ b/network-libp2p/tests/network.rs @@ -2,17 +2,16 @@ use std::{sync::Arc, time::Duration}; use futures::{Stream, StreamExt}; use libp2p::{ - gossipsub::GossipsubConfigBuilder, + gossipsub, identity::Keypair, multiaddr::{multiaddr, Multiaddr}, - swarm::KeepAlive, }; use nimiq_network_interface::{ network::{CloseReason, MsgAcceptance, Network as NetworkInterface, NetworkEvent, Topic}, peer_info::Services, }; use nimiq_network_libp2p::{ - discovery::{behaviour::DiscoveryConfig, peer_contacts::PeerContact}, + discovery::{self, peer_contacts::PeerContact}, Config, Network, }; use nimiq_test_log::test; @@ -22,7 +21,6 @@ use serde::{Deserialize, Serialize}; use tokio::time::timeout; mod helper; -use self::helper::*; fn network_config(address: Multiaddr) -> Config { let keypair = Keypair::generate_ed25519(); @@ -35,7 +33,7 @@ fn network_config(address: Multiaddr) -> Config { }; peer_contact.set_current_time(); - let gossipsub = GossipsubConfigBuilder::default() + let gossipsub = gossipsub::ConfigBuilder::default() .validation_mode(libp2p::gossipsub::ValidationMode::Permissive) .build() .expect("Invalid Gossipsub config"); @@ -44,7 +42,7 @@ fn network_config(address: Multiaddr) -> Config { keypair, peer_contact, seeds: Vec::new(), - discovery: DiscoveryConfig { + discovery: discovery::Config { genesis_hash: Default::default(), update_interval: Duration::from_secs(60), min_recv_update_interval: Duration::from_secs(30), @@ -52,7 +50,7 @@ fn network_config(address: Multiaddr) -> Config { required_services: Services::all(), min_send_update_interval: Duration::from_secs(30), house_keeping_interval: Duration::from_secs(60), - keep_alive: KeepAlive::No, + keep_alive: false, }, kademlia: Default::default(), gossipsub, @@ -147,13 +145,13 @@ async fn create_connected_networks() -> (Network, Network) { log::debug!("Waiting for join events"); - let event1 = get_next_peer_event(&mut events1).await; + let event1 = helper::get_next_peer_event(&mut events1).await; log::trace!(event = ?event1, "Event 1"); - assert_peer_joined(&event1, &net2.get_local_peer_id()); + helper::assert_peer_joined(&event1, &net2.get_local_peer_id()); - let event2 = get_next_peer_event(&mut events2).await; + let event2 = helper::get_next_peer_event(&mut events2).await; log::trace!(event = ?event2, "Event 2"); - assert_peer_joined(&event2, &net1.get_local_peer_id()); + helper::assert_peer_joined(&event2, &net1.get_local_peer_id()); (net1, net2) } @@ -195,13 +193,13 @@ async fn create_double_connected_networks() -> (Network, Network) { log::debug!("Waiting for join events"); - let event1 = get_next_peer_event(&mut events1).await; + let event1 = helper::get_next_peer_event(&mut events1).await; log::trace!(event = ?event1, "Event 1"); - assert_peer_joined(&event1, &net2.get_local_peer_id()); + helper::assert_peer_joined(&event1, &net2.get_local_peer_id()); - let event2 = get_next_peer_event(&mut events2).await; + let event2 = helper::get_next_peer_event(&mut events2).await; log::trace!(event = ?event2, "Event 2"); - assert_peer_joined(&event2, &net1.get_local_peer_id()); + helper::assert_peer_joined(&event2, &net1.get_local_peer_id()); (net1, net2) } @@ -231,8 +229,13 @@ async fn create_network_with_n_peers(n_peers: usize) -> Vec { network.listen_on(vec![addr.clone()]).await; log::debug!(address = %addr, peer_id = %network.get_local_peer_id(), "Network {}", peer); + let local_peer_id = network.get_local_peer_id(); - events.push(network.subscribe_events()); + events.push( + network + .subscribe_events() + .map(move |event| (local_peer_id, event)), + ); networks.push(network); } @@ -249,10 +252,10 @@ async fn create_network_with_n_peers(n_peers: usize) -> Vec { // Wait for all PeerJoined events let all_joined = futures::stream::select_all(events) .take(n_peers * (n_peers - 1 + 1/*1 x DHT bootstrapped*/)) - .for_each(|event| async move { + .for_each(|(local_peer_id, event)| async move { match event { Ok(NetworkEvent::PeerJoined(peer_id, _)) => { - log::info!(%peer_id, "Received peer joined event"); + log::info!(%local_peer_id, %peer_id, "Received peer joined event"); } Ok(NetworkEvent::DhtBootstrapped) => {} _ => log::error!(?event, "Unexpected NetworkEvent"), @@ -260,7 +263,7 @@ async fn create_network_with_n_peers(n_peers: usize) -> Vec { }); if timeout(Duration::from_secs(120), all_joined).await.is_err() { - log::warn!("Timeout triggered while waiting for peers to join"); + assert!(false, "Timeout triggered while waiting for peers to join"); }; // Verify that each network has all the other peers connected @@ -306,12 +309,12 @@ async fn create_network_with_n_peers(n_peers: usize) -> Vec { .await; // Assert the peer has left both networks - let close_event1 = get_next_peer_event(&mut events1).await; - assert_peer_left(&close_event1, peer_id2); + let close_event1 = helper::get_next_peer_event(&mut events1).await; + helper::assert_peer_left(&close_event1, peer_id2); drop(events1); - let close_event2 = get_next_peer_event(&mut events2).await; - assert_peer_left(&close_event2, peer_id1); + let close_event2 = helper::get_next_peer_event(&mut events2).await; + helper::assert_peer_left(&close_event2, peer_id1); drop(events2); // Now reconnect the peer @@ -324,11 +327,11 @@ async fn create_network_with_n_peers(n_peers: usize) -> Vec { .unwrap(); // Assert the peer rejoined the network - let join_event1 = get_next_peer_event(&mut events1).await; - assert_peer_joined(&join_event1, peer_id2); + let join_event1 = helper::get_next_peer_event(&mut events1).await; + helper::assert_peer_joined(&join_event1, peer_id2); - let join_event2 = get_next_peer_event(&mut events2).await; - assert_peer_joined(&join_event2, peer_id1); + let join_event2 = helper::get_next_peer_event(&mut events2).await; + helper::assert_peer_joined(&join_event2, peer_id1); // Verify all peers are connected again assert_eq!(network1.get_peers().len(), n_peers - 1); @@ -391,12 +394,12 @@ async fn connections_are_properly_closed_events() { .await; log::debug!("Closed peer"); - let event1 = get_next_peer_event(&mut events1).await; - assert_peer_left(&event1, net2.local_peer_id()); + let event1 = helper::get_next_peer_event(&mut events1).await; + helper::assert_peer_left(&event1, net2.local_peer_id()); log::trace!(event = ?event1, "Event 1"); - let event2 = get_next_peer_event(&mut events2).await; - assert_peer_left(&event2, net1.local_peer_id()); + let event2 = helper::get_next_peer_event(&mut events2).await; + helper::assert_peer_left(&event2, net1.local_peer_id()); log::trace!(event = ?event2, "Event 2"); } @@ -415,8 +418,8 @@ async fn connections_are_properly_closed_peers() { .await; log::debug!("Closed peer"); - let event2 = get_next_peer_event(&mut events2).await; - assert_peer_left(&event2, &net1_peer_id); + let event2 = helper::get_next_peer_event(&mut events2).await; + helper::assert_peer_left(&event2, &net1_peer_id); log::trace!(event = ?event2, "Event 2"); assert_eq!(net2.get_peers(), &[]); @@ -459,7 +462,7 @@ async fn ban_peer() { log::debug!("Closed peer"); let event2 = events2.next().await.unwrap().unwrap(); - assert_peer_left(&event2, &net1_peer_id); + helper::assert_peer_left(&event2, &net1_peer_id); log::trace!(event = ?event2, "Event 2"); assert_eq!(net2.get_peers(), &[]); @@ -467,11 +470,7 @@ async fn ban_peer() { // Now try to reconnect peer 1 net1.dial_peer(net2_peer_id).await.unwrap(); - // Check that the connection to peer 1 (from peer 2 perspective) was closed - let event2 = get_next_peer_event(&mut events2).await; - assert_peer_left(&event2, &net1_peer_id); - log::trace!(event = ?event2, "Event 2"); - + // We shouldn't have any peer since the last connection shouldn't have succeeded. assert_eq!(net2.get_peers(), &[]); } diff --git a/network-libp2p/tests/request_response.rs b/network-libp2p/tests/request_response.rs index 92089c916c..cd3fb748c6 100644 --- a/network-libp2p/tests/request_response.rs +++ b/network-libp2p/tests/request_response.rs @@ -3,9 +3,8 @@ use std::sync::Arc; use futures::{future::join_all, StreamExt}; use libp2p::{ core::multiaddr::{multiaddr, Multiaddr}, - gossipsub::GossipsubConfigBuilder, + gossipsub, identity::Keypair, - swarm::KeepAlive, }; #[cfg(feature = "tokio-time")] use nimiq_network_interface::network::CloseReason; @@ -18,7 +17,7 @@ use nimiq_network_interface::{ }, }; use nimiq_network_libp2p::{ - discovery::{behaviour::DiscoveryConfig, peer_contacts::PeerContact}, + discovery::{self, peer_contacts::PeerContact}, Config, Network, }; use nimiq_serde::{Deserialize, DeserializeError, Serialize}; @@ -30,7 +29,6 @@ use tokio::time::Duration; use tokio::time::Instant; mod helper; -use self::helper::*; /// The max number of TestRequests per peer (used for regular tests only). const MAX_REQUEST_RESPONSE_TEST_REQUEST: u32 = 1000; @@ -170,13 +168,13 @@ impl TestNetwork { log::debug!("Waiting for join events"); - let event1 = get_next_peer_event(&mut events1).await; + let event1 = helper::get_next_peer_event(&mut events1).await; log::trace!(event = ?event1, "Event 1"); - assert_peer_joined(&event1, &net2.get_local_peer_id()); + helper::assert_peer_joined(&event1, &net2.get_local_peer_id()); - let event2 = get_next_peer_event(&mut events2).await; + let event2 = helper::get_next_peer_event(&mut events2).await; log::trace!(event = ?event2, "Event 2"); - assert_peer_joined(&event2, &net1.get_local_peer_id()); + helper::assert_peer_joined(&event2, &net1.get_local_peer_id()); (net1, net2) } @@ -256,21 +254,21 @@ impl TestNetwork { log::debug!("Waiting for join events"); - let event1 = get_next_peer_event(&mut events1).await; + let event1 = helper::get_next_peer_event(&mut events1).await; log::trace!(event = ?event1, "Event 1"); - assert_peer_joined(&event1, &net2.get_local_peer_id()); + helper::assert_peer_joined(&event1, &net2.get_local_peer_id()); - let event2 = get_next_peer_event(&mut events2).await; + let event2 = helper::get_next_peer_event(&mut events2).await; log::trace!(event = ?event2, "Event 2"); - assert_peer_joined(&event2, &net1.get_local_peer_id()); + helper::assert_peer_joined(&event2, &net1.get_local_peer_id()); - let event3 = get_next_peer_event(&mut events3).await; + let event3 = helper::get_next_peer_event(&mut events3).await; log::trace!(event = ?event3, "Event 3"); - assert_peer_joined(&event3, &net1.get_local_peer_id()); + helper::assert_peer_joined(&event3, &net1.get_local_peer_id()); - let event4 = get_next_peer_event(&mut events4).await; + let event4 = helper::get_next_peer_event(&mut events4).await; log::trace!(event = ?event4, "Event 4"); - assert_peer_joined(&event4, &net1.get_local_peer_id()); + helper::assert_peer_joined(&event4, &net1.get_local_peer_id()); ((net1, addr1), (net2, addr2), (net3, addr3), (net4, addr4)) } @@ -287,7 +285,7 @@ fn network_config(address: Multiaddr) -> Config { }; peer_contact.set_current_time(); - let gossipsub = GossipsubConfigBuilder::default() + let gossipsub = gossipsub::ConfigBuilder::default() .validation_mode(libp2p::gossipsub::ValidationMode::Permissive) .build() .expect("Invalid Gossipsub config"); @@ -296,7 +294,7 @@ fn network_config(address: Multiaddr) -> Config { keypair, peer_contact, seeds: Vec::new(), - discovery: DiscoveryConfig { + discovery: discovery::Config { genesis_hash: Default::default(), update_interval: Duration::from_secs(60), min_recv_update_interval: Duration::from_secs(30), @@ -304,7 +302,7 @@ fn network_config(address: Multiaddr) -> Config { required_services: Services::all(), min_send_update_interval: Duration::from_secs(30), house_keeping_interval: Duration::from_secs(60), - keep_alive: KeepAlive::Yes, + keep_alive: true, }, kademlia: Default::default(), gossipsub, @@ -517,13 +515,13 @@ async fn disconnect_successfully(net1: &Arc, net2: &Arc) { log::debug!("Waiting for disconnect events"); - let event1 = get_next_peer_event(&mut events1).await; + let event1 = helper::get_next_peer_event(&mut events1).await; log::trace!(event = ?event1, "Event 1"); - assert_peer_left(&event1, &net2.get_local_peer_id()); + helper::assert_peer_left(&event1, &net2.get_local_peer_id()); - let event2 = get_next_peer_event(&mut events2).await; + let event2 = helper::get_next_peer_event(&mut events2).await; log::trace!(event = ?event2, "Event 2"); - assert_peer_left(&event2, &net1.get_local_peer_id()); + helper::assert_peer_left(&event2, &net1.get_local_peer_id()); } #[cfg(feature = "tokio-time")] @@ -538,13 +536,13 @@ async fn reconnect_successfully(net1: &Arc, addr1: Multiaddr, net2: &Ar log::debug!("Waiting for join events"); - let event1 = get_next_peer_event(&mut events1).await; + let event1 = helper::get_next_peer_event(&mut events1).await; log::trace!(event = ?event1, "Event 1"); - assert_peer_joined(&event1, &net2.get_local_peer_id()); + helper::assert_peer_joined(&event1, &net2.get_local_peer_id()); - let event2 = get_next_peer_event(&mut events2).await; + let event2 = helper::get_next_peer_event(&mut events2).await; log::trace!(event = ?event2, "Event 2"); - assert_peer_joined(&event2, &net1.get_local_peer_id()); + helper::assert_peer_joined(&event2, &net1.get_local_peer_id()); } #[cfg(feature = "tokio-time")] diff --git a/test-utils/src/test_network.rs b/test-utils/src/test_network.rs index 65914fdbde..b3758d866a 100644 --- a/test-utils/src/test_network.rs +++ b/test-utils/src/test_network.rs @@ -88,13 +88,13 @@ impl TestNetwork for Network { } async fn connect_networks(networks: &[Arc], seed_peer_id: u64) { - for network in networks { + let seed = multiaddr![Memory(seed_peer_id)]; + // Skip the last network assuming the last one is the seed and doesn't make + // sense for the seed to connect to itself. + for network in &networks[0..networks.len() - 1] { // Tell the network to connect to seed nodes - let seed = multiaddr![Memory(seed_peer_id)]; - log::debug!("Dialing seed: {:?}", seed); - network - .dial_address(seed) + .dial_address(seed.clone()) .await .expect("Failed to dial seed"); } diff --git a/utils/Cargo.toml b/utils/Cargo.toml index a51afb87fa..5743de9fe7 100644 --- a/utils/Cargo.toml +++ b/utils/Cargo.toml @@ -20,7 +20,7 @@ maintenance = { status = "experimental" } clear_on_drop = { version = "0.2", optional = true } futures = { package = "futures-util", version = "0.3" } hex = { version = "0.4", optional = true } -libp2p-core = { git = "https://github.com/jsdanielh/rust-libp2p.git", optional = true } +libp2p-identity = { version = "0.2", optional = true } log = { package = "tracing", version = "0.1", optional = true, features = ["log"] } parking_lot = "0.12" rand = { version = "0.8", optional = true } @@ -43,7 +43,7 @@ nimiq-test-utils = { workspace = true } crc = [] key-rng = ["rand", "rand_core"] key-store = ["log", "thiserror"] -libp2p = ["libp2p-core"] +libp2p = ["libp2p-identity"] math = [] merkle = [ "math", diff --git a/utils/src/tagged_signing.rs b/utils/src/tagged_signing.rs index 57cc7f80be..324d06b954 100644 --- a/utils/src/tagged_signing.rs +++ b/utils/src/tagged_signing.rs @@ -237,7 +237,7 @@ mod tests { #[cfg(feature = "libp2p")] mod impl_for_libp2p { - use libp2p_core::identity::{Keypair, PublicKey}; + use libp2p_identity::{Keypair, PublicKey}; use super::{TaggedKeypair, TaggedPublicKey}; diff --git a/validator-network/src/lib.rs b/validator-network/src/lib.rs index 734cd44fdb..62ed1a1597 100644 --- a/validator-network/src/lib.rs +++ b/validator-network/src/lib.rs @@ -76,7 +76,7 @@ pub trait ValidatorNetwork: Send + Sync { close_reason: CloseReason, ); - /// Signals that a Gossipsup'd message with `id` was verified successfully and can be relayed. + /// Signals that a Gossipsub'd message with `id` was verified successfully and can be relayed. fn validate_message(&self, id: Self::PubsubId, acceptance: MsgAcceptance) where TTopic: Topic + Sync; diff --git a/web-client/Cargo.toml b/web-client/Cargo.toml index 9d5e17243d..578be54897 100644 --- a/web-client/Cargo.toml +++ b/web-client/Cargo.toml @@ -54,7 +54,6 @@ version = "0.1" default-features = false features = [ "panic", - "wasm-websocket", "web-logging", ]