diff --git a/.github/workflows/cache-factory.yml b/.github/workflows/cache-factory.yml index 8d25eb9a..860f0a0d 100644 --- a/.github/workflows/cache-factory.yml +++ b/.github/workflows/cache-factory.yml @@ -22,7 +22,7 @@ jobs: - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@b8a6852b4f997182bdea832df3f9e153038b5191 # v2.6.0 + - uses: Swatinem/rust-cache@578b235f6e5f613f7727f1c17bd3305b4d4d4e1f # v2.6.1 with: shared-key: stable-cache diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 710af087..470016d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,7 @@ jobs: - uses: dtolnay/rust-toolchain@stable - - uses: Swatinem/rust-cache@b8a6852b4f997182bdea832df3f9e153038b5191 # v2.6.0 + - uses: Swatinem/rust-cache@578b235f6e5f613f7727f1c17bd3305b4d4d4e1f # v2.6.1 with: shared-key: stable-cache save-if: false @@ -136,7 +136,7 @@ jobs: - uses: r7kamura/rust-problem-matchers@2c2f1016021a7455a6b5b4bbae31145f3b3cd83a #v1.4.0 - - uses: Swatinem/rust-cache@b8a6852b4f997182bdea832df3f9e153038b5191 # v2.6.0 + - uses: Swatinem/rust-cache@578b235f6e5f613f7727f1c17bd3305b4d4d4e1f # v2.6.1 with: key: ${{ matrix.target }} save-if: ${{ github.ref == 'refs/heads/master' }} @@ -161,7 +161,7 @@ jobs: - uses: r7kamura/rust-problem-matchers@2c2f1016021a7455a6b5b4bbae31145f3b3cd83a #v1.4.0 - - uses: Swatinem/rust-cache@b8a6852b4f997182bdea832df3f9e153038b5191 # v2.6.0 + - uses: Swatinem/rust-cache@578b235f6e5f613f7727f1c17bd3305b4d4d4e1f # v2.6.1 with: save-if: ${{ github.ref == 'refs/heads/master' }} @@ -182,7 +182,7 @@ jobs: - uses: r7kamura/rust-problem-matchers@2c2f1016021a7455a6b5b4bbae31145f3b3cd83a #v1.4.0 - - uses: Swatinem/rust-cache@b8a6852b4f997182bdea832df3f9e153038b5191 # v2.6.0 + - uses: Swatinem/rust-cache@578b235f6e5f613f7727f1c17bd3305b4d4d4e1f # v2.6.1 with: key: ${{ matrix.features }} save-if: ${{ github.ref == 'refs/heads/master' }} @@ -199,7 +199,7 @@ jobs: - uses: r7kamura/rust-problem-matchers@2c2f1016021a7455a6b5b4bbae31145f3b3cd83a #v1.4.0 - - uses: Swatinem/rust-cache@b8a6852b4f997182bdea832df3f9e153038b5191 # v2.6.0 + - uses: Swatinem/rust-cache@578b235f6e5f613f7727f1c17bd3305b4d4d4e1f # v2.6.1 with: save-if: ${{ github.ref == 'refs/heads/master' }} @@ -225,7 +225,7 @@ jobs: - uses: r7kamura/rust-problem-matchers@2c2f1016021a7455a6b5b4bbae31145f3b3cd83a #v1.4.0 - - uses: Swatinem/rust-cache@b8a6852b4f997182bdea832df3f9e153038b5191 # v2.6.0 + - uses: Swatinem/rust-cache@578b235f6e5f613f7727f1c17bd3305b4d4d4e1f # v2.6.1 with: save-if: ${{ github.ref == 'refs/heads/master' }} @@ -242,7 +242,7 @@ jobs: - uses: r7kamura/rust-problem-matchers@2c2f1016021a7455a6b5b4bbae31145f3b3cd83a #v1.4.0 - - uses: Swatinem/rust-cache@b8a6852b4f997182bdea832df3f9e153038b5191 # v2.6.0 + - uses: Swatinem/rust-cache@578b235f6e5f613f7727f1c17bd3305b4d4d4e1f # v2.6.1 with: save-if: ${{ github.ref == 'refs/heads/master' }} @@ -258,7 +258,7 @@ jobs: - uses: r7kamura/rust-problem-matchers@2c2f1016021a7455a6b5b4bbae31145f3b3cd83a #v1.4.0 - - uses: Swatinem/rust-cache@b8a6852b4f997182bdea832df3f9e153038b5191 # v2.6.0 + - uses: Swatinem/rust-cache@578b235f6e5f613f7727f1c17bd3305b4d4d4e1f # v2.6.1 with: shared-key: stable-cache save-if: false @@ -326,7 +326,7 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: Swatinem/rust-cache@b8a6852b4f997182bdea832df3f9e153038b5191 # v2.6.0 + - uses: Swatinem/rust-cache@578b235f6e5f613f7727f1c17bd3305b4d4d4e1f # v2.6.1 - run: cargo install --version 0.10.0 pb-rs --locked @@ -352,5 +352,5 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: Swatinem/rust-cache@b8a6852b4f997182bdea832df3f9e153038b5191 # v2.6.0 + - uses: Swatinem/rust-cache@578b235f6e5f613f7727f1c17bd3305b4d4d4e1f # v2.6.1 - run: cargo metadata --locked --format-version=1 > /dev/null diff --git a/Cargo.lock b/Cargo.lock index 5f5026f1..b5612343 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -455,7 +455,7 @@ dependencies = [ "log", "memchr", "once_cell", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.12", "pin-utils", "slab", "wasm-bindgen-futures", @@ -484,9 +484,9 @@ checksum = "ecc7ab41815b3c653ccd2978ec3255c81349336702dfdf62ee6f7069b12a3aae" [[package]] name = "async-trait" -version = "0.1.72" +version = "0.1.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6dde6e4ed435a4c1ee4e73592f5ba9da2151af10076cc04858746af9352d09" +checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" dependencies = [ "proc-macro2", "quote", @@ -503,7 +503,7 @@ dependencies = [ "futures-sink", "futures-util", "memchr", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.12", ] [[package]] @@ -548,7 +548,7 @@ dependencies = [ "memchr", "mime", "percent-encoding", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.12", "rustversion", "serde", "serde_json", @@ -831,7 +831,6 @@ dependencies = [ "env_logger 0.10.0", "futures", "libp2p", - "libp2p-quic", ] [[package]] @@ -891,9 +890,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.19" +version = "4.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fd304a20bff958a57f04c4e96a2e7594cc4490a0e809cbd48bb6437edaa452d" +checksum = "c27cdf28c0f604ba3f512b0c9a409f8de8513e4816705deb0498b627e7c3a3fd" dependencies = [ "clap_builder", "clap_derive", @@ -902,9 +901,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.3.19" +version = "4.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01c6a3f08f1fe5662a35cfe393aec09c4df95f60ee93b7556505260f75eee9e1" +checksum = "08a9f1ab5e9f01a9b81f202e8562eb9a10de70abf9eaeac1be465c28b75aa4aa" dependencies = [ "anstream", "anstyle", @@ -945,7 +944,7 @@ dependencies = [ "bytes", "futures-core", "memchr", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.12", "tokio", "tokio-util", ] @@ -1227,18 +1226,32 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.0.0-rc.1" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d4ba9852b42210c7538b75484f9daa0655e9a3ac04f693747bb0f02cf3cfe16" +checksum = "f711ade317dd348950a9910f81c5947e3d8907ebd2b83f76203ff1807e6a2bc2" dependencies = [ "cfg-if 1.0.0", + "cpufeatures", + "curve25519-dalek-derive", + "digest 0.10.7", "fiat-crypto", - "packed_simd_2", "platforms", + "rustc_version", "subtle", "zeroize", ] +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.28", +] + [[package]] name = "darling" version = "0.14.4" @@ -1309,7 +1322,6 @@ dependencies = [ "futures", "futures-timer", "libp2p", - "libp2p-quic", "log", ] @@ -1471,24 +1483,25 @@ dependencies = [ [[package]] name = "ed25519" -version = "1.5.3" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" +checksum = "60f6d271ca33075c88028be6f04d502853d63a5ece419d269c15315d4fc1cf1d" dependencies = [ - "signature 1.6.4", + "pkcs8 0.10.2", + "signature 2.1.0", ] [[package]] name = "ed25519-dalek" -version = "1.0.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" +checksum = "7277392b266383ef8396db7fdeb1e77b6c52fed775f5df15bb24f35b72156980" dependencies = [ - "curve25519-dalek 3.2.0", + "curve25519-dalek 4.0.0", "ed25519", - "rand 0.7.3", + "rand_core 0.6.4", "serde", - "sha2 0.9.9", + "sha2 0.10.7", "zeroize", ] @@ -1794,7 +1807,7 @@ dependencies = [ "futures-io", "memchr", "parking", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.12", "waker-fn", ] @@ -1827,7 +1840,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35bd3cf68c183738046838e300353e4716c674dc5e56890de4826801a6622a28" dependencies = [ "futures-io", - "rustls 0.21.5", + "rustls 0.21.6", ] [[package]] @@ -1876,7 +1889,7 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.12", "pin-utils", "slab", ] @@ -2134,7 +2147,7 @@ checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ "bytes", "http", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.12", ] [[package]] @@ -2177,7 +2190,7 @@ dependencies = [ "httparse", "httpdate", "itoa", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.12", "socket2 0.4.9", "tokio", "tower-service", @@ -2354,7 +2367,6 @@ dependencies = [ "instant", "libp2p", "libp2p-mplex", - "libp2p-quic", "libp2p-webrtc", "log", "mime_guess", @@ -2504,15 +2516,9 @@ version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" -[[package]] -name = "libm" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" - [[package]] name = "libp2p" -version = "0.52.2" +version = "0.52.3" dependencies = [ "async-std", "async-trait", @@ -2543,6 +2549,7 @@ dependencies = [ "libp2p-ping", "libp2p-plaintext", "libp2p-pnet", + "libp2p-quic", "libp2p-relay", "libp2p-rendezvous", "libp2p-request-response", @@ -2785,7 +2792,7 @@ dependencies = [ [[package]] name = "libp2p-identity" -version = "0.2.2" +version = "0.2.3" dependencies = [ "asn1_der", "base64 0.21.2", @@ -3058,7 +3065,7 @@ dependencies = [ [[package]] name = "libp2p-quic" -version = "0.9.1-alpha" +version = "0.9.2" dependencies = [ "async-std", "bytes", @@ -3078,7 +3085,7 @@ dependencies = [ "quickcheck", "quinn", "rand 0.8.5", - "rustls 0.21.5", + "rustls 0.21.6", "socket2 0.5.3", "thiserror", "tokio", @@ -3260,7 +3267,7 @@ dependencies = [ "libp2p-yamux", "rcgen 0.10.0", "ring", - "rustls 0.21.5", + "rustls 0.21.6", "thiserror", "tokio", "webpki 0.22.0", @@ -3345,11 +3352,11 @@ dependencies = [ "log", "parking_lot", "quicksink", - "rcgen 0.9.3", + "rcgen 0.10.0", "rw-stream-sink", "soketto", "url", - "webpki-roots 0.25.1", + "webpki-roots 0.25.2", ] [[package]] @@ -3463,9 +3470,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.19" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" dependencies = [ "value-bag", ] @@ -3976,16 +3983,6 @@ dependencies = [ "sha2 0.10.7", ] -[[package]] -name = "packed_simd_2" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1914cd452d8fccd6f9db48147b29fd4ae05bea9dc5d9ad578509f72415de282" -dependencies = [ - "cfg-if 1.0.0", - "libm", -] - [[package]] name = "parking" version = "2.1.0" @@ -4056,18 +4053,18 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pin-project" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "030ad2bc4db10a8944cb0d837f158bdfec4d4a4873ab701a95046770d11f8842" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", @@ -4082,9 +4079,9 @@ checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" [[package]] name = "pin-project-lite" -version = "0.2.10" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57" +checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05" [[package]] name = "pin-utils" @@ -4174,7 +4171,7 @@ dependencies = [ "concurrent-queue", "libc", "log", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.12", "windows-sys", ] @@ -4353,19 +4350,19 @@ dependencies = [ [[package]] name = "quinn" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21252f1c0fc131f1b69182db8f34837e8a69737b8251dff75636a9be0518c324" +checksum = "8cc2c5017e4b43d5995dcea317bc46c1e09404c0a9664d2908f7f02dfe943d75" dependencies = [ "async-io", "async-std", "bytes", "futures-io", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.12", "quinn-proto", "quinn-udp", "rustc-hash", - "rustls 0.21.5", + "rustls 0.21.6", "thiserror", "tokio", "tracing", @@ -4373,15 +4370,15 @@ dependencies = [ [[package]] name = "quinn-proto" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85af4ed6ee5a89f26a26086e9089a6643650544c025158449a3626ebf72884b3" +checksum = "f8c8bb234e70c863204303507d841e7fa2295e95c822b2bb4ca8ebf57f17b1cb" dependencies = [ "bytes", "rand 0.8.5", "ring", "rustc-hash", - "rustls 0.21.5", + "rustls 0.21.6", "slab", "thiserror", "tinyvec", @@ -4530,9 +4527,9 @@ dependencies = [ [[package]] name = "redis" -version = "0.23.1" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff5d95dd18a4d76650f0c2607ed8ebdbf63baf9cb934e1c233cd220c694db1d7" +checksum = "ffd6543a7bc6428396845f6854ccf3d1ae8823816592e2cbe74f20f50f209d02" dependencies = [ "async-trait", "bytes", @@ -4540,7 +4537,7 @@ dependencies = [ "futures-util", "itoa", "percent-encoding", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.12", "ryu", "tokio", "tokio-util", @@ -4610,7 +4607,6 @@ dependencies = [ "env_logger 0.10.0", "futures", "libp2p", - "libp2p-quic", ] [[package]] @@ -4649,7 +4645,7 @@ dependencies = [ "native-tls", "once_cell", "percent-encoding", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.12", "serde", "serde_json", "serde_urlencoded", @@ -4898,9 +4894,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.5" +version = "0.21.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79ea77c539259495ce8ca47f53e66ae0330a8819f67e23ac96ca02f50e7b7d36" +checksum = "1d1feddffcfcc0b33f5c6ce9a29e341e4cd59c3f78e7ee45f4a40c038b1d6cbb" dependencies = [ "log", "ring", @@ -5318,14 +5314,14 @@ dependencies = [ [[package]] name = "snow" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ccba027ba85743e09d15c03296797cad56395089b832b48b5a5217880f57733" +checksum = "0c9d1425eb528a21de2755c75af4c9b5d57f50a0d4c3b7f1828a4cd03f8ba155" dependencies = [ "aes-gcm 0.9.2", "blake2", "chacha20poly1305", - "curve25519-dalek 4.0.0-rc.1", + "curve25519-dalek 4.0.0", "rand_core 0.6.4", "ring", "rustc_version", @@ -5491,9 +5487,9 @@ dependencies = [ [[package]] name = "sysinfo" -version = "0.29.7" +version = "0.29.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "165d6d8539689e3d3bc8b98ac59541e1f21c7de7c85d60dc80e43ae0ed2113db" +checksum = "d10ed79c22663a35a255d289a7fdcb43559fc77ff15df5ce6c341809e7867528" dependencies = [ "cfg-if 1.0.0", "core-foundation-sys", @@ -5527,9 +5523,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.7.0" +version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5486094ee78b2e5038a6382ed7645bc084dc2ec433426ca4c3cb61e2007b8998" +checksum = "dc02fddf48964c42031a0b3fe0428320ecf3a73c401040fc0096f97794310651" dependencies = [ "cfg-if 1.0.0", "fastrand 2.0.0", @@ -5669,20 +5665,19 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.29.1" +version = "1.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" +checksum = "40de3a2ba249dcb097e01be5e67a5ff53cf250397715a071a81543e8a832a920" dependencies = [ - "autocfg", "backtrace", "bytes", "libc", "mio", "num_cpus", "parking_lot", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.12", "signal-hook-registry", - "socket2 0.4.9", + "socket2 0.5.3", "tokio-macros", "windows-sys", ] @@ -5729,7 +5724,7 @@ dependencies = [ "futures-core", "futures-io", "futures-sink", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.12", "tokio", "tracing", ] @@ -5743,7 +5738,7 @@ dependencies = [ "futures-core", "futures-util", "pin-project", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.12", "tokio", "tower-layer", "tower-service", @@ -5767,7 +5762,7 @@ dependencies = [ "mime", "mime_guess", "percent-encoding", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.12", "tokio", "tokio-util", "tower-layer", @@ -5795,7 +5790,7 @@ checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if 1.0.0", "log", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.12", "tracing-attributes", "tracing-core", ] @@ -5915,9 +5910,9 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "trybuild" -version = "1.0.82" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a84e0202ea606ba5ebee8507ab2bfbe89b98551ed9b8f0be198109275cff284b" +checksum = "6df60d81823ed9c520ee897489573da4b1d79ffbe006b8134f46de1a1aa03555" dependencies = [ "basic-toml", "glob", @@ -6306,9 +6301,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.25.1" +version = "0.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9c6eda1c830a36f361e7721c87fd79ea84293b54f8c48c959f85ec636f0f196" +checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" [[package]] name = "webrtc" diff --git a/Cargo.toml b/Cargo.toml index 6b4bd5eb..e42a905b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -73,7 +73,7 @@ libp2p-dns = { version = "0.40.0", path = "transports/dns" } libp2p-floodsub = { version = "0.43.0", path = "protocols/floodsub" } libp2p-gossipsub = { version = "0.45.1", path = "protocols/gossipsub" } libp2p-identify = { version = "0.43.0", path = "protocols/identify" } -libp2p-identity = { version = "0.2.2" } +libp2p-identity = { version = "0.2.3" } libp2p-kad = { version = "0.44.4", path = "protocols/kad" } libp2p-mdns = { version = "0.44.0", path = "protocols/mdns" } libp2p-memory-connection-limits = { version = "0.1.0", path = "misc/memory-connection-limits" } @@ -85,7 +85,7 @@ libp2p-perf = { version = "0.2.0", path = "protocols/perf" } libp2p-ping = { version = "0.43.0", path = "protocols/ping" } libp2p-plaintext = { version = "0.40.0", path = "transports/plaintext" } libp2p-pnet = { version = "0.23.0", path = "transports/pnet" } -libp2p-quic = { version = "0.9.1-alpha", path = "transports/quic" } +libp2p-quic = { version = "0.9.2", path = "transports/quic" } libp2p-relay = { version = "0.16.1", path = "protocols/relay" } libp2p-rendezvous = { version = "0.13.0", path = "protocols/rendezvous" } libp2p-request-response = { version = "0.25.1", path = "protocols/request-response" } diff --git a/README.md b/README.md index da228391..6bd528fc 100644 --- a/README.md +++ b/README.md @@ -103,4 +103,4 @@ used and maintained by [Actyx](https://www.actyx.com). - [Subspace](https://github.com/subspace/subspace) - Subspace Network reference implementation - [Substrate](https://github.com/paritytech/substrate) - Framework for blockchain innovation, used by [Polkadot](https://www.parity.io/technologies/polkadot/). -- [Ursa](https://github.com/fleek-network/ursa) - Decentralized Content Delivery & Edge Compute. +- [Taple](https://github.com/opencanarias/taple-core) - Sustainable DLT for asset and process traceability by [OpenCanarias](https://www.opencanarias.com/en/). \ No newline at end of file diff --git a/ROADMAP.md b/ROADMAP.md index 6758bf5a..0d5533f9 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -67,7 +67,7 @@ Though (a) I think we should prioritize improving existing functionality over ne | Category | Status | Target Completion | Tracking | Dependencies | Dependents | |--------------|--------|-------------------|--------------------------------------------|-------------------------------------------------------------------------------------------|------------| -| Connectivity | todo | | https://github.com/libp2p/specs/issues/475 | [Improved WASM support](#improved-wasm-support), https://github.com/libp2p/specs/pull/497 | | +| Connectivity | In progress | | https://github.com/libp2p/specs/issues/475 | [Improved WASM support](#improved-wasm-support), https://github.com/libp2p/specs/pull/497 | https://github.com/libp2p/rust-libp2p/pull/4248 | Use the browser's WebRTC stack to support [`/webrtc`](https://github.com/libp2p/specs/blob/master/webrtc/webrtc.md) and [`/webrtc-direct`](https://github.com/libp2p/specs/blob/master/webrtc/webrtc-direct.md) from within the browser using rust-libp2p compiled to WASM. This makes rust-libp2p a truly end-to-end solution, enabling users to use rust-libp2p on both the client (browser) and server side. diff --git a/core/Cargo.toml b/core/Cargo.toml index 34da753e..e71c4d0f 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -23,7 +23,7 @@ multihash = { workspace = true } multistream-select = { workspace = true } once_cell = "1.18.0" parking_lot = "0.12.0" -pin-project = "1.1.2" +pin-project = "1.1.3" quick-protobuf = "0.8" rand = "0.8" rw-stream-sink = { workspace = true } diff --git a/examples/autonat/Cargo.toml b/examples/autonat/Cargo.toml index 9f40dbbc..9ca936b6 100644 --- a/examples/autonat/Cargo.toml +++ b/examples/autonat/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT" [dependencies] async-std = { version = "1.12", features = ["attributes"] } -clap = { version = "4.3.12", features = ["derive"] } +clap = { version = "4.3.21", features = ["derive"] } env_logger = "0.10.0" futures = "0.3.28" libp2p = { path = "../../libp2p", features = ["async-std", "tcp", "noise", "yamux", "autonat", "identify", "macros"] } diff --git a/examples/chat-example/Cargo.toml b/examples/chat-example/Cargo.toml index 1d865711..cfc417cf 100644 --- a/examples/chat-example/Cargo.toml +++ b/examples/chat-example/Cargo.toml @@ -10,5 +10,4 @@ async-std = { version = "1.12", features = ["attributes"] } async-trait = "0.1" env_logger = "0.10.0" futures = "0.3.28" -libp2p = { path = "../../libp2p", features = ["async-std", "gossipsub", "mdns", "noise", "macros", "tcp", "yamux"] } -libp2p-quic = { path = "../../transports/quic", features = ["async-std"] } +libp2p = { path = "../../libp2p", features = ["async-std", "gossipsub", "mdns", "noise", "macros", "tcp", "yamux", "quic"] } diff --git a/examples/chat-example/src/main.rs b/examples/chat-example/src/main.rs index 9dc2d92a..95a16f38 100644 --- a/examples/chat-example/src/main.rs +++ b/examples/chat-example/src/main.rs @@ -24,12 +24,11 @@ use async_std::io; use futures::{future::Either, prelude::*, select}; use libp2p::{ core::{muxing::StreamMuxerBox, transport::OrTransport, upgrade}, - gossipsub, identity, mdns, noise, + gossipsub, identity, mdns, noise, quic, swarm::NetworkBehaviour, swarm::{SwarmBuilder, SwarmEvent}, tcp, yamux, PeerId, Transport, }; -use libp2p_quic as quic; use std::collections::hash_map::DefaultHasher; use std::error::Error; use std::hash::{Hash, Hasher}; diff --git a/examples/dcutr/Cargo.toml b/examples/dcutr/Cargo.toml index 5a6389f0..7a13dd23 100644 --- a/examples/dcutr/Cargo.toml +++ b/examples/dcutr/Cargo.toml @@ -6,10 +6,9 @@ publish = false license = "MIT" [dependencies] -clap = { version = "4.3.12", features = ["derive"] } +clap = { version = "4.3.21", features = ["derive"] } env_logger = "0.10.0" futures = "0.3.28" futures-timer = "3.0" -libp2p = { path = "../../libp2p", features = ["async-std", "dns", "dcutr", "identify", "macros", "noise", "ping", "relay", "rendezvous", "tcp", "tokio", "yamux"] } -libp2p-quic = { path = "../../transports/quic", features = ["async-std"] } +libp2p = { path = "../../libp2p", features = ["async-std", "dns", "dcutr", "identify", "macros", "noise", "ping", "quic", "relay", "rendezvous", "tcp", "tokio", "yamux"] } log = "0.4" diff --git a/examples/dcutr/src/main.rs b/examples/dcutr/src/main.rs index 8359bb19..8837df78 100644 --- a/examples/dcutr/src/main.rs +++ b/examples/dcutr/src/main.rs @@ -35,11 +35,10 @@ use libp2p::{ }, dcutr, dns::DnsConfig, - identify, identity, noise, ping, relay, + identify, identity, noise, ping, quic, relay, swarm::{NetworkBehaviour, SwarmBuilder, SwarmEvent}, tcp, yamux, PeerId, }; -use libp2p_quic as quic; use log::info; use std::error::Error; use std::str::FromStr; diff --git a/examples/file-sharing/Cargo.toml b/examples/file-sharing/Cargo.toml index 348b62fd..a2aa47ce 100644 --- a/examples/file-sharing/Cargo.toml +++ b/examples/file-sharing/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT" [dependencies] serde = { version = "1.0", features = ["derive"] } async-std = { version = "1.12", features = ["attributes"] } -clap = { version = "4.3.12", features = ["derive"] } +clap = { version = "4.3.21", features = ["derive"] } either = "1.9" env_logger = "0.10" futures = "0.3.28" diff --git a/examples/metrics/Cargo.toml b/examples/metrics/Cargo.toml index f883127e..b81c0142 100644 --- a/examples/metrics/Cargo.toml +++ b/examples/metrics/Cargo.toml @@ -10,6 +10,6 @@ env_logger = "0.10.0" futures = "0.3.27" hyper = { version = "0.14", features = ["server", "tcp", "http1"] } libp2p = { path = "../../libp2p", features = ["async-std", "metrics", "ping", "noise", "identify", "tcp", "yamux", "macros"] } -log = "0.4.19" +log = "0.4.20" tokio = { version = "1", features = ["rt-multi-thread"] } prometheus-client = "0.21.2" diff --git a/examples/relay-server/Cargo.toml b/examples/relay-server/Cargo.toml index 263a25b3..62d3cc0a 100644 --- a/examples/relay-server/Cargo.toml +++ b/examples/relay-server/Cargo.toml @@ -6,10 +6,9 @@ publish = false license = "MIT" [dependencies] -clap = { version = "4.3.12", features = ["derive"] } +clap = { version = "4.3.21", features = ["derive"] } async-std = { version = "1.12", features = ["attributes"] } async-trait = "0.1" env_logger = "0.10.0" futures = "0.3.28" -libp2p = { path = "../../libp2p", features = ["async-std", "noise", "macros", "ping", "tcp", "identify", "yamux", "relay"] } -libp2p-quic = { path = "../../transports/quic", features = ["async-std"] } +libp2p = { path = "../../libp2p", features = ["async-std", "noise", "macros", "ping", "tcp", "identify", "yamux", "relay", "quic"] } diff --git a/examples/relay-server/src/main.rs b/examples/relay-server/src/main.rs index 6a1d956b..7526a076 100644 --- a/examples/relay-server/src/main.rs +++ b/examples/relay-server/src/main.rs @@ -31,11 +31,10 @@ use libp2p::{ core::{Multiaddr, Transport}, identify, identity, identity::PeerId, - noise, ping, relay, + noise, ping, quic, relay, swarm::{NetworkBehaviour, SwarmBuilder, SwarmEvent}, tcp, }; -use libp2p_quic as quic; use std::error::Error; use std::net::{Ipv4Addr, Ipv6Addr}; diff --git a/examples/rendezvous/Cargo.toml b/examples/rendezvous/Cargo.toml index ffbde3fd..e0cf39ba 100644 --- a/examples/rendezvous/Cargo.toml +++ b/examples/rendezvous/Cargo.toml @@ -12,4 +12,4 @@ env_logger = "0.10.0" futures = "0.3.28" libp2p = { path = "../../libp2p", features = ["async-std", "identify", "macros", "noise", "ping", "rendezvous", "tcp", "tokio", "yamux"] } log = "0.4" -tokio = { version = "1.29", features = [ "rt-multi-thread", "macros", "time" ] } +tokio = { version = "1.31", features = [ "rt-multi-thread", "macros", "time" ] } diff --git a/identity/CHANGELOG.md b/identity/CHANGELOG.md index bfe46076..b52f0018 100644 --- a/identity/CHANGELOG.md +++ b/identity/CHANGELOG.md @@ -1,3 +1,11 @@ +## 0.2.3 + +- Fix [RUSTSEC-2022-0093] by updating `ed25519-dalek` to `2.0`. + See [PR 4337] + +[RUSTSEC-2022-0093]: https://rustsec.org/advisories/RUSTSEC-2022-0093 +[PR 4337]: https://github.com/libp2p/rust-libp2p/pull/4337 + ## 0.2.2 - Implement `from_protobuf_encoding` for RSA `Keypair`. diff --git a/identity/Cargo.toml b/identity/Cargo.toml index 8ae0b831..e4b8e1a8 100644 --- a/identity/Cargo.toml +++ b/identity/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libp2p-identity" -version = "0.2.2" +version = "0.2.3" edition = "2021" description = "Data structures and algorithms for identifying peers in libp2p." rust-version = { workspace = true } @@ -14,7 +14,7 @@ categories = ["cryptography"] [dependencies] asn1_der = { version = "0.7.6", optional = true } bs58 = { version = "0.5.0", optional = true } -ed25519-dalek = { version = "1.0.1", optional = true } +ed25519-dalek = { version = "2.0", optional = true, features = ["rand_core"] } libsecp256k1 = { version = "0.7.0", optional = true } log = "0.4" multihash = { version = "0.19.0", optional = true } diff --git a/identity/src/ed25519.rs b/identity/src/ed25519.rs index 62f90cf4..4a96260d 100644 --- a/identity/src/ed25519.rs +++ b/identity/src/ed25519.rs @@ -25,13 +25,12 @@ use core::cmp; use core::fmt; use core::hash; use ed25519_dalek::{self as ed25519, Signer as _, Verifier as _}; -#[cfg(feature = "rand")] -use rand::RngCore; use std::convert::TryFrom; use zeroize::Zeroize; /// An Ed25519 keypair. -pub struct Keypair(ed25519::Keypair); +#[derive(Clone)] +pub struct Keypair(ed25519::SigningKey); impl Keypair { /// Generate a new random Ed25519 keypair. @@ -44,7 +43,7 @@ impl Keypair { /// of the secret scalar and the compressed public point, /// an informal standard for encoding Ed25519 keypairs. pub fn to_bytes(&self) -> [u8; 64] { - self.0.to_bytes() + self.0.to_keypair_bytes() } /// Try to parse a keypair from the [binary format](https://datatracker.ietf.org/doc/html/rfc8032#section-5.1.5) @@ -52,7 +51,10 @@ impl Keypair { /// /// Note that this binary format is the same as `ed25519_dalek`'s and `ed25519_zebra`'s. pub fn try_from_bytes(kp: &mut [u8]) -> Result { - ed25519::Keypair::from_bytes(kp) + let bytes = <[u8; 64]>::try_from(&*kp) + .map_err(|e| DecodingError::failed_to_parse("Ed25519 keypair", e))?; + + ed25519::SigningKey::from_keypair_bytes(&bytes) .map(|k| { kp.zeroize(); Keypair(k) @@ -67,60 +69,41 @@ impl Keypair { /// Get the public key of this keypair. pub fn public(&self) -> PublicKey { - PublicKey(self.0.public) + PublicKey(self.0.verifying_key()) } /// Get the secret key of this keypair. pub fn secret(&self) -> SecretKey { - SecretKey::try_from_bytes(&mut self.0.secret.to_bytes()) - .expect("ed25519::SecretKey::from_bytes(to_bytes(k)) != k") + SecretKey(self.0.to_bytes()) } } impl fmt::Debug for Keypair { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Keypair") - .field("public", &self.0.public) + .field("public", &self.0.verifying_key()) .finish() } } -impl Clone for Keypair { - fn clone(&self) -> Keypair { - let mut sk_bytes = self.0.secret.to_bytes(); - let secret = SecretKey::try_from_bytes(&mut sk_bytes) - .expect("ed25519::SecretKey::from_bytes(to_bytes(k)) != k") - .0; - - Keypair(ed25519::Keypair { - secret, - public: self.0.public, - }) - } -} - /// Demote an Ed25519 keypair to a secret key. impl From for SecretKey { fn from(kp: Keypair) -> SecretKey { - SecretKey(kp.0.secret) + SecretKey(kp.0.to_bytes()) } } /// Promote an Ed25519 secret key into a keypair. impl From for Keypair { fn from(sk: SecretKey) -> Keypair { - let secret: ed25519::ExpandedSecretKey = (&sk.0).into(); - let public = ed25519::PublicKey::from(&secret); - Keypair(ed25519::Keypair { - secret: sk.0, - public, - }) + let signing = ed25519::SigningKey::from_bytes(&sk.0); + Keypair(signing) } } /// An Ed25519 public key. #[derive(Eq, Clone)] -pub struct PublicKey(ed25519::PublicKey); +pub struct PublicKey(ed25519::VerifyingKey); impl fmt::Debug for PublicKey { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { @@ -172,27 +155,22 @@ impl PublicKey { /// Try to parse a public key from a byte array containing the actual key as produced by `to_bytes`. pub fn try_from_bytes(k: &[u8]) -> Result { - ed25519::PublicKey::from_bytes(k) + let k = <[u8; 32]>::try_from(k) + .map_err(|e| DecodingError::failed_to_parse("Ed25519 public key", e))?; + ed25519::VerifyingKey::from_bytes(&k) .map_err(|e| DecodingError::failed_to_parse("Ed25519 public key", e)) .map(PublicKey) } } /// An Ed25519 secret key. +#[derive(Clone)] pub struct SecretKey(ed25519::SecretKey); /// View the bytes of the secret key. impl AsRef<[u8]> for SecretKey { fn as_ref(&self) -> &[u8] { - self.0.as_bytes() - } -} - -impl Clone for SecretKey { - fn clone(&self) -> SecretKey { - let mut sk_bytes = self.0.to_bytes(); - Self::try_from_bytes(&mut sk_bytes) - .expect("ed25519::SecretKey::from_bytes(to_bytes(k)) != k") + &self.0[..] } } @@ -206,13 +184,8 @@ impl SecretKey { /// Generate a new Ed25519 secret key. #[cfg(feature = "rand")] pub fn generate() -> SecretKey { - let mut bytes = [0u8; 32]; - rand::thread_rng().fill_bytes(&mut bytes); - SecretKey( - ed25519::SecretKey::from_bytes(&bytes).expect( - "this returns `Err` only if the length is wrong; the length is correct; qed", - ), - ) + let signing = ed25519::SigningKey::generate(&mut rand::rngs::OsRng); + SecretKey(signing.to_bytes()) } /// Try to parse an Ed25519 secret key from a byte slice @@ -221,7 +194,7 @@ impl SecretKey { /// returned. pub fn try_from_bytes(mut sk_bytes: impl AsMut<[u8]>) -> Result { let sk_bytes = sk_bytes.as_mut(); - let secret = ed25519::SecretKey::from_bytes(&*sk_bytes) + let secret = <[u8; 32]>::try_from(&*sk_bytes) .map_err(|e| DecodingError::failed_to_parse("Ed25519 secret key", e))?; sk_bytes.zeroize(); Ok(SecretKey(secret)) @@ -234,7 +207,7 @@ mod tests { use quickcheck::*; fn eq_keypairs(kp1: &Keypair, kp2: &Keypair) -> bool { - kp1.public() == kp2.public() && kp1.0.secret.as_bytes() == kp2.0.secret.as_bytes() + kp1.public() == kp2.public() && kp1.0.to_bytes() == kp2.0.to_bytes() } #[test] @@ -254,7 +227,7 @@ mod tests { fn ed25519_keypair_from_secret() { fn prop() -> bool { let kp1 = Keypair::generate(); - let mut sk = kp1.0.secret.to_bytes(); + let mut sk = kp1.0.to_bytes(); let kp2 = Keypair::from(SecretKey::try_from_bytes(&mut sk).unwrap()); eq_keypairs(&kp1, &kp2) && sk == [0u8; 32] } diff --git a/interop-tests/Cargo.toml b/interop-tests/Cargo.toml index 2d0d8ea2..861bf14e 100644 --- a/interop-tests/Cargo.toml +++ b/interop-tests/Cargo.toml @@ -19,16 +19,15 @@ rand = "0.8.5" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] axum = "0.6" -libp2p = { path = "../libp2p", features = ["ping", "noise", "tls", "rsa", "macros", "websocket", "tokio", "yamux", "tcp", "dns", "identify"] } -libp2p-quic = { workspace = true, features = ["tokio"] } +libp2p = { path = "../libp2p", features = ["ping", "noise", "tls", "rsa", "macros", "websocket", "tokio", "yamux", "tcp", "dns", "identify", "quic"] } libp2p-webrtc = { workspace = true, features = ["tokio"] } libp2p-mplex = { path = "../muxers/mplex" } mime_guess = "2.0" -redis = { version = "0.23.0", default-features = false, features = ["tokio-comp"] } +redis = { version = "0.23.2", default-features = false, features = ["tokio-comp"] } rust-embed = "6.8" serde_json = "1" thirtyfour = "=0.32.0-rc.8" # https://github.com/stevepryde/thirtyfour/issues/169 -tokio = { version = "1.29.1", features = ["full"] } +tokio = { version = "1.31.0", features = ["full"] } tower-http = { version = "0.4", features = ["cors", "fs", "trace"] } tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/interop-tests/src/arch.rs b/interop-tests/src/arch.rs index 2f4a7495..2b2181f2 100644 --- a/interop-tests/src/arch.rs +++ b/interop-tests/src/arch.rs @@ -26,9 +26,8 @@ pub(crate) mod native { use libp2p::identity::Keypair; use libp2p::swarm::{NetworkBehaviour, SwarmBuilder}; use libp2p::websocket::WsConfig; - use libp2p::{noise, tcp, tls, yamux, PeerId, Transport as _}; + use libp2p::{noise, quic, tcp, tls, yamux, PeerId, Transport as _}; use libp2p_mplex as mplex; - use libp2p_quic as quic; use libp2p_webrtc as webrtc; use redis::AsyncCommands; diff --git a/libp2p/CHANGELOG.md b/libp2p/CHANGELOG.md index fc2b24bd..642d4103 100644 --- a/libp2p/CHANGELOG.md +++ b/libp2p/CHANGELOG.md @@ -1,4 +1,8 @@ -## 0.52.2 - unreleased +## 0.52.3 - unreleased + +- Add `libp2p-quic` stable release. + +## 0.52.2 - Include gossipsub when compiling for wasm. See [PR 4217]. diff --git a/libp2p/Cargo.toml b/libp2p/Cargo.toml index e057c9e8..5cb8741a 100644 --- a/libp2p/Cargo.toml +++ b/libp2p/Cargo.toml @@ -1,9 +1,9 @@ [package] name = "libp2p" edition = "2021" -rust-version = "1.65.0" +rust-version = { workspace = true } description = "Peer-to-peer networking library" -version = "0.52.2" +version = "0.52.3" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" @@ -33,6 +33,7 @@ full = [ "ping", "plaintext", "pnet", + "quic", "relay", "rendezvous", "request-response", @@ -51,7 +52,7 @@ full = [ "yamux", ] -async-std = ["libp2p-swarm/async-std", "libp2p-mdns?/async-io", "libp2p-tcp?/async-io", "libp2p-dns?/async-std"] +async-std = ["libp2p-swarm/async-std", "libp2p-mdns?/async-io", "libp2p-tcp?/async-io", "libp2p-dns?/async-std", "libp2p-quic?/async-std"] autonat = ["dep:libp2p-autonat"] cbor = ["libp2p-request-response?/cbor"] dcutr = ["dep:libp2p-dcutr", "libp2p-metrics?/dcutr"] @@ -72,6 +73,7 @@ noise = ["dep:libp2p-noise"] ping = ["dep:libp2p-ping", "libp2p-metrics?/ping"] plaintext = ["dep:libp2p-plaintext"] pnet = ["dep:libp2p-pnet"] +quic = ["dep:libp2p-quic"] relay = ["dep:libp2p-relay", "libp2p-metrics?/relay"] rendezvous = ["dep:libp2p-rendezvous"] request-response = ["dep:libp2p-request-response"] @@ -80,7 +82,7 @@ secp256k1 = ["libp2p-identity/secp256k1"] serde = ["libp2p-core/serde", "libp2p-kad?/serde", "libp2p-gossipsub?/serde"] tcp = ["dep:libp2p-tcp"] tls = ["dep:libp2p-tls"] -tokio = ["libp2p-swarm/tokio", "libp2p-mdns?/tokio", "libp2p-tcp?/tokio", "libp2p-dns?/tokio"] +tokio = ["libp2p-swarm/tokio", "libp2p-mdns?/tokio", "libp2p-tcp?/tokio", "libp2p-dns?/tokio", "libp2p-quic?/tokio"] uds = ["dep:libp2p-uds"] wasm-bindgen = ["futures-timer/wasm-bindgen", "instant/wasm-bindgen", "getrandom/js", "libp2p-swarm/wasm-bindgen", "libp2p-gossipsub?/wasm-bindgen"] wasm-ext = ["dep:libp2p-wasm-ext"] @@ -127,6 +129,7 @@ libp2p-deflate = { workspace = true, optional = true } libp2p-dns = { workspace = true, optional = true } libp2p-mdns = { workspace = true, optional = true } libp2p-memory-connection-limits = { workspace = true, optional = true } +libp2p-quic = { workspace = true, optional = true } libp2p-tcp = { workspace = true, optional = true } libp2p-tls = { workspace = true, optional = true } libp2p-uds = { workspace = true, optional = true } diff --git a/libp2p/src/lib.rs b/libp2p/src/lib.rs index 9ec1fe48..349427ff 100644 --- a/libp2p/src/lib.rs +++ b/libp2p/src/lib.rs @@ -98,6 +98,9 @@ pub use libp2p_plaintext as plaintext; #[cfg(feature = "pnet")] #[doc(inline)] pub use libp2p_pnet as pnet; +#[cfg(feature = "quic")] +#[cfg(not(target_arch = "wasm32"))] +pub use libp2p_quic as quic; #[cfg(feature = "relay")] #[doc(inline)] pub use libp2p_relay as relay; diff --git a/misc/keygen/Cargo.toml b/misc/keygen/Cargo.toml index 49eee550..6de32895 100644 --- a/misc/keygen/Cargo.toml +++ b/misc/keygen/Cargo.toml @@ -10,7 +10,7 @@ categories = ["network-programming", "asynchronous"] publish = false [dependencies] -clap = { version = "4.3.12", features = ["derive"] } +clap = { version = "4.3.21", features = ["derive"] } zeroize = "1" serde = { version = "1.0.183", features = ["derive"] } serde_json = "1.0.100" diff --git a/misc/memory-connection-limits/CHANGELOG.md b/misc/memory-connection-limits/CHANGELOG.md index 5dac7afb..951a5a3f 100644 --- a/misc/memory-connection-limits/CHANGELOG.md +++ b/misc/memory-connection-limits/CHANGELOG.md @@ -1,3 +1,3 @@ -## 0.1.0 - unreleased +## 0.1.0 - Initial release. diff --git a/misc/metrics/CHANGELOG.md b/misc/metrics/CHANGELOG.md index cca9ced5..5c3d3c14 100644 --- a/misc/metrics/CHANGELOG.md +++ b/misc/metrics/CHANGELOG.md @@ -1,11 +1,11 @@ -## 0.13.1 - unreleased +## 0.13.1 - Enable gossipsub related data-type fields when compiling for wasm. See [PR 4217]. [PR 4217]: https://github.com/libp2p/rust-libp2p/pull/4217 -## 0.13.0 +## 0.13.0 - Previously `libp2p-metrics::identify` would increase a counter / gauge / histogram on each received identify information. These metrics are misleading, as e.g. they depend on the identify diff --git a/misc/metrics/Cargo.toml b/misc/metrics/Cargo.toml index e93d1f66..1ea026a9 100644 --- a/misc/metrics/Cargo.toml +++ b/misc/metrics/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p-metrics" edition = "2021" -rust-version = "1.65.0" +rust-version = { workspace = true } description = "Metrics for libp2p" version = "0.13.1" authors = ["Max Inden "] diff --git a/misc/multistream-select/Cargo.toml b/misc/multistream-select/Cargo.toml index c47c4c07..711a8014 100644 --- a/misc/multistream-select/Cargo.toml +++ b/misc/multistream-select/Cargo.toml @@ -14,7 +14,7 @@ categories = ["network-programming", "asynchronous"] bytes = "1" futures = "0.3" log = "0.4" -pin-project = "1.1.2" +pin-project = "1.1.3" smallvec = "1.11.0" unsigned-varint = "0.7" diff --git a/misc/rw-stream-sink/Cargo.toml b/misc/rw-stream-sink/Cargo.toml index e1886c5f..b6d02c28 100644 --- a/misc/rw-stream-sink/Cargo.toml +++ b/misc/rw-stream-sink/Cargo.toml @@ -12,7 +12,7 @@ categories = ["network-programming", "asynchronous"] [dependencies] futures = "0.3.28" -pin-project = "1.1.2" +pin-project = "1.1.3" static_assertions = "1" [dev-dependencies] diff --git a/muxers/yamux/CHANGELOG.md b/muxers/yamux/CHANGELOG.md index caea4e53..92e9fbeb 100644 --- a/muxers/yamux/CHANGELOG.md +++ b/muxers/yamux/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.44.1 - unreleased +## 0.44.1 - Update to `yamux` `v0.12` which brings performance improvements and introduces an ACK backlog of 256 inbound streams. When interacting with other libp2p nodes that are also running this or a newer version, the creation of inbound streams will be backpressured once the ACK backlog is hit. @@ -6,7 +6,7 @@ [PR 3013]: https://github.com/libp2p/rust-libp2p/pull/3013 -## 0.44.0 +## 0.44.0 - Raise MSRV to 1.65. See [PR 3715]. diff --git a/protocols/dcutr/Cargo.toml b/protocols/dcutr/Cargo.toml index 5ef81f0d..2b9d3c3a 100644 --- a/protocols/dcutr/Cargo.toml +++ b/protocols/dcutr/Cargo.toml @@ -27,7 +27,7 @@ void = "1" [dev-dependencies] async-std = { version = "1.12.0", features = ["attributes"] } -clap = { version = "4.3.12", features = ["derive"] } +clap = { version = "4.3.21", features = ["derive"] } env_logger = "0.10.0" libp2p-dns = { workspace = true, features = ["async-std"] } libp2p-identify = { workspace = true } diff --git a/protocols/gossipsub/CHANGELOG.md b/protocols/gossipsub/CHANGELOG.md index ab483bdd..a1f4ef6c 100644 --- a/protocols/gossipsub/CHANGELOG.md +++ b/protocols/gossipsub/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.45.1 - unreleased +## 0.45.1 - Add getter function to obtain `TopicScoreParams`. See [PR 4231]. diff --git a/protocols/gossipsub/Cargo.toml b/protocols/gossipsub/Cargo.toml index a9cf8b2a..acbab0c8 100644 --- a/protocols/gossipsub/Cargo.toml +++ b/protocols/gossipsub/Cargo.toml @@ -28,7 +28,7 @@ instant = "0.1.12" libp2p-core = { workspace = true } libp2p-identity = { workspace = true } libp2p-swarm = { workspace = true } -log = "0.4.19" +log = "0.4.20" quick-protobuf = "0.8" quick-protobuf-codec = { workspace = true } rand = "0.8" diff --git a/protocols/identify/Cargo.toml b/protocols/identify/Cargo.toml index 61d38ede..fb207dd7 100644 --- a/protocols/identify/Cargo.toml +++ b/protocols/identify/Cargo.toml @@ -17,7 +17,7 @@ futures-timer = "3.0.2" libp2p-core = { workspace = true } libp2p-swarm = { workspace = true } libp2p-identity = { workspace = true } -log = "0.4.19" +log = "0.4.20" lru = "0.11.0" quick-protobuf-codec = { workspace = true } quick-protobuf = "0.8" diff --git a/protocols/kad/CHANGELOG.md b/protocols/kad/CHANGELOG.md index cd87a644..a9cde76d 100644 --- a/protocols/kad/CHANGELOG.md +++ b/protocols/kad/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.44.4 - unreleased +## 0.44.4 - Implement common traits on `RoutingUpdate`. See [PR 4270]. diff --git a/protocols/kad/Cargo.toml b/protocols/kad/Cargo.toml index 80e8946f..fa937033 100644 --- a/protocols/kad/Cargo.toml +++ b/protocols/kad/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libp2p-kad" edition = "2021" -rust-version = "1.65.0" +rust-version = { workspace = true } description = "Kademlia protocol for libp2p" version = "0.44.4" authors = ["Parity Technologies "] diff --git a/protocols/mdns/Cargo.toml b/protocols/mdns/Cargo.toml index 830547e7..14a30e6b 100644 --- a/protocols/mdns/Cargo.toml +++ b/protocols/mdns/Cargo.toml @@ -18,11 +18,11 @@ if-watch = "3.0.1" libp2p-core = { workspace = true } libp2p-swarm = { workspace = true } libp2p-identity = { workspace = true } -log = "0.4.19" +log = "0.4.20" rand = "0.8.3" smallvec = "1.11.0" socket2 = { version = "0.5.3", features = ["all"] } -tokio = { version = "1.29", default-features = false, features = ["net", "time"], optional = true} +tokio = { version = "1.31", default-features = false, features = ["net", "time"], optional = true} trust-dns-proto = { version = "0.22.0", default-features = false, features = ["mdns", "tokio-runtime"] } void = "1.0.2" @@ -37,7 +37,7 @@ libp2p-noise = { workspace = true } libp2p-swarm = { workspace = true, features = ["tokio", "async-std"] } libp2p-tcp = { workspace = true, features = ["tokio", "async-io"] } libp2p-yamux = { workspace = true } -tokio = { version = "1.29", default-features = false, features = ["macros", "rt", "rt-multi-thread", "time"] } +tokio = { version = "1.31", default-features = false, features = ["macros", "rt", "rt-multi-thread", "time"] } libp2p-swarm-test = { path = "../../swarm-test" } [[test]] diff --git a/protocols/perf/Cargo.toml b/protocols/perf/Cargo.toml index 5374c68a..499cfd82 100644 --- a/protocols/perf/Cargo.toml +++ b/protocols/perf/Cargo.toml @@ -13,7 +13,7 @@ categories = ["network-programming", "asynchronous"] [dependencies] anyhow = "1" async-trait = "0.1" -clap = { version = "4.3.12", features = ["derive"] } +clap = { version = "4.3.21", features = ["derive"] } env_logger = "0.10.0" futures = "0.3.28" instant = "0.1.12" @@ -30,7 +30,7 @@ log = "0.4" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" thiserror = "1.0" -tokio = { version = "1.29.1", features = ["full"] } +tokio = { version = "1.31.0", features = ["full"] } void = "1" [dev-dependencies] diff --git a/protocols/ping/Cargo.toml b/protocols/ping/Cargo.toml index aebc4735..f66222ef 100644 --- a/protocols/ping/Cargo.toml +++ b/protocols/ping/Cargo.toml @@ -18,7 +18,7 @@ instant = "0.1.12" libp2p-core = { workspace = true } libp2p-swarm = { workspace = true } libp2p-identity = { workspace = true } -log = "0.4.19" +log = "0.4.20" rand = "0.8" void = "1.0" diff --git a/protocols/relay/CHANGELOG.md b/protocols/relay/CHANGELOG.md index c79034c2..6af89e25 100644 --- a/protocols/relay/CHANGELOG.md +++ b/protocols/relay/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.16.1 - unreleased +## 0.16.1 - Export `RateLimiter` type. See [PR 3742]. diff --git a/protocols/rendezvous/Cargo.toml b/protocols/rendezvous/Cargo.toml index b24781dc..7929d3c4 100644 --- a/protocols/rendezvous/Cargo.toml +++ b/protocols/rendezvous/Cargo.toml @@ -37,7 +37,7 @@ libp2p-identify = { workspace = true } libp2p-yamux = { workspace = true } libp2p-tcp = { workspace = true, features = ["tokio"] } rand = "0.8" -tokio = { version = "1.29", features = [ "rt-multi-thread", "time", "macros", "sync", "process", "fs", "net" ] } +tokio = { version = "1.31", features = [ "rt-multi-thread", "time", "macros", "sync", "process", "fs", "net" ] } libp2p-swarm-test = { path = "../../swarm-test" } # Passing arguments to the docsrs builder in order to properly document cfg's. diff --git a/protocols/request-response/CHANGELOG.md b/protocols/request-response/CHANGELOG.md index 292cb812..693145c6 100644 --- a/protocols/request-response/CHANGELOG.md +++ b/protocols/request-response/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.25.1 - unreleased +## 0.25.1 - Replace unmaintained `serde_cbor` dependency with `cbor4ii`. See [PR 4187]. diff --git a/protocols/request-response/Cargo.toml b/protocols/request-response/Cargo.toml index ddb87316..40e65f1c 100644 --- a/protocols/request-response/Cargo.toml +++ b/protocols/request-response/Cargo.toml @@ -23,7 +23,7 @@ serde = { version = "1.0", optional = true} serde_json = { version = "1.0.100", optional = true } smallvec = "1.11.0" void = "1.0.2" -log = "0.4.19" +log = "0.4.20" [features] json = ["dep:serde", "dep:serde_json", "libp2p-swarm/macros"] diff --git a/swarm-test/Cargo.toml b/swarm-test/Cargo.toml index 69aa312b..67753b1c 100644 --- a/swarm-test/Cargo.toml +++ b/swarm-test/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p-swarm-test" version = "0.2.0" edition = "2021" -rust-version = "1.65.0" +rust-version = { workspace = true } license = "MIT" description = "Test framework for code building on top of libp2p-swarm" repository = "https://github.com/libp2p/rust-libp2p" @@ -12,7 +12,7 @@ categories = ["network-programming", "asynchronous"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -async-trait = "0.1.72" +async-trait = "0.1.73" libp2p-core = { workspace = true } libp2p-identity = { workspace = true } libp2p-plaintext = { workspace = true } @@ -20,6 +20,6 @@ libp2p-swarm = { workspace = true } libp2p-tcp = { workspace = true, features = ["async-io"] } libp2p-yamux = { workspace = true } futures = "0.3.28" -log = "0.4.19" +log = "0.4.20" rand = "0.8.5" futures-timer = "3.0.2" diff --git a/swarm/CHANGELOG.md b/swarm/CHANGELOG.md index 6a9808dd..37a5cbc6 100644 --- a/swarm/CHANGELOG.md +++ b/swarm/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.43.3 - unreleased +## 0.43.3 - Implement `Display` for `ConnectionId`. See [PR 4278]. diff --git a/swarm/Cargo.toml b/swarm/Cargo.toml index 37d16d31..00c18698 100644 --- a/swarm/Cargo.toml +++ b/swarm/Cargo.toml @@ -30,7 +30,7 @@ multistream-select = { workspace = true } [target.'cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "unknown")))'.dependencies] async-std = { version = "1.6.2", optional = true } -tokio = { version = "1.29", features = ["rt"], optional = true } +tokio = { version = "1.31", features = ["rt"], optional = true } [features] macros = ["dep:libp2p-swarm-derive"] @@ -48,13 +48,13 @@ libp2p-identity = { workspace = true, features = ["ed25519"] } libp2p-kad = { path = "../protocols/kad" } # Using `path` here because this is a cyclic dev-dependency which otherwise breaks releasing. libp2p-ping = { path = "../protocols/ping" } # Using `path` here because this is a cyclic dev-dependency which otherwise breaks releasing. libp2p-plaintext = { path = "../transports/plaintext" } # Using `path` here because this is a cyclic dev-dependency which otherwise breaks releasing. -libp2p-swarm-derive = { path = "../swarm-derive" } +libp2p-swarm-derive = { path = "../swarm-derive" } # Using `path` here because this is a cyclic dev-dependency which otherwise breaks releasing. libp2p-swarm-test = { path = "../swarm-test" } # Using `path` here because this is a cyclic dev-dependency which otherwise breaks releasing. -libp2p-yamux = { workspace = true } +libp2p-yamux = { path = "../muxers/yamux" } # Using `path` here because this is a cyclic dev-dependency which otherwise breaks releasing. quickcheck = { workspace = true } void = "1" once_cell = "1.18.0" -trybuild = "1.0.80" +trybuild = "1.0.83" [[test]] name = "swarm_derive" diff --git a/transports/dns/Cargo.toml b/transports/dns/Cargo.toml index d1afd041..a85307aa 100644 --- a/transports/dns/Cargo.toml +++ b/transports/dns/Cargo.toml @@ -13,7 +13,7 @@ categories = ["network-programming", "asynchronous"] [dependencies] libp2p-core = { workspace = true } libp2p-identity = { workspace = true } -log = "0.4.19" +log = "0.4.20" futures = "0.3.28" async-std-resolver = { version = "0.22", optional = true } parking_lot = "0.12.0" diff --git a/transports/plaintext/Cargo.toml b/transports/plaintext/Cargo.toml index 6990a846..1f15004d 100644 --- a/transports/plaintext/Cargo.toml +++ b/transports/plaintext/Cargo.toml @@ -16,7 +16,7 @@ bytes = "1" futures = "0.3.28" libp2p-core = { workspace = true } libp2p-identity = { workspace = true } -log = "0.4.19" +log = "0.4.20" quick-protobuf = "0.8" unsigned-varint = { version = "0.7", features = ["asynchronous_codec"] } diff --git a/transports/pnet/Cargo.toml b/transports/pnet/Cargo.toml index b74c4ef2..597709c5 100644 --- a/transports/pnet/Cargo.toml +++ b/transports/pnet/Cargo.toml @@ -12,11 +12,11 @@ categories = ["network-programming", "asynchronous"] [dependencies] futures = "0.3.28" -log = "0.4.19" +log = "0.4.20" salsa20 = "0.10" sha3 = "0.10" rand = "0.8" -pin-project = "1.1.2" +pin-project = "1.1.3" [dev-dependencies] libp2p-core = { workspace = true } @@ -27,7 +27,7 @@ libp2p-tcp = { workspace = true, features = ["tokio"] } libp2p-websocket = { workspace = true } libp2p-yamux = { workspace = true } quickcheck = { workspace = true } -tokio = { version = "1.29.1", features = ["full"] } +tokio = { version = "1.31.0", features = ["full"] } # Passing arguments to the docsrs builder in order to properly document cfg's. # More information: https://docs.rs/about/builds#cross-compiling diff --git a/transports/quic/CHANGELOG.md b/transports/quic/CHANGELOG.md index 7e0c09a1..c7da2895 100644 --- a/transports/quic/CHANGELOG.md +++ b/transports/quic/CHANGELOG.md @@ -1,4 +1,15 @@ -## 0.9.1-alpha - unreleased +## 0.9.2 - unreleased + +- Cut stable release. + +## 0.9.2-alpha + +- Add support for reusing an existing socket when dialing localhost address. + See [PR 4304]. + +[PR 4304]: https://github.com/libp2p/rust-libp2p/pull/4304 + +## 0.9.1-alpha - Allow listening on ipv4 and ipv6 separately. See [PR 4289]. diff --git a/transports/quic/Cargo.toml b/transports/quic/Cargo.toml index 67f131ae..9344970a 100644 --- a/transports/quic/Cargo.toml +++ b/transports/quic/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libp2p-quic" -version = "0.9.1-alpha" +version = "0.9.2" authors = ["Parity Technologies "] edition = "2021" rust-version = { workspace = true } @@ -19,11 +19,11 @@ libp2p-tls = { workspace = true } libp2p-identity = { workspace = true } log = "0.4" parking_lot = "0.12.0" -quinn = { version = "0.10.1", default-features = false, features = ["tls-rustls", "futures-io"] } +quinn = { version = "0.10.2", default-features = false, features = ["tls-rustls", "futures-io"] } rand = "0.8.5" -rustls = { version = "0.21.2", default-features = false } +rustls = { version = "0.21.6", default-features = false } thiserror = "1.0.44" -tokio = { version = "1.29.1", default-features = false, features = ["net", "rt", "time"], optional = true } +tokio = { version = "1.31.0", default-features = false, features = ["net", "rt", "time"], optional = true } socket2 = "0.5.3" [features] @@ -45,7 +45,7 @@ libp2p-noise = { workspace = true } libp2p-tcp = { workspace = true, features = ["async-io"] } libp2p-yamux = { workspace = true } quickcheck = "1" -tokio = { version = "1.29.1", features = ["macros", "rt-multi-thread", "time"] } +tokio = { version = "1.31.0", features = ["macros", "rt-multi-thread", "time"] } [[test]] name = "stream_compliance" diff --git a/transports/quic/src/transport.rs b/transports/quic/src/transport.rs index 7e0a4a81..16ffbc5a 100644 --- a/transports/quic/src/transport.rs +++ b/transports/quic/src/transport.rs @@ -39,7 +39,7 @@ use libp2p_core::{ use libp2p_identity::PeerId; use socket2::{Domain, Socket, Type}; use std::collections::hash_map::{DefaultHasher, Entry}; -use std::collections::HashMap; +use std::collections::{HashMap, HashSet}; use std::hash::{Hash, Hasher}; use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, UdpSocket}; use std::time::Duration; @@ -155,9 +155,16 @@ impl GenTransport

