From be8a6e9f607cd9130e81c3b04d26e21f6bd2105b Mon Sep 17 00:00:00 2001 From: Darius Clark Date: Sun, 22 Oct 2023 20:44:25 -0400 Subject: [PATCH] chore: Update libp2p to 0.52.4 (#110) --- CHANGELOG.md | 2 + Cargo.lock | 606 ++++++++++-------- Cargo.toml | 10 +- packages/beetle-bitswap-next/CHANGELOG.md | 5 + packages/beetle-bitswap-next/Cargo.toml | 2 +- packages/beetle-bitswap-next/src/handler.rs | 25 +- packages/beetle-bitswap-next/src/lib.rs | 73 ++- packages/libp2p-relay-manager/CHANGELOG.md | 5 + packages/libp2p-relay-manager/Cargo.toml | 2 +- .../examples/relay_client.rs | 99 +-- src/dag.rs | 4 +- src/ipns/dnslink.rs | 2 +- src/lib.rs | 6 +- src/p2p/addressbook.rs | 41 +- src/p2p/behaviour.rs | 5 +- src/p2p/mod.rs | 2 + src/p2p/peerbook.rs | 44 +- src/p2p/transport.rs | 2 +- src/task.rs | 38 +- 19 files changed, 510 insertions(+), 463 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76951aceb..1a6290f8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,9 @@ # 0.6.0 [unreleased] +- chore: Update libp2p to 0.52.4 [PR 110] - refactor: Disable primary protocols by default [PR 109] - refactor: Move repo logic into a single task [PR 108] +[PR 110]: https://github.com/dariusc93/rust-ipfs/pull/110 [PR 109]: https://github.com/dariusc93/rust-ipfs/pull/109 [PR 108]: https://github.com/dariusc93/rust-ipfs/pull/108 diff --git a/Cargo.lock b/Cargo.lock index 572163187..0a9af91d8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -77,13 +77,19 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + [[package]] name = "android-tzdata" version = "0.1.1" @@ -235,7 +241,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c48ccdbf6ca6b121e0f586cbc0e73ae440e56c67c30fa0873b4e110d9c26d2b" dependencies = [ - "event-listener", + "event-listener 2.5.3", "futures-core", ] @@ -246,15 +252,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" dependencies = [ "concurrent-queue", - "event-listener", + "event-listener 2.5.3", "futures-core", ] [[package]] name = "async-executor" -version = "1.5.4" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c1da3ae8dabd9c00f453a329dfe1fb28da3c0a72e2478cdcd93171740c20499" +checksum = "4b0c4a4f319e45986f347ee47fef8bf5e81c9abc3f6f58dc2391439f30df65f0" dependencies = [ "async-lock", "async-task", @@ -305,9 +311,9 @@ dependencies = [ "log", "parking", "polling", - "rustix 0.37.24", + "rustix 0.37.26", "slab", - "socket2 0.4.9", + "socket2 0.4.10", "waker-fn", ] @@ -317,7 +323,7 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" dependencies = [ - "event-listener", + "event-listener 2.5.3", ] [[package]] @@ -333,19 +339,36 @@ dependencies = [ [[package]] name = "async-process" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a9d28b1d97e08915212e2e45310d47854eafa69600756fc735fb788f75199c9" +checksum = "ea6438ba0a08d81529c69b36700fa2f95837bfe3e776ab39cde9c14d9149da88" dependencies = [ "async-io", "async-lock", - "autocfg", + "async-signal", "blocking", "cfg-if", - "event-listener", + "event-listener 3.0.0", "futures-lite", - "rustix 0.37.24", - "signal-hook", + "rustix 0.38.20", + "windows-sys", +] + +[[package]] +name = "async-signal" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2a5415b7abcdc9cd7d63d6badba5288b2ca017e3fbd4173b8f405449f1a2399" +dependencies = [ + "async-io", + "async-lock", + "atomic-waker", + "cfg-if", + "futures-core", + "futures-io", + "rustix 0.38.20", + "signal-hook-registry", + "slab", "windows-sys", ] @@ -379,16 +402,16 @@ dependencies = [ [[package]] name = "async-std-resolver" -version = "0.22.0" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ba50e24d9ee0a8950d3d03fc6d0dd10aa14b5de3b101949b4e160f7fee7c723" +checksum = "63547755965f54b682ed0fcb3fa467905fe071ef8feff2d59f24c7afc59661bc" dependencies = [ "async-std", "async-trait", "futures-io", "futures-util", "pin-utils", - "socket2 0.4.9", + "socket2 0.5.5", "trust-dns-resolver", ] @@ -411,24 +434,24 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] name = "async-task" -version = "4.4.1" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9441c6b2fe128a7c2bf680a44c34d0df31ce09e5b7e401fcca3faa483dbc921" +checksum = "b4eb2cdb97421e01129ccb49169d8279ed21e829929144f4a22a6e54ac549ca1" [[package]] name = "async-trait" -version = "0.1.73" +version = "0.1.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" +checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -525,7 +548,7 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "beetle-bitswap-next" -version = "0.4.0" +version = "0.5.0" dependencies = [ "ahash 0.8.3", "anyhow", @@ -575,9 +598,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" [[package]] name = "blake2" @@ -643,9 +666,9 @@ dependencies = [ [[package]] name = "blocking" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94c4ef1f913d78636d78d538eec1f18de81e481f44b1be0a81060090530846e1" +checksum = "8c36a4d0d48574b3dd360b4b7d95cc651d2b6557b6402848a27d4b228a473e2a" dependencies = [ "async-channel", "async-lock", @@ -680,9 +703,9 @@ checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" @@ -865,7 +888,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -943,9 +966,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +checksum = "3fbc60abd742b35f2492f808e1abbb83d45f72db402e14c55057edc9c7b1e9e4" dependencies = [ "libc", ] @@ -1122,19 +1145,6 @@ dependencies = [ "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", -] - [[package]] name = "curve25519-dalek" version = "4.1.1" @@ -1160,7 +1170,7 @@ checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -1226,9 +1236,12 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" +checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +dependencies = [ + "powerfmt", +] [[package]] name = "derivative" @@ -1283,7 +1296,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -1308,9 +1321,9 @@ dependencies = [ [[package]] name = "ed25519" -version = "2.2.2" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60f6d271ca33075c88028be6f04d502853d63a5ece419d269c15315d4fc1cf1d" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" dependencies = [ "pkcs8", "signature", @@ -1322,7 +1335,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7277392b266383ef8396db7fdeb1e77b6c52fed775f5df15bb24f35b72156980" dependencies = [ - "curve25519-dalek 4.1.1", + "curve25519-dalek", "ed25519", "rand_core 0.6.4", "serde", @@ -1368,6 +1381,18 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "enum-as-inner" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ffccbb6966c05b32ef8fbac435df276c4ae4d3dc55a8cd0eb9745e6c12f546a" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.38", +] + [[package]] name = "env_logger" version = "0.10.0" @@ -1383,30 +1408,30 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "add4f07d43996f76ef320709726a556a9d4f965d9410d8d0271132d2f8293480" +checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" dependencies = [ - "errno-dragonfly", "libc", "windows-sys", ] [[package]] -name = "errno-dragonfly" -version = "0.1.2" +name = "event-listener" +version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "event-listener" -version = "2.5.3" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" +checksum = "29e56284f00d94c1bc7fd3c77027b4623c88c1f53d8d2394c6199f2921dea325" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite 0.2.13", +] [[package]] name = "fastrand" @@ -1453,9 +1478,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.27" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" dependencies = [ "crc32fast", "miniz_oxide", @@ -1501,6 +1526,16 @@ dependencies = [ "futures-util", ] +[[package]] +name = "futures-bounded" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b07bbbe7d7e78809544c6f718d875627addc73a7c3582447abc052cd3dc67e0" +dependencies = [ + "futures-timer", + "futures-util", +] + [[package]] name = "futures-channel" version = "0.3.28" @@ -1558,7 +1593,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -1747,11 +1782,12 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.13.2" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" dependencies = [ "ahash 0.8.3", + "allocator-api2", ] [[package]] @@ -1900,7 +1936,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite 0.2.13", - "socket2 0.4.9", + "socket2 0.4.10", "tokio", "tower-service", "tracing", @@ -1909,16 +1945,16 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.57" +version = "0.1.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" +checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows 0.48.0", + "windows-core", ] [[package]] @@ -1963,9 +1999,9 @@ dependencies = [ [[package]] name = "if-watch" -version = "3.0.1" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9465340214b296cd17a0009acdb890d6160010b8adf8f78a00d0d7ab270f79f" +checksum = "bbb892e5777fe09e16f3d44de7802f4daa7267ecbe8c466f19d94e25bb0c303e" dependencies = [ "async-io", "core-foundation", @@ -1978,7 +2014,7 @@ dependencies = [ "smol", "system-configuration", "tokio", - "windows 0.34.0", + "windows", ] [[package]] @@ -2048,7 +2084,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" dependencies = [ - "socket2 0.5.4", + "socket2 0.5.5", "widestring", "windows-sys", "winreg", @@ -2056,9 +2092,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is-terminal" @@ -2067,7 +2103,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi 0.3.3", - "rustix 0.38.17", + "rustix 0.38.20", "windows-sys", ] @@ -2130,9 +2166,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.148" +version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" [[package]] name = "libipld" @@ -2226,11 +2262,12 @@ dependencies = [ [[package]] name = "libp2p" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32d07d1502a027366d55afe187621c2d7895dc111a3df13b35fed698049681d7" +checksum = "e94495eb319a85b70a68b85e2389a95bb3555c71c49025b78c691a854a7e6464" dependencies = [ "bytes", + "either", "futures", "futures-timer", "getrandom 0.2.10", @@ -2262,12 +2299,16 @@ dependencies = [ "libp2p-tcp", "libp2p-tls", "libp2p-uds", + "libp2p-upnp", "libp2p-wasm-ext", "libp2p-websocket", + "libp2p-websocket-websys", "libp2p-webtransport-websys", "libp2p-yamux", "multiaddr", "pin-project", + "rw-stream-sink", + "thiserror", ] [[package]] @@ -2365,9 +2406,9 @@ dependencies = [ [[package]] name = "libp2p-deflate" -version = "0.40.0" +version = "0.40.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc29d4b2f967505282d5a37a7bbdb98cef00662368fefc390bbd99063bd24b26" +checksum = "e5b988bd1ab7024180a51f9baf6755efb7c0e878bd0474bbe2e858b936a89d93" dependencies = [ "flate2", "futures", @@ -2376,11 +2417,12 @@ dependencies = [ [[package]] name = "libp2p-dns" -version = "0.40.0" +version = "0.40.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd4394c81c0c06d7b4a60f3face7e8e8a9b246840f98d2c80508d0721b032147" +checksum = "e6a18db73084b4da2871438f6239fef35190b05023de7656e877c18a00541a3b" dependencies = [ "async-std-resolver", + "async-trait", "futures", "libp2p-core", "libp2p-identity", @@ -2413,9 +2455,9 @@ dependencies = [ [[package]] name = "libp2p-gossipsub" -version = "0.45.1" +version = "0.45.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d157562dba6017193e5285acf6b1054759e83540bfd79f75b69d6ce774c88da" +checksum = "f1f9624e2a843b655f1c1b8262b8d5de6f309413fca4d66f01bb0662429f84dc" dependencies = [ "asynchronous-codec", "base64 0.21.4", @@ -2446,13 +2488,14 @@ dependencies = [ [[package]] name = "libp2p-identify" -version = "0.43.0" +version = "0.43.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a29675a32dbcc87790db6cf599709e64308f1ae9d5ecea2d259155889982db8" +checksum = "45a96638a0a176bec0a4bcaebc1afa8cf909b114477209d7456ade52c61cd9cd" dependencies = [ "asynchronous-codec", "either", "futures", + "futures-bounded", "futures-timer", "libp2p-core", "libp2p-identity", @@ -2468,9 +2511,9 @@ dependencies = [ [[package]] name = "libp2p-identity" -version = "0.2.4" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f37304f29c82ede408db06aaba60cd2f783a111f46414d3fc4beedac19e0c67b" +checksum = "cdd6317441f361babc74c2989c6484eb0726045399b6648de039e1805ea96972" dependencies = [ "asn1_der", "bs58 0.5.0", @@ -2493,9 +2536,9 @@ dependencies = [ [[package]] name = "libp2p-kad" -version = "0.44.5" +version = "0.44.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41c5c483b1e90e79409711f515c5bea5de9c4d772a245b1ac01a2233fbcb67fe" +checksum = "16ea178dabba6dde6ffc260a8e0452ccdc8f79becf544946692fff9d412fc29d" dependencies = [ "arrayvec", "asynchronous-codec", @@ -2537,9 +2580,9 @@ dependencies = [ "log", "rand 0.8.5", "smallvec", - "socket2 0.5.4", + "socket2 0.5.5", "tokio", - "trust-dns-proto", + "trust-dns-proto 0.22.0", "void", ] @@ -2617,12 +2660,12 @@ dependencies = [ [[package]] name = "libp2p-noise" -version = "0.43.1" +version = "0.43.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71ce70757f2c0d82e9a3ef738fb10ea0723d16cec37f078f719e2c247704c1bb" +checksum = "d2eeec39ad3ad0677551907dd304b2f13f17208ccebe333bef194076cd2e8921" dependencies = [ "bytes", - "curve25519-dalek 4.1.1", + "curve25519-dalek", "futures", "libp2p-core", "libp2p-identity", @@ -2660,9 +2703,9 @@ dependencies = [ [[package]] name = "libp2p-plaintext" -version = "0.40.0" +version = "0.40.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37266c683a757df713f7dcda0cdcb5ad4681355ffa1b37b77c113c176a531195" +checksum = "53cc5390cc2f77b7de2452fb6105892d0bb64e3cafa3bb346abb603f4cc93a09" dependencies = [ "asynchronous-codec", "bytes", @@ -2676,9 +2719,9 @@ dependencies = [ [[package]] name = "libp2p-pnet" -version = "0.23.0" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e829453e5963cce89201a9076afa3e4b7665e79562a272750c6f5d6e95e366e7" +checksum = "de9f7d1e1d63b59c2d2d0e590d9ff2822278a879679e792a6d4549d26648575b" dependencies = [ "futures", "log", @@ -2690,9 +2733,9 @@ dependencies = [ [[package]] name = "libp2p-quic" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cb763e88f9a043546bfebd3575f340e7dd3d6c1b2cf2629600ec8965360c63a" +checksum = "130d451d83f21b81eb7b35b360bc7972aeafb15177784adc56528db082e6b927" dependencies = [ "async-std", "bytes", @@ -2706,22 +2749,24 @@ dependencies = [ "parking_lot 0.12.1", "quinn", "rand 0.8.5", + "ring", "rustls", - "socket2 0.5.4", + "socket2 0.5.5", "thiserror", "tokio", ] [[package]] name = "libp2p-relay" -version = "0.16.1" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb07202cdf103486709fda5d9d10a0297a8ba01c212b1e19b7943c45c1bd7d6" +checksum = "65bab06b10bbfb3936955965a01bd8db105b8675faabd55c88f94703feec318b" dependencies = [ "asynchronous-codec", "bytes", "either", "futures", + "futures-bounded", "futures-timer", "instant", "libp2p-core", @@ -2738,7 +2783,7 @@ dependencies = [ [[package]] name = "libp2p-relay-manager" -version = "0.1.2" +version = "0.2.0" dependencies = [ "anyhow", "async-std", @@ -2755,9 +2800,9 @@ dependencies = [ [[package]] name = "libp2p-rendezvous" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20f92973a954f8b9dfb809a41dc1a8c05bba52c067361763649f6f5ce04dc47c" +checksum = "00aec50ed436e23945cb842e0a7212b1a1504461d50310a5ba8c3bc0b4c17682" dependencies = [ "async-trait", "asynchronous-codec", @@ -2779,9 +2824,9 @@ dependencies = [ [[package]] name = "libp2p-request-response" -version = "0.25.1" +version = "0.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49e2cb9befb57e55f53d9463a6ea9b1b8a09a48174ad7be149c9cbebaa5e8e9b" +checksum = "c772216645a224da196588418bf562e99a87413c6f49d74b4a1e3b4f5c8add3d" dependencies = [ "async-trait", "cbor4ii", @@ -2800,9 +2845,9 @@ dependencies = [ [[package]] name = "libp2p-swarm" -version = "0.43.5" +version = "0.43.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab94183f8fc2325817835b57946deb44340c99362cd4606c0a5717299b2ba369" +checksum = "48ff0e918a45fec0b6f27b30b0547a57c6c214aa8b13be3647b7701bfd8b8797" dependencies = [ "async-std", "either", @@ -2834,14 +2879,14 @@ dependencies = [ "proc-macro-warning", "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] name = "libp2p-tcp" -version = "0.40.0" +version = "0.40.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09bfdfb6f945c5c014b87872a0bdb6e0aef90e92f380ef57cd9013f118f9289d" +checksum = "b558dd40d1bcd1aaaed9de898e9ec6a436019ecc2420dd0016e712fbb61c5508" dependencies = [ "async-io", "futures", @@ -2851,7 +2896,7 @@ dependencies = [ "libp2p-core", "libp2p-identity", "log", - "socket2 0.5.4", + "socket2 0.5.5", "tokio", ] @@ -2885,6 +2930,22 @@ dependencies = [ "log", ] +[[package]] +name = "libp2p-upnp" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82775a47b34f10f787ad3e2a22e2c1541e6ebef4fe9f28f3ac553921554c94c1" +dependencies = [ + "futures", + "futures-timer", + "igd-next", + "libp2p-core", + "libp2p-swarm", + "log", + "tokio", + "void", +] + [[package]] name = "libp2p-wasm-ext" version = "0.40.0" @@ -2919,6 +2980,24 @@ dependencies = [ "webpki-roots", ] +[[package]] +name = "libp2p-websocket-websys" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3adcb60d1d1ceb139a3afcf7466b905e40279b22074890fea4feec4c7b7c314" +dependencies = [ + "bytes", + "futures", + "js-sys", + "libp2p-core", + "log", + "parking_lot 0.12.1", + "send_wrapper 0.6.0", + "thiserror", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "libp2p-webtransport-websys" version = "0.1.0" @@ -3015,15 +3094,15 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "linux-raw-sys" -version = "0.4.8" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3852614a3bd9ca9804678ba6be5e3b8ce76dfc902cae004e3e0c44051b6e88db" +checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" [[package]] name = "lock_api" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", @@ -3040,11 +3119,11 @@ dependencies = [ [[package]] name = "lru" -version = "0.10.1" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "718e8fae447df0c7e1ba7f5189829e63fd536945c8988d61444c19039f16b670" +checksum = "1efa59af2ddfad1854ae27d75009d538d0998b4b2fd47083e743ac1a10e46c60" dependencies = [ - "hashbrown 0.13.2", + "hashbrown 0.14.2", ] [[package]] @@ -3373,9 +3452,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", ] @@ -3408,7 +3487,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -3449,9 +3528,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "os_str_bytes" -version = "6.5.1" +version = "6.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d5d9eb14b174ee9aa2ef96dc2b94637a2d4b6e7cb873c7e171f0c20c6cf3eac" +checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" [[package]] name = "overload" @@ -3473,9 +3552,9 @@ dependencies = [ [[package]] name = "parking" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e52c774a4c39359c1d1c52e43f73dd91a75a614652c825408eec30c95a9b2067" +checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" [[package]] name = "parking_lot" @@ -3495,7 +3574,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.8", + "parking_lot_core 0.9.9", ] [[package]] @@ -3514,13 +3593,13 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.3.5", + "redox_syscall 0.4.1", "smallvec", "windows-targets", ] @@ -3572,7 +3651,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -3687,6 +3766,12 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -3744,14 +3829,14 @@ checksum = "3d1eaa7fa0aa1929ffdf7eeb6eac234dde6268914a14ad44d23521ab6a9b258e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] name = "proc-macro2" -version = "1.0.67" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] @@ -3776,7 +3861,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -3863,7 +3948,7 @@ checksum = "055b4e778e8feb9f93c4e439f71dc2156ef13360b432b799e179a8c4cdf0b1d7" dependencies = [ "bytes", "libc", - "socket2 0.5.4", + "socket2 0.5.5", "tracing", "windows-sys", ] @@ -3998,16 +4083,25 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "regex" -version = "1.9.6" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebee201405406dbf528b8b672104ae6d6d63e6d118cb10e4d51abbc7b58044ff" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.3.9", - "regex-syntax 0.7.5", + "regex-automata 0.4.3", + "regex-syntax 0.8.2", ] [[package]] @@ -4021,13 +4115,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.9" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59b23e92ee4318893fa3fe3e6fb365258efbfe6ac6ab30f090cdcbb7aa37efa9" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.7.5", + "regex-syntax 0.8.2", ] [[package]] @@ -4038,9 +4132,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.7.5" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "resolv-conf" @@ -4104,7 +4198,7 @@ dependencies = [ [[package]] name = "rust-ipfs" -version = "0.5.0" +version = "0.6.0" dependencies = [ "anyhow", "async-broadcast", @@ -4218,9 +4312,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.24" +version = "0.37.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4279d76516df406a8bd37e7dff53fd37d1a093f997a3c34a5c21658c126db06d" +checksum = "84f3f8f960ed3b5a59055428714943298bf3fa2d4a1d53135084e0544829d995" dependencies = [ "bitflags 1.3.2", "errno", @@ -4232,14 +4326,14 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.17" +version = "0.38.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f25469e9ae0f3d0047ca8b93fc56843f38e6774f0914a107ff8b41be8be8e0b7" +checksum = "67ce50cb2e16c2903e30d1cbccfd8387a74b9d4c938b6a4c5ec6cc7556f7a8a0" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "errno", "libc", - "linux-raw-sys 0.4.8", + "linux-raw-sys 0.4.10", "windows-sys", ] @@ -4347,9 +4441,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.19" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad977052201c6de01a8ef2aa3378c4bd23217a056337d1d6da40468d267a4fb0" +checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" [[package]] name = "send_wrapper" @@ -4368,9 +4462,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.188" +version = "1.0.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" dependencies = [ "serde_derive", ] @@ -4395,13 +4489,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.188" +version = "1.0.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -4464,9 +4558,9 @@ dependencies = [ [[package]] name = "sharded-slab" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1b21f559e07218024e7e9f90f96f601825397de0e25420135f7f952453fed0b" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" dependencies = [ "lazy_static", ] @@ -4568,7 +4662,7 @@ dependencies = [ "aes-gcm", "blake2", "chacha20poly1305", - "curve25519-dalek 4.1.1", + "curve25519-dalek", "rand_core 0.6.4", "ring", "rustc_version", @@ -4578,9 +4672,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" dependencies = [ "libc", "winapi", @@ -4588,9 +4682,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", "windows-sys", @@ -4658,9 +4752,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.37" +version = "2.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" dependencies = [ "proc-macro2", "quote", @@ -4734,7 +4828,7 @@ dependencies = [ "cfg-if", "fastrand 2.0.1", "redox_syscall 0.3.5", - "rustix 0.38.17", + "rustix 0.38.20", "windows-sys", ] @@ -4765,22 +4859,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.49" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.49" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -4795,12 +4889,13 @@ dependencies = [ [[package]] name = "time" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "426f806f4089c493dcac0d24c29c01e2c38baf8e30f1b716ee37e83d200b18fe" +checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" dependencies = [ "deranged", "itoa", + "powerfmt", "serde", "time-core", "time-macros", @@ -4848,9 +4943,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.32.0" +version = "1.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" +checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" dependencies = [ "backtrace", "bytes", @@ -4860,7 +4955,7 @@ dependencies = [ "parking_lot 0.12.1", "pin-project-lite 0.2.13", "signal-hook-registry", - "socket2 0.5.4", + "socket2 0.5.5", "tokio-macros", "windows-sys", ] @@ -4882,7 +4977,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] @@ -4931,11 +5026,10 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "log", "pin-project-lite 0.2.13", "tracing-attributes", @@ -4944,20 +5038,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] [[package]] name = "tracing-core" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", "valuable", @@ -5013,7 +5107,7 @@ dependencies = [ "async-trait", "cfg-if", "data-encoding", - "enum-as-inner", + "enum-as-inner 0.5.1", "futures-channel", "futures-io", "futures-util", @@ -5022,7 +5116,32 @@ dependencies = [ "lazy_static", "rand 0.8.5", "smallvec", - "socket2 0.4.9", + "socket2 0.4.10", + "thiserror", + "tinyvec", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "trust-dns-proto" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "559ac980345f7f5020883dd3bcacf176355225e01916f8c2efecad7534f682c6" +dependencies = [ + "async-trait", + "cfg-if", + "data-encoding", + "enum-as-inner 0.6.0", + "futures-channel", + "futures-io", + "futures-util", + "idna 0.4.0", + "ipnet", + "once_cell", + "rand 0.8.5", + "smallvec", "thiserror", "tinyvec", "tokio", @@ -5032,22 +5151,23 @@ dependencies = [ [[package]] name = "trust-dns-resolver" -version = "0.22.0" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aff21aa4dcefb0a1afbfac26deb0adc93888c7d295fb63ab273ef276ba2b7cfe" +checksum = "c723b0e608b24ad04c73b2607e0241b2c98fd79795a95e98b068b6966138a29d" dependencies = [ "cfg-if", "futures-util", "ipconfig", - "lazy_static", "lru-cache", + "once_cell", "parking_lot 0.12.1", + "rand 0.8.5", "resolv-conf", "smallvec", "thiserror", "tokio", "tracing", - "trust-dns-proto", + "trust-dns-proto 0.23.1", ] [[package]] @@ -5164,9 +5284,9 @@ checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "value-bag" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d92ccd67fb88503048c01b59152a04effd0782d035a83a6d256ce6085f08f4a3" +checksum = "4a72e1902dde2bd6441347de2b70b7f5d59bf157c6c62f0c44572607a1d55bbe" [[package]] name = "version_check" @@ -5238,7 +5358,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", "wasm-bindgen-shared", ] @@ -5272,7 +5392,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5353,22 +5473,19 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows" -version = "0.34.0" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45296b64204227616fdbf2614cefa4c236b98ee64dfaaaa435207ed99fe7829f" +checksum = "ca229916c5ee38c2f2bc1e9d8f04df975b4bd93f9955dc69fabb5d91270045c9" 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-core", + "windows-targets", ] [[package]] -name = "windows" -version = "0.48.0" +name = "windows-core" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" dependencies = [ "windows-targets", ] @@ -5389,12 +5506,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ "windows_aarch64_gnullvm", - "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_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.48.5", + "windows_x86_64_msvc", ] [[package]] @@ -5403,48 +5520,24 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" -[[package]] -name = "windows_aarch64_msvc" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17cffbe740121affb56fad0fc0e421804adf0ae00891205213b5cecd30db881d" - [[package]] name = "windows_aarch64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" -[[package]] -name = "windows_i686_gnu" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2564fde759adb79129d9b4f54be42b32c89970c18ebf93124ca8870a498688ed" - [[package]] name = "windows_i686_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" -[[package]] -name = "windows_i686_msvc" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cd9d32ba70453522332c14d38814bceeb747d80b3958676007acadd7e166956" - [[package]] name = "windows_i686_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" -[[package]] -name = "windows_x86_64_gnu" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfce6deae227ee8d356d19effc141a509cc503dfd1f850622ec4b0f84428e1f4" - [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -5457,12 +5550,6 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" -[[package]] -name = "windows_x86_64_msvc" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d19538ccc21819d01deaf88d6a17eae6596a12e9aafdbb97916fb49896d89de9" - [[package]] name = "windows_x86_64_msvc" version = "0.48.5" @@ -5481,12 +5568,13 @@ dependencies = [ [[package]] name = "x25519-dalek" -version = "1.1.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a0c105152107e3b96f6a00a65e86ce82d9b125230e1c4302940eca58ff71f4f" +checksum = "fb66477291e7e8d2b0ff1bcb900bf29489a9692816d79874bea351e7a8b6de96" dependencies = [ - "curve25519-dalek 3.2.0", - "rand_core 0.5.1", + "curve25519-dalek", + "rand_core 0.6.4", + "serde", "zeroize", ] @@ -5563,5 +5651,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 2.0.38", ] diff --git a/Cargo.toml b/Cargo.toml index 485e70a7e..72ba79b4e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ name = "rust-ipfs" readme = "README.md" repository = "https://github.com/dariusc93/rust-ipfs" description = "IPFS node implementation" -version = "0.5.0" +version = "0.6.0" [features] @@ -18,14 +18,14 @@ test_go_interop = [] test_js_interop = [] [workspace.dependencies] -libp2p = "0.52.3" -beetle-bitswap-next = { version = "0.4.0", path = "packages/beetle-bitswap-next" } +libp2p = "0.52.4" +beetle-bitswap-next = { version = "0.5.0", path = "packages/beetle-bitswap-next" } rust-unixfs = { version = "0.4.0", path = "unixfs" } libipld = "0.16" clap = { version = "4.3", features = ["derive"] } rust-ipns = { version = "0.1", path = "packages/rust-ipns" } chrono = { version = "0.4" } -libp2p-relay-manager = { version = "0.1", path = "packages/libp2p-relay-manager" } +libp2p-relay-manager = { version = "0.2", path = "packages/libp2p-relay-manager" } [dependencies] anyhow = "1.0" @@ -36,7 +36,7 @@ beetle-bitswap-next = { workspace = true } byteorder = { default-features = false, version = "1" } bytes = { default-features = false, version = "1" } libipld.workspace = true -trust-dns-resolver = "0.22" +trust-dns-resolver = "0.23" either = { version = "1" } futures = { version = "0.3" } hash_hasher = "2.0.3" diff --git a/packages/beetle-bitswap-next/CHANGELOG.md b/packages/beetle-bitswap-next/CHANGELOG.md index dc6035bd2..2f06ec376 100644 --- a/packages/beetle-bitswap-next/CHANGELOG.md +++ b/packages/beetle-bitswap-next/CHANGELOG.md @@ -1,3 +1,8 @@ +# 0.5.0 [unrelease] +- chore: Update to 0.52.4 and remove KeepAlive::Until [PR 110] + +[PR 110]: https://github.com/dariusc93/rust-ipfs/pull/110 + # 0.4.0 - chore: Update libp2p to 0.52 [PR 76] diff --git a/packages/beetle-bitswap-next/Cargo.toml b/packages/beetle-bitswap-next/Cargo.toml index d00e3afed..4303d9e2b 100644 --- a/packages/beetle-bitswap-next/Cargo.toml +++ b/packages/beetle-bitswap-next/Cargo.toml @@ -2,7 +2,7 @@ name = "beetle-bitswap-next" authors = ["Darius C", "dignifiedquire "] description = "Implementation of the bitswap protocol" -version = "0.4.0" +version = "0.5.0" edition = "2021" license = "Apache-2.0/MIT" rust-version = "1.65" diff --git a/packages/beetle-bitswap-next/src/handler.rs b/packages/beetle-bitswap-next/src/handler.rs index 086d26798..91f702ce5 100644 --- a/packages/beetle-bitswap-next/src/handler.rs +++ b/packages/beetle-bitswap-next/src/handler.rs @@ -2,7 +2,6 @@ use std::{ collections::VecDeque, fmt::Debug, task::{Context, Poll}, - time::{Duration, Instant}, }; use asynchronous_codec::Framed; @@ -31,10 +30,6 @@ use crate::{ protocol::{BitswapCodec, ProtocolConfig, ProtocolId}, }; -/// The initial time (in seconds) we set the keep alive for protocol negotiations to occur. -// TODO: configurable -const INITIAL_KEEP_ALIVE: u64 = 30; - #[derive(thiserror::Error, Debug)] pub enum BitswapHandlerError { /// The message exceeds the maximum transmission size. @@ -110,9 +105,6 @@ pub struct BitswapHandler { protocol: Option, - /// The amount of time we allow idle connections before disconnecting. - idle_timeout: Duration, - /// Collection of errors from attempting an upgrade. upgrade_errors: VecDeque>, @@ -135,7 +127,6 @@ impl Debug for BitswapHandler { .field("events", &self.events) .field("send_queue", &self.send_queue) .field("protocol", &self.protocol) - .field("idle_timeout", &self.idle_timeout) .field("upgrade_errors", &self.upgrade_errors) .field("keep_alive", &self.keep_alive) .finish() @@ -144,16 +135,15 @@ impl Debug for BitswapHandler { impl BitswapHandler { /// Builds a new [`BitswapHandler`]. - pub fn new(protocol_config: ProtocolConfig, idle_timeout: Duration) -> Self { + pub fn new(protocol_config: ProtocolConfig) -> Self { Self { listen_protocol: SubstreamProtocol::new(protocol_config, ()), inbound_substreams: Default::default(), outbound_substreams: Default::default(), send_queue: Default::default(), protocol: None, - idle_timeout, upgrade_errors: VecDeque::new(), - keep_alive: KeepAlive::Until(Instant::now() + Duration::from_secs(INITIAL_KEEP_ALIVE)), + keep_alive: KeepAlive::No, events: Default::default(), } } @@ -176,16 +166,12 @@ impl ConnectionHandler for BitswapHandler { match message { BitswapHandlerIn::Message(m, response) => { self.send_queue.push_back((m, response)); - - // sending a message, reset keepalive - self.keep_alive = KeepAlive::Until(Instant::now() + self.idle_timeout); } BitswapHandlerIn::Protect => { self.keep_alive = KeepAlive::Yes; } BitswapHandlerIn::Unprotect => { - self.keep_alive = - KeepAlive::Until(Instant::now() + Duration::from_secs(INITIAL_KEEP_ALIVE)); + self.keep_alive = KeepAlive::No; } } } @@ -273,11 +259,6 @@ impl ConnectionHandler for BitswapHandler { } if let Poll::Ready(Some(event)) = self.inbound_substreams.poll_next_unpin(cx) { - if let ConnectionHandlerEvent::NotifyBehaviour(HandlerEvent::Message { .. }) = event { - // Update keep alive as we have received a message - self.keep_alive = KeepAlive::Until(Instant::now() + self.idle_timeout); - } - return Poll::Ready(event); } diff --git a/packages/beetle-bitswap-next/src/lib.rs b/packages/beetle-bitswap-next/src/lib.rs index 21cd12f67..09f26fa0f 100644 --- a/packages/beetle-bitswap-next/src/lib.rs +++ b/packages/beetle-bitswap-next/src/lib.rs @@ -64,7 +64,6 @@ type DialMap = AHashMap< pub struct Bitswap { network: Network, protocol_config: ProtocolConfig, - idle_timeout: Duration, peers: Arc>>, dials: Arc>, /// Set to true when dialing should be disabled because we have reached the conn limit. @@ -215,7 +214,6 @@ impl Bitswap { Bitswap { network, protocol_config: config.protocol, - idle_timeout: config.idle_timeout, peers: Default::default(), dials: Default::default(), pause_dialing: false, @@ -404,7 +402,7 @@ impl NetworkBehaviour for Bitswap { _: &Multiaddr, ) -> std::result::Result, ConnectionDenied> { let protocol_config = self.protocol_config.clone(); - Ok(BitswapHandler::new(protocol_config, self.idle_timeout)) + Ok(BitswapHandler::new(protocol_config)) } fn handle_established_outbound_connection( @@ -415,7 +413,7 @@ impl NetworkBehaviour for Bitswap { _: libp2p::core::Endpoint, ) -> std::result::Result, ConnectionDenied> { let protocol_config = self.protocol_config.clone(); - Ok(BitswapHandler::new(protocol_config, self.idle_timeout)) + Ok(BitswapHandler::new(protocol_config)) } #[allow(clippy::collapsible_match)] @@ -635,20 +633,14 @@ pub fn verify_hash(cid: &Cid, bytes: &[u8]) -> Option { #[cfg(test)] mod tests { - use std::io::{Error, ErrorKind}; use std::sync::Arc; - use std::time::Duration; use anyhow::anyhow; use futures::prelude::*; - use libp2p::core::muxing::StreamMuxerBox; - use libp2p::core::transport::upgrade::Version; - use libp2p::core::transport::Boxed; use libp2p::identity::Keypair; - use libp2p::swarm::{SwarmBuilder, SwarmEvent}; - use libp2p::tcp::{tokio::Transport as TcpTransport, Config as TcpConfig}; - use libp2p::yamux::Config as YamuxConfig; - use libp2p::{noise, PeerId, Swarm, Transport}; + use libp2p::swarm::SwarmEvent; + use libp2p::Swarm; + use libp2p::SwarmBuilder; use tokio::sync::{mpsc, RwLock}; use tracing::{info, trace}; use tracing_subscriber::{fmt, prelude::*, EnvFilter}; @@ -680,23 +672,6 @@ mod tests { assert_send::<&Bitswap>(); } - fn mk_transport() -> (PeerId, Boxed<(PeerId, StreamMuxerBox)>) { - let local_key = Keypair::generate_ed25519(); - - let auth_config = noise::Config::new(&local_key).expect("Noise key generation failed"); - - let peer_id = local_key.public().to_peer_id(); - let transport = TcpTransport::new(TcpConfig::default().nodelay(true)) - .upgrade(Version::V1) - .authenticate(auth_config) - .multiplex(YamuxConfig::default()) - .timeout(Duration::from_secs(20)) - .map(|(peer_id, muxer), _| (peer_id, StreamMuxerBox::new(muxer))) - .map_err(|err| Error::new(ErrorKind::Other, err)) - .boxed(); - (peer_id, transport) - } - #[derive(Debug, Clone, Default)] struct TestStore { store: Arc>>, @@ -773,10 +748,23 @@ mod tests { } async fn get_block() { - let (peer1_id, trans) = mk_transport(); + let kp = Keypair::generate_ed25519(); let store1 = TestStore::default(); - let bs1 = Bitswap::new(peer1_id, store1.clone(), Config::default()).await; - let mut swarm1 = SwarmBuilder::with_tokio_executor(trans, bs1, peer1_id).build(); + let bs1 = Bitswap::new(kp.public().to_peer_id(), store1.clone(), Config::default()).await; + + let mut swarm1 = SwarmBuilder::with_existing_identity(kp) + .with_tokio() + .with_tcp( + libp2p::tcp::Config::default(), + libp2p::noise::Config::new, + libp2p::yamux::Config::default, + ) + .unwrap() + .with_behaviour(|_| bs1) + .unwrap() + .with_swarm_config(|c| c.with_idle_connection_timeout(Duration::from_secs(30))) + .build(); + let blocks = (0..N).map(|_| create_random_block_v1()).collect::>(); for block in &blocks { @@ -805,11 +793,22 @@ mod tests { }); info!("peer2: startup"); - let (peer2_id, trans) = mk_transport(); + let kp = Keypair::generate_ed25519(); let store2 = TestStore::default(); - let bs2 = Bitswap::new(peer2_id, store2.clone(), Config::default()).await; - - let mut swarm2 = SwarmBuilder::with_tokio_executor(trans, bs2, peer2_id).build(); + let bs2 = Bitswap::new(kp.public().to_peer_id(), store2.clone(), Config::default()).await; + + let mut swarm2 = SwarmBuilder::with_existing_identity(kp) + .with_tokio() + .with_tcp( + libp2p::tcp::Config::default(), + libp2p::noise::Config::new, + libp2p::yamux::Config::default, + ) + .unwrap() + .with_behaviour(|_| bs2) + .unwrap() + .with_swarm_config(|c| c.with_idle_connection_timeout(Duration::from_secs(30))) + .build(); let swarm2_bs = swarm2.behaviour().clone(); let peer2 = tokio::task::spawn(async move { diff --git a/packages/libp2p-relay-manager/CHANGELOG.md b/packages/libp2p-relay-manager/CHANGELOG.md index 37cf945bf..2fefe5b07 100644 --- a/packages/libp2p-relay-manager/CHANGELOG.md +++ b/packages/libp2p-relay-manager/CHANGELOG.md @@ -1,3 +1,8 @@ +# 0.2.0 [unrelease] +- chore: Update to 0.52.4 [PR 110] + +[PR 110]: https://github.com/dariusc93/rust-ipfs/pull/110 + # 0.1.2 - chore: Emit event when selected peer is not an explicit relay diff --git a/packages/libp2p-relay-manager/Cargo.toml b/packages/libp2p-relay-manager/Cargo.toml index c438657e4..98b6f89e6 100644 --- a/packages/libp2p-relay-manager/Cargo.toml +++ b/packages/libp2p-relay-manager/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libp2p-relay-manager" -version = "0.1.2" +version = "0.2.0" edition = "2021" license = "Apache-2.0 OR MIT" description = "(WIP) Implementation of a relay-manager" diff --git a/packages/libp2p-relay-manager/examples/relay_client.rs b/packages/libp2p-relay-manager/examples/relay_client.rs index a9badc610..e3cdc3eee 100644 --- a/packages/libp2p-relay-manager/examples/relay_client.rs +++ b/packages/libp2p-relay-manager/examples/relay_client.rs @@ -1,27 +1,17 @@ -use std::{io, time::Duration}; +use std::time::Duration; use clap::Parser; -use futures::{future::Either, FutureExt, StreamExt}; +use futures::{FutureExt, StreamExt}; use libp2p::{ - core::{ - muxing::StreamMuxerBox, - transport::{timeout::TransportTimeout, Boxed, OrTransport}, - upgrade::Version, - }, - dns::{DnsConfig, ResolverConfig}, identify::{self, Behaviour as Identify}, identity::{self, Keypair}, multiaddr::Protocol, - noise, ping::{self, Behaviour as Ping}, - relay::client::{Behaviour as RelayClient, Transport as ClientTransport}, - swarm::{NetworkBehaviour, SwarmBuilder, SwarmEvent}, - tcp::{async_io::Transport as AsyncTcpTransport, Config as GenTcpConfig}, - Multiaddr, PeerId, Transport, + relay::client::Behaviour as RelayClient, + swarm::{NetworkBehaviour, SwarmEvent}, + Multiaddr, PeerId, SwarmBuilder, }; -use libp2p::quic::{async_std::Transport as AsyncQuicTransport, Config as QuicConfig}; - #[derive(NetworkBehaviour)] pub struct Behaviour { relay_client: RelayClient, @@ -70,24 +60,28 @@ async fn main() -> anyhow::Result<()> { println!("Local Node: {local_peer_id}"); - let (relay_transport, relay_client) = libp2p::relay::client::new(local_peer_id); - - let transport = build_transport(local_keypair.clone(), relay_transport).await?; - - let behaviour = Behaviour { - ping: Ping::new(Default::default()), - identify: Identify::new({ - let mut config = - identify::Config::new("/test/0.1.0".to_string(), local_keypair.public()); - config.push_listen_addr_updates = true; - config - }), - relay_client, - relay_manager: libp2p_relay_manager::Behaviour::default(), - }; - - let mut swarm = - SwarmBuilder::with_async_std_executor(transport, behaviour, local_peer_id).build(); + let mut swarm = SwarmBuilder::with_existing_identity(local_keypair) + .with_async_std() + .with_tcp( + libp2p::tcp::Config::default(), + libp2p::noise::Config::new, + libp2p::yamux::Config::default, + )? + .with_quic() + .with_dns() + .await? + .with_relay_client(libp2p::noise::Config::new, libp2p::yamux::Config::default)? + .with_behaviour(|kp, relay_client| Behaviour { + ping: Ping::new(Default::default()), + identify: Identify::new({ + let mut config = identify::Config::new("/test/0.1.0".to_string(), kp.public()); + config.push_listen_addr_updates = true; + config + }), + relay_client, + relay_manager: libp2p_relay_manager::Behaviour::default(), + })? + .build(); if opts.listener { let addr = "/ip4/0.0.0.0/tcp/0".parse().unwrap(); @@ -181,45 +175,6 @@ async fn main() -> anyhow::Result<()> { Ok(()) } -pub async fn build_transport( - keypair: Keypair, - relay: ClientTransport, -) -> io::Result> { - let noise_config = noise::Config::new(&keypair).unwrap(); - - let multiplex_upgrade = libp2p::yamux::Config::default(); - - let quic_transport = AsyncQuicTransport::new(QuicConfig::new(&keypair)); - - let transport = AsyncTcpTransport::new(GenTcpConfig::default().nodelay(true).port_reuse(true)); - - let transport_timeout = TransportTimeout::new(transport, Duration::from_secs(30)); - - let transport = DnsConfig::custom( - transport_timeout, - ResolverConfig::cloudflare(), - Default::default(), - ) - .await?; - - let transport = OrTransport::new(relay, transport) - .upgrade(Version::V1) - .authenticate(noise_config) - .multiplex(multiplex_upgrade) - .timeout(Duration::from_secs(30)) - .map(|(peer_id, muxer), _| (peer_id, StreamMuxerBox::new(muxer))) - .map_err(|err| std::io::Error::new(std::io::ErrorKind::Other, err)) - .boxed(); - - let transport = OrTransport::new(quic_transport, transport) - .map(|either_output, _| match either_output { - Either::Left((peer_id, muxer)) => (peer_id, StreamMuxerBox::new(muxer)), - Either::Right((peer_id, muxer)) => (peer_id, StreamMuxerBox::new(muxer)), - }) - .boxed(); - - Ok(transport) -} fn generate_ed25519(secret_key_seed: u8) -> identity::Keypair { let mut bytes = [0u8; 32]; bytes[0] = secret_key_seed; diff --git a/src/dag.rs b/src/dag.rs index de775bc14..8cb965234 100644 --- a/src/dag.rs +++ b/src/dag.rs @@ -285,7 +285,9 @@ impl IpldDag { let mut iter = resolved_path.iter().peekable(); let (node, _) = match self - .resolve0(session, cid, &mut iter, true, providers, local_only, timeout) + .resolve0( + session, cid, &mut iter, true, providers, local_only, timeout, + ) .await { Ok(t) => t, diff --git a/src/ipns/dnslink.rs b/src/ipns/dnslink.rs index c87590040..abebe5799 100644 --- a/src/ipns/dnslink.rs +++ b/src/ipns/dnslink.rs @@ -34,7 +34,7 @@ pub async fn resolve<'a>( // when trust-dns support lands in future libp2p-dns investigate if we could share one, no need // to have multiple related caches. let (config, opt) = resolver.into(); - let resolver = AsyncResolver::tokio(config, opt)?; + let resolver = AsyncResolver::tokio(config, opt); // previous implementation searched $domain and _dnslink.$domain concurrently. not sure did // `domain` assume fqdn names or not, but local suffices were not being searched on windows at diff --git a/src/lib.rs b/src/lib.rs index 40f21552e..043985c56 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -107,7 +107,7 @@ pub use libp2p::{ use libp2p::{ core::{muxing::StreamMuxerBox, transport::Boxed}, - kad::{store::MemoryStoreConfig, KademliaConfig, Mode, Record}, + kad::{store::MemoryStoreConfig, Mode, Record}, ping::Config as PingConfig, rendezvous::Namespace, swarm::dial_opts::DialOpts, @@ -187,7 +187,7 @@ pub struct IpfsOptions { pub pubsub_config: Option, /// Kad configuration - pub kad_configuration: Option>, + pub kad_configuration: Option>, /// Kad Store Config /// Note: Only supports MemoryStoreConfig at this time @@ -586,7 +586,7 @@ impl + Send> UninitializedIpfs { /// Enables kademlia pub fn with_kademlia( mut self, - config: Option>, + config: Option>, store: KadStoreConfig, ) -> Self { self.options.protocols.kad = true; diff --git a/src/p2p/addressbook.rs b/src/p2p/addressbook.rs index 9f51847d4..0af4eccf2 100644 --- a/src/p2p/addressbook.rs +++ b/src/p2p/addressbook.rs @@ -238,14 +238,14 @@ impl NetworkBehaviour for Behaviour { #[cfg(test)] mod test { + use std::time::Duration; + use crate::p2p::peerbook; - use crate::p2p::transport::build_transport; use futures::StreamExt; use libp2p::swarm::behaviour::toggle::Toggle; use libp2p::{ - identity::Keypair, - swarm::{dial_opts::DialOpts, NetworkBehaviour, SwarmBuilder, SwarmEvent}, - Multiaddr, PeerId, Swarm, + swarm::{dial_opts::DialOpts, NetworkBehaviour, SwarmEvent}, + Multiaddr, PeerId, Swarm, SwarmBuilder, }; #[derive(NetworkBehaviour)] @@ -395,24 +395,29 @@ mod test { peerbook: bool, store_on_connection: bool, ) -> (PeerId, Multiaddr, Swarm) { - let key = Keypair::generate_ed25519(); - let pubkey = key.public(); - let peer_id = pubkey.to_peer_id(); - let transport = build_transport(key, None, Default::default()).unwrap(); - - let behaviour = Behaviour { - peer_book: peerbook.then_some(peerbook::Behaviour::default()).into(), - address_book: super::Behaviour::with_config(super::Config { - store_on_connection, - }), - }; - - let mut swarm = SwarmBuilder::with_tokio_executor(transport, behaviour, peer_id).build(); + let mut swarm = SwarmBuilder::with_new_identity() + .with_tokio() + .with_tcp( + libp2p::tcp::Config::default(), + libp2p::noise::Config::new, + libp2p::yamux::Config::default, + ) + .expect("") + .with_behaviour(|_| Behaviour { + peer_book: peerbook.then_some(peerbook::Behaviour::default()).into(), + address_book: super::Behaviour::with_config(super::Config { + store_on_connection, + }), + }) + .expect("") + .with_swarm_config(|c| c.with_idle_connection_timeout(Duration::from_secs(30))) + .build(); Swarm::listen_on(&mut swarm, "/ip4/127.0.0.1/tcp/0".parse().unwrap()).unwrap(); if let Some(SwarmEvent::NewListenAddr { address, .. }) = swarm.next().await { - return (peer_id, address, swarm); + let peer_id = swarm.local_peer_id(); + return (*peer_id, address, swarm); } panic!("no new addrs") diff --git a/src/p2p/behaviour.rs b/src/p2p/behaviour.rs index e7c093ab6..0c38244c4 100644 --- a/src/p2p/behaviour.rs +++ b/src/p2p/behaviour.rs @@ -23,7 +23,10 @@ use libp2p::kad::record::{ store::{MemoryStore, MemoryStoreConfig}, Record, }; -use libp2p::kad::{Kademlia, KademliaBucketInserts, KademliaConfig, KademliaStoreInserts}; +use libp2p::kad::{ + Behaviour as Kademlia, BucketInserts as KademliaBucketInserts, Config as KademliaConfig, + StoreInserts as KademliaStoreInserts, +}; use libp2p::mdns::{tokio::Behaviour as Mdns, Config as MdnsConfig}; use libp2p::ping::Behaviour as Ping; use libp2p::relay::client::Behaviour as RelayClient; diff --git a/src/p2p/mod.rs b/src/p2p/mod.rs index df4112815..ffa5137db 100644 --- a/src/p2p/mod.rs +++ b/src/p2p/mod.rs @@ -177,6 +177,8 @@ impl Default for SwarmConfig { } #[allow(clippy::type_complexity)] +#[allow(deprecated)] +//TODO: use libp2p::SwarmBuilder /// Creates a new IPFS swarm. pub async fn create_swarm( keypair: &Keypair, diff --git a/src/p2p/peerbook.rs b/src/p2p/peerbook.rs index e66826b32..28349a54b 100644 --- a/src/p2p/peerbook.rs +++ b/src/p2p/peerbook.rs @@ -581,13 +581,12 @@ mod test { use std::time::Duration; use super::Behaviour as PeerBook; - use crate::p2p::{peerbook::ConnectionLimits, transport::build_transport}; + use crate::p2p::peerbook::ConnectionLimits; use futures::StreamExt; use libp2p::{ identify::{self, Config}, - identity::Keypair, - swarm::{behaviour::toggle::Toggle, NetworkBehaviour, SwarmBuilder, SwarmEvent}, - Multiaddr, PeerId, Swarm, + swarm::{behaviour::toggle::Toggle, NetworkBehaviour, SwarmEvent}, + Multiaddr, PeerId, Swarm, SwarmBuilder, }; #[derive(NetworkBehaviour)] @@ -806,28 +805,31 @@ mod test { assert!(list.contains(&peer2)); } - async fn build_swarm(identify: bool) -> (PeerId, Multiaddr, libp2p::swarm::Swarm) { - let key = Keypair::generate_ed25519(); - let pubkey = key.public(); - let peer_id = pubkey.to_peer_id(); - let transport = build_transport(key, None, Default::default()).unwrap(); - - let behaviour = Behaviour { - peerbook: PeerBook::default(), - identify: Toggle::from(identify.then_some(identify::Behaviour::new(Config::new( - "/peerbook/0.1".into(), - pubkey, - )))), - }; - - let mut swarm = SwarmBuilder::with_tokio_executor(transport, behaviour, peer_id) - .idle_connection_timeout(Duration::from_secs(30)) + async fn build_swarm(identify: bool) -> (PeerId, Multiaddr, Swarm) { + let mut swarm = SwarmBuilder::with_new_identity() + .with_tokio() + .with_tcp( + libp2p::tcp::Config::default(), + libp2p::noise::Config::new, + libp2p::yamux::Config::default, + ) + .expect("") + .with_behaviour(|kp| Behaviour { + peerbook: PeerBook::default(), + identify: Toggle::from(identify.then_some(identify::Behaviour::new(Config::new( + "/peerbook/0.1".into(), + kp.public(), + )))), + }) + .expect("") + .with_swarm_config(|c| c.with_idle_connection_timeout(Duration::from_secs(30))) .build(); Swarm::listen_on(&mut swarm, "/ip4/127.0.0.1/tcp/0".parse().unwrap()).unwrap(); if let Some(SwarmEvent::NewListenAddr { address, .. }) = swarm.next().await { - return (peer_id, address, swarm); + let peer_id = swarm.local_peer_id(); + return (*peer_id, address, swarm); } panic!("no new addrs") diff --git a/src/p2p/transport.rs b/src/p2p/transport.rs index a8ab64e60..6a5188156 100644 --- a/src/p2p/transport.rs +++ b/src/p2p/transport.rs @@ -5,7 +5,7 @@ use libp2p::core::transport::timeout::TransportTimeout; use libp2p::core::transport::upgrade::Version; use libp2p::core::transport::{Boxed, MemoryTransport, OrTransport}; use libp2p::core::upgrade::SelectUpgrade; -use libp2p::dns::{ResolverConfig, ResolverOpts, TokioDnsConfig}; +use libp2p::dns::{tokio::Transport as TokioDnsConfig, ResolverConfig, ResolverOpts}; use libp2p::quic::tokio::Transport as TokioQuicTransport; use libp2p::quic::Config as QuicConfig; use libp2p::relay::client::Transport as ClientTransport; diff --git a/src/task.rs b/src/task.rs index fcd509ec8..d5def20f2 100644 --- a/src/task.rs +++ b/src/task.rs @@ -61,9 +61,9 @@ use libp2p::{ autonat, identify::{Event as IdentifyEvent, Info as IdentifyInfo}, kad::{ - AddProviderError, AddProviderOk, BootstrapError, BootstrapOk, GetClosestPeersError, - GetClosestPeersOk, GetProvidersError, GetProvidersOk, GetRecordError, GetRecordOk, - KademliaEvent::*, PutRecordError, PutRecordOk, QueryId, QueryResult::*, Record, + AddProviderError, AddProviderOk, BootstrapError, BootstrapOk, Event as KademliaEvent, + GetClosestPeersError, GetClosestPeersOk, GetProvidersError, GetProvidersOk, GetRecordError, + GetRecordOk, PutRecordError, PutRecordOk, QueryId, QueryResult::*, Record, }, mdns::Event as MdnsEvent, rendezvous::{Cookie, Namespace}, @@ -415,10 +415,10 @@ impl> IpfsTask { }, SwarmEvent::Behaviour(BehaviourEvent::Kademlia(event)) => { match event { - InboundRequest { request } => { + KademliaEvent::InboundRequest { request } => { trace!("kad: inbound {:?} request handled", request); } - OutboundQueryProgressed { + KademliaEvent::OutboundQueryProgressed { result, id, step, .. } => { // make sure the query is exhausted @@ -757,7 +757,7 @@ impl> IpfsTask { } } } - RoutingUpdated { + KademliaEvent::RoutingUpdated { peer, is_new_peer: _, addresses, @@ -766,13 +766,13 @@ impl> IpfsTask { } => { trace!("kad: routing updated; {}: {:?}", peer, addresses); } - UnroutablePeer { peer } => { + KademliaEvent::UnroutablePeer { peer } => { trace!("kad: peer {} is unroutable", peer); } - RoutablePeer { peer, address } => { + KademliaEvent::RoutablePeer { peer, address } => { trace!("kad: peer {} ({}) is routable", peer, address); } - PendingRoutablePeer { peer, address } => { + KademliaEvent::PendingRoutablePeer { peer, address } => { trace!("kad: pending routable peer {} ({})", peer, address); } } @@ -1272,20 +1272,18 @@ impl> IpfsTask { let client = bitswap.client().clone(); let server = bitswap.server().cloned(); - let _ = ret.send(Ok( - async move { - if let Some(peer) = peer { - if let Some(server) = server { - server.wantlist_for_peer(&peer).await - } else { - Vec::new() - } + let _ = ret.send(Ok(async move { + if let Some(peer) = peer { + if let Some(server) = server { + server.wantlist_for_peer(&peer).await } else { - Vec::from_iter(client.get_wantlist().await) + Vec::new() } + } else { + Vec::from_iter(client.get_wantlist().await) } - .boxed()), - ); + } + .boxed())); } else { let _ = ret.send(Ok(futures::future::ready(vec![]).boxed())); }