{ if l.is_closed { return false; } - let listen_addr = l.socket_addr(); - SocketFamily::is_same(&listen_addr.ip(), &socket_addr.ip()) - && listen_addr.ip().is_loopback() == socket_addr.ip().is_loopback() + SocketFamily::is_same(&l.socket_addr().ip(), &socket_addr.ip()) + }) + .filter(|l| { + if socket_addr.ip().is_loopback() { + l.listening_addresses + .iter() + .any(|ip_addr| ip_addr.is_loopback()) + } else { + true + } }) .collect(); match listeners.len() { @@ -428,6 +435,8 @@ struct Listener { /// The stream must be awaken after it has been closed to deliver the last event. close_listener_waker: Option, + + listening_addresses: HashSet, } impl Listener

{ @@ -440,12 +449,14 @@ impl Listener

{ ) -> Result { let if_watcher; let pending_event; + let mut listening_addresses = HashSet::new(); let local_addr = socket.local_addr()?; if local_addr.ip().is_unspecified() { if_watcher = Some(P::new_if_watcher()?); pending_event = None; } else { if_watcher = None; + listening_addresses.insert(local_addr.ip()); let ma = socketaddr_to_multiaddr(&local_addr, version); pending_event = Some(TransportEvent::NewAddress { listener_id, @@ -467,6 +478,7 @@ impl Listener

{ is_closed: false, pending_event, close_listener_waker: None, + listening_addresses, }) } @@ -513,7 +525,8 @@ impl Listener

{ if let Some(listen_addr) = ip_to_listenaddr(&endpoint_addr, inet.addr(), self.version) { - log::debug!("New listen address: {}", listen_addr); + log::debug!("New listen address: {listen_addr}"); + self.listening_addresses.insert(inet.addr()); return Poll::Ready(TransportEvent::NewAddress { listener_id: self.listener_id, listen_addr, @@ -524,7 +537,8 @@ impl Listener

{ if let Some(listen_addr) = ip_to_listenaddr(&endpoint_addr, inet.addr(), self.version) { - log::debug!("Expired listen address: {}", listen_addr); + log::debug!("Expired listen address: {listen_addr}"); + self.listening_addresses.remove(&inet.addr()); return Poll::Ready(TransportEvent::AddressExpired { listener_id: self.listener_id, listen_addr, @@ -730,7 +744,7 @@ fn socketaddr_to_multiaddr(socket_addr: &SocketAddr, version: ProtocolVersion) - #[cfg(test)] #[cfg(any(feature = "async-std", feature = "tokio"))] -mod test { +mod tests { use futures::future::poll_fn; use std::net::{IpAddr, Ipv4Addr, Ipv6Addr}; @@ -912,17 +926,21 @@ mod test { let keypair = libp2p_identity::Keypair::generate_ed25519(); let config = Config::new(&keypair); let mut transport = crate::tokio::Transport::new(config); + let port = { + let socket = UdpSocket::bind("127.0.0.1:0").unwrap(); + socket.local_addr().unwrap().port() + }; transport .listen_on( ListenerId::next(), - "/ip4/0.0.0.0/udp/4001/quic-v1".parse().unwrap(), + format!("/ip4/0.0.0.0/udp/{port}/quic-v1").parse().unwrap(), ) .unwrap(); transport .listen_on( ListenerId::next(), - "/ip6/::/udp/4001/quic-v1".parse().unwrap(), + format!("/ip6/::/udp/{port}/quic-v1").parse().unwrap(), ) .unwrap(); } diff --git a/transports/quic/tests/smoke.rs b/transports/quic/tests/smoke.rs index 93adfa68..a0c43b9e 100644 --- a/transports/quic/tests/smoke.rs +++ b/transports/quic/tests/smoke.rs @@ -414,6 +414,49 @@ async fn write_after_peer_dropped_stream() { stream_b.close().await.expect("Close failed."); } +/// - A listens on 0.0.0.0:0 +/// - B listens on 127.0.0.1:0 +/// - A dials B +/// - Source port of A at B is the A's listen port +#[cfg(feature = "tokio")] +#[tokio::test] +async fn test_local_listener_reuse() { + let (_, mut a_transport) = create_default_transport::(); + let (_, mut b_transport) = create_default_transport::(); + + a_transport + .listen_on( + ListenerId::next(), + "/ip4/0.0.0.0/udp/0/quic-v1".parse().unwrap(), + ) + .unwrap(); + + // wait until a listener reports a loopback address + let a_listen_addr = 'outer: loop { + let ev = a_transport.next().await.unwrap(); + let listen_addr = ev.into_new_address().unwrap(); + for proto in listen_addr.iter() { + if let Protocol::Ip4(ip4) = proto { + if ip4.is_loopback() { + break 'outer listen_addr; + } + } + } + }; + // If we do not poll until the end, `NewAddress` events may be `Ready` and `connect` function + // below will panic due to an unexpected event. + poll_fn(|cx| { + let mut pinned = Pin::new(&mut a_transport); + while pinned.as_mut().poll(cx).is_ready() {} + Poll::Ready(()) + }) + .await; + + let b_addr = start_listening(&mut b_transport, "/ip4/127.0.0.1/udp/0/quic-v1").await; + let (_, send_back_addr, _) = connect(&mut b_transport, &mut a_transport, b_addr).await.0; + assert_eq!(send_back_addr, a_listen_addr); +} + async fn smoke() { let _ = env_logger::try_init(); diff --git a/transports/tcp/Cargo.toml b/transports/tcp/Cargo.toml index aaf40916..5aa01133 100644 --- a/transports/tcp/Cargo.toml +++ b/transports/tcp/Cargo.toml @@ -18,9 +18,9 @@ if-watch = "3.0.1" libc = "0.2.147" libp2p-core = { workspace = true } libp2p-identity = { workspace = true } -log = "0.4.19" +log = "0.4.20" socket2 = { version = "0.5.3", features = ["all"] } -tokio = { version = "1.29.1", default-features = false, features = ["net"], optional = true } +tokio = { version = "1.31.0", default-features = false, features = ["net"], optional = true } [features] tokio = ["dep:tokio", "if-watch/tokio"] @@ -28,7 +28,7 @@ async-io = ["dep:async-io", "if-watch/smol"] [dev-dependencies] async-std = { version = "1.6.5", features = ["attributes"] } -tokio = { version = "1.29.1", default-features = false, features = ["full"] } +tokio = { version = "1.31.0", default-features = false, features = ["full"] } env_logger = "0.10.0" # Passing arguments to the docsrs builder in order to properly document cfg's. diff --git a/transports/tcp/src/lib.rs b/transports/tcp/src/lib.rs index b1737cf7..5efdf16f 100644 --- a/transports/tcp/src/lib.rs +++ b/transports/tcp/src/lib.rs @@ -346,13 +346,12 @@ where } } - fn create_socket(&self, socket_addr: &SocketAddr) -> io::Result { - let domain = if socket_addr.is_ipv4() { - Domain::IPV4 - } else { - Domain::IPV6 - }; - let socket = Socket::new(domain, Type::STREAM, Some(socket2::Protocol::TCP))?; + fn create_socket(&self, socket_addr: SocketAddr) -> io::Result { + let socket = Socket::new( + Domain::for_address(socket_addr), + Type::STREAM, + Some(socket2::Protocol::TCP), + )?; if socket_addr.is_ipv6() { socket.set_only_v6(true)?; } @@ -375,7 +374,7 @@ where id: ListenerId, socket_addr: SocketAddr, ) -> io::Result> { - let socket = self.create_socket(&socket_addr)?; + let socket = self.create_socket(socket_addr)?; socket.bind(&socket_addr.into())?; socket.listen(self.config.backlog as _)?; socket.set_nonblocking(true)?; @@ -476,7 +475,7 @@ where log::debug!("dialing {}", socket_addr); let socket = self - .create_socket(&socket_addr) + .create_socket(socket_addr) .map_err(TransportError::Other)?; if let Some(addr) = self.port_reuse.local_dial_addr(&socket_addr.ip()) { @@ -1329,4 +1328,42 @@ mod tests { assert!(rt.block_on(cycle_listeners::())); } } + + #[test] + fn test_listens_ipv4_ipv6_separately() { + fn test() { + let port = { + let listener = TcpListener::bind("127.0.0.1:0").unwrap(); + listener.local_addr().unwrap().port() + }; + let mut tcp = Transport::::default().boxed(); + let listener_id = ListenerId::next(); + tcp.listen_on( + listener_id, + format!("/ip4/0.0.0.0/tcp/{port}").parse().unwrap(), + ) + .unwrap(); + tcp.listen_on( + ListenerId::next(), + format!("/ip6/::/tcp/{port}").parse().unwrap(), + ) + .unwrap(); + } + #[cfg(feature = "async-io")] + { + async_std::task::block_on(async { + test::(); + }) + } + #[cfg(feature = "tokio")] + { + let rt = ::tokio::runtime::Builder::new_current_thread() + .enable_io() + .build() + .unwrap(); + rt.block_on(async { + test::(); + }); + } + } } diff --git a/transports/tls/Cargo.toml b/transports/tls/Cargo.toml index 5275a9c0..81da6858 100644 --- a/transports/tls/Cargo.toml +++ b/transports/tls/Cargo.toml @@ -22,7 +22,7 @@ yasna = "0.5.2" # Exposed dependencies. Breaking changes to these are breaking changes to us. [dependencies.rustls] -version = "0.21.2" +version = "0.21.6" default-features = false features = ["dangerous_configuration"] # Must enable this to allow for custom verification code. @@ -33,7 +33,7 @@ libp2p-core = { workspace = true } libp2p-identity = { workspace = true, features = ["ed25519", "rsa", "secp256k1", "ecdsa"] } libp2p-swarm = { workspace = true } libp2p-yamux = { workspace = true } -tokio = { version = "1.29.1", features = ["full"] } +tokio = { version = "1.31.0", features = ["full"] } # Passing arguments to the docsrs builder in order to properly document cfg's. # More information: https://docs.rs/about/builds#cross-compiling diff --git a/transports/uds/Cargo.toml b/transports/uds/Cargo.toml index be011b5c..269eced5 100644 --- a/transports/uds/Cargo.toml +++ b/transports/uds/Cargo.toml @@ -13,9 +13,9 @@ categories = ["network-programming", "asynchronous"] [dependencies] async-std = { version = "1.6.2", optional = true } libp2p-core = { workspace = true } -log = "0.4.19" +log = "0.4.20" futures = "0.3.28" -tokio = { version = "1.29", default-features = false, features = ["net"], optional = true } +tokio = { version = "1.31", default-features = false, features = ["net"], optional = true } [dev-dependencies] tempfile = "3.7" diff --git a/transports/webrtc/Cargo.toml b/transports/webrtc/Cargo.toml index 70d5553e..05271951 100644 --- a/transports/webrtc/Cargo.toml +++ b/transports/webrtc/Cargo.toml @@ -32,7 +32,7 @@ serde = { version = "1.0", features = ["derive"] } stun = "0.4" thiserror = "1" tinytemplate = "1.2" -tokio = { version = "1.29", features = ["net"], optional = true} +tokio = { version = "1.31", features = ["net"], optional = true} tokio-util = { version = "0.7", features = ["compat"], optional = true } webrtc = { version = "0.8.0", optional = true } @@ -46,7 +46,7 @@ env_logger = "0.10" hex-literal = "0.4" libp2p-swarm = { workspace = true, features = ["macros", "tokio"] } libp2p-ping = { workspace = true } -tokio = { version = "1.29", features = ["full"] } +tokio = { version = "1.31", features = ["full"] } unsigned-varint = { version = "0.7", features = ["asynchronous_codec"] } void = "1" quickcheck = "1.0.3" diff --git a/transports/websocket/Cargo.toml b/transports/websocket/Cargo.toml index 3ebeb83b..b33af22f 100644 --- a/transports/websocket/Cargo.toml +++ b/transports/websocket/Cargo.toml @@ -16,7 +16,7 @@ either = "1.9.0" futures = "0.3.28" libp2p-core = { workspace = true } libp2p-identity = { workspace = true } -log = "0.4.19" +log = "0.4.20" parking_lot = "0.12.0" quicksink = "0.1" rw-stream-sink = { workspace = true } @@ -28,7 +28,7 @@ webpki-roots = "0.25" libp2p-tcp = { workspace = true, features = ["async-io"] } libp2p-dns = { workspace = true, features = ["async-std"] } async-std = { version = "1.6.5", features = ["attributes"] } -rcgen = "0.9.3" +rcgen = "0.10.0" # Passing arguments to the docsrs builder in order to properly document cfg's. # More information: https://docs.rs/about/builds#cross-compiling diff --git a/transports/webtransport-websys/Cargo.toml b/transports/webtransport-websys/Cargo.toml index 21ca077f..695a62f4 100644 --- a/transports/webtransport-websys/Cargo.toml +++ b/transports/webtransport-websys/Cargo.toml @@ -19,7 +19,7 @@ js-sys = "0.3.64" libp2p-core = { workspace = true } libp2p-identity = { workspace = true } libp2p-noise = { workspace = true } -log = "0.4.19" +log = "0.4.20" multiaddr = { workspace = true } multihash = { workspace = true } send_wrapper = { version = "0.6.0", features = ["futures"] }