From 766c909910e0ecb3b6dd7328cdc55722b6f956aa Mon Sep 17 00:00:00 2001 From: John Turpish Date: Mon, 28 Nov 2022 17:13:24 -0500 Subject: [PATCH 01/24] starting --- ping/rust/Cargo.lock | 1250 ++++++++++++++++++++++++---- ping/rust/Cargo.toml | 5 +- ping/rust/src/bin/testplan_0500.rs | 29 +- ping/rust/src/lib.rs | 17 +- 4 files changed, 1123 insertions(+), 178 deletions(-) diff --git a/ping/rust/Cargo.lock b/ping/rust/Cargo.lock index fe738f2ed..462c20135 100644 --- a/ping/rust/Cargo.lock +++ b/ping/rust/Cargo.lock @@ -8,6 +8,15 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "aead" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331" +dependencies = [ + "generic-array", +] + [[package]] name = "aead" version = "0.4.3" @@ -15,6 +24,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" dependencies = [ "generic-array", + "rand_core 0.6.4", +] + +[[package]] +name = "aes" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561" +dependencies = [ + "aes-soft", + "aesni", + "cipher 0.2.5", ] [[package]] @@ -24,30 +45,64 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" dependencies = [ "cfg-if", - "cipher", + "cipher 0.3.0", "cpufeatures", "opaque-debug", ] +[[package]] +name = "aes-gcm" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5278b5fabbb9bd46e24aa69b2fdea62c99088e0a950a9be40e3e0101298f88da" +dependencies = [ + "aead 0.3.2", + "aes 0.6.0", + "cipher 0.2.5", + "ctr 0.6.0", + "ghash 0.3.1", + "subtle", +] + [[package]] name = "aes-gcm" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df5f85a83a7d8b0442b6aa7b504b8212c1733da07b98aae43d4bc21b2cb3cdf6" dependencies = [ - "aead", - "aes", - "cipher", - "ctr", - "ghash", + "aead 0.4.3", + "aes 0.7.5", + "cipher 0.3.0", + "ctr 0.8.0", + "ghash 0.4.4", "subtle", ] +[[package]] +name = "aes-soft" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072" +dependencies = [ + "cipher 0.2.5", + "opaque-debug", +] + +[[package]] +name = "aesni" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce" +dependencies = [ + "cipher 0.2.5", + "opaque-debug", +] + [[package]] name = "aho-corasick" -version = "0.7.19" +version = "0.7.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" dependencies = [ "memchr", ] @@ -58,19 +113,41 @@ version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" +[[package]] +name = "arc-swap" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "983cd8b9d4b02a6dc6ffa557262eb5858a27a0038ffffe21a0f133eaa819a164" + [[package]] name = "arrayref" version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" +[[package]] +name = "asn1-rs" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30ff05a702273012438132f449575dbc804e27b2f3cbe3069aa237d26c98fa33" +dependencies = [ + "asn1-rs-derive 0.1.0", + "asn1-rs-impl", + "displaydoc", + "nom", + "num-traits", + "rusticata-macros", + "thiserror", + "time", +] + [[package]] name = "asn1-rs" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf6690c370453db30743b373a60ba498fc0d6d83b11f4abfd87a84a075db5dd4" dependencies = [ - "asn1-rs-derive", + "asn1-rs-derive 0.4.0", "asn1-rs-impl", "displaydoc", "nom", @@ -80,6 +157,18 @@ dependencies = [ "time", ] +[[package]] +name = "asn1-rs-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db8b7511298d5b7784b40b092d9e9dcd3a627a5707e4b5e507931ab0d44eeebf" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + [[package]] name = "asn1-rs-derive" version = "0.4.0" @@ -125,37 +214,25 @@ version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e14485364214912d3b19cc3435dde4df66065127f05fa0d75c712f36f12c2f28" dependencies = [ - "concurrent-queue", + "concurrent-queue 1.2.4", "event-listener", "futures-core", ] [[package]] name = "async-executor" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "871f9bb5e0a22eeb7e8cf16641feb87c9dc67032ccf8ff49e772eb9941d3a965" +checksum = "17adb73da160dfb475c183343c8cccd80721ea5a605d3eb57125f0a7b7a92d0b" dependencies = [ + "async-lock", "async-task", - "concurrent-queue", + "concurrent-queue 2.0.0", "fastrand", "futures-lite", - "once_cell", "slab", ] -[[package]] -name = "async-fs" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "279cf904654eeebfa37ac9bb1598880884924aab82e290aa65c9e77a0e142e06" -dependencies = [ - "async-lock", - "autocfg", - "blocking", - "futures-lite", -] - [[package]] name = "async-global-executor" version = "2.3.1" @@ -180,7 +257,7 @@ checksum = "e8121296a9f05be7f34aa4196b1747243b3b62e048bb7906f644f3fbfc490cf7" dependencies = [ "async-lock", "autocfg", - "concurrent-queue", + "concurrent-queue 1.2.4", "futures-lite", "libc", "log", @@ -202,18 +279,6 @@ dependencies = [ "futures-lite", ] -[[package]] -name = "async-net" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4051e67316bc7eff608fe723df5d32ed639946adcd69e07df41fd42a7b411f1f" -dependencies = [ - "async-io", - "autocfg", - "blocking", - "futures-lite", -] - [[package]] name = "async-process" version = "1.5.0" @@ -309,9 +374,9 @@ dependencies = [ [[package]] name = "asynchronous-codec" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0de5164e5edbf51c45fb8c2d9664ae1c095cce1b265ecf7569093c0d66ef690" +checksum = "06a0daa378f5fd10634e44b0a29b2a87b890657658e072a30d6f26e57ddee182" dependencies = [ "bytes", "futures-sink", @@ -358,12 +423,33 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" +[[package]] +name = "base16ct" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" + [[package]] name = "base64" version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +[[package]] +name = "base64ct" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + [[package]] name = "bitflags" version = "1.3.2" @@ -372,11 +458,11 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "blake2" -version = "0.10.4" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9cf849ee05b2ee5fba5e36f97ff8ec2533916700fc0758d40d92136a42f3388" +checksum = "b12e5fd123190ce1c2e559308a94c9bacad77907d4c6005d9e58fe1a0689e55e" dependencies = [ - "digest 0.10.5", + "digest 0.10.6", ] [[package]] @@ -397,6 +483,22 @@ dependencies = [ "generic-array", ] +[[package]] +name = "block-modes" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a0e8073e8baa88212fb5823574c02ebccb395136ba9a164ab89379ec6072f0" +dependencies = [ + "block-padding", + "cipher 0.2.5", +] + +[[package]] +name = "block-padding" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" + [[package]] name = "blocking" version = "1.2.0" @@ -431,9 +533,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" +checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" [[package]] name = "cache-padded" @@ -443,9 +545,20 @@ checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c" [[package]] name = "cc" -version = "1.0.74" +version = "1.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581f5dba903aac52ea3feb5ec4810848460ee833876f1f9b0fdeab1f19091574" +checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" + +[[package]] +name = "ccm" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aca1a8fbc20b50ac9673ff014abfb2b5f4085ee1a850d408f14a159c5853ac7" +dependencies = [ + "aead 0.3.2", + "cipher 0.2.5", + "subtle", +] [[package]] name = "cfg-if" @@ -460,7 +573,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c80e5460aa66fe3b91d40bcbdab953a597b60053e34d684ac6903f863b680a6" dependencies = [ "cfg-if", - "cipher", + "cipher 0.3.0", "cpufeatures", "zeroize", ] @@ -471,24 +584,33 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a18446b09be63d457bbec447509e85f662f32952b035ce892290396bc0b0cff5" dependencies = [ - "aead", + "aead 0.4.3", "chacha20", - "cipher", + "cipher 0.3.0", "poly1305", "zeroize", ] [[package]] name = "chrono" -version = "0.4.22" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1" +checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" dependencies = [ "num-integer", "num-traits", "serde", ] +[[package]] +name = "cipher" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" +dependencies = [ + "generic-array", +] + [[package]] name = "cipher" version = "0.3.0" @@ -552,6 +674,21 @@ dependencies = [ "cache-padded", ] +[[package]] +name = "concurrent-queue" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd7bef69dc86e3c610e4e7aed41035e2a7ed12e72dd7530f61327a6579a4390b" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "const-oid" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cec318a675afcb6a1ea1d4340e2d377e56e47c266f28043ceccbf4412ddfdd3b" + [[package]] name = "core-foundation" version = "0.9.3" @@ -586,6 +723,27 @@ dependencies = [ "libc", ] +[[package]] +name = "cpuid-bool" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcb25d077389e53838a8158c8e99174c5a9d902dee4904320db714f3c653ffba" + +[[package]] +name = "crc" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53757d12b596c16c78b83458d732a5d1a17ab3f53f2f7412f6fb57cc8a140ab3" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d0165d2900ae6778e36e80bbc4da3b5eefccee9ba939761f9c2882a5d9af3ff" + [[package]] name = "crc32fast" version = "1.3.2" @@ -597,13 +755,25 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.12" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac" +checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" dependencies = [ "cfg-if", ] +[[package]] +name = "crypto-bigint" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -614,6 +784,26 @@ dependencies = [ "typenum", ] +[[package]] +name = "crypto-mac" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bff07008ec701e8028e2ceb8f83f0e4274ee62bd2dbdc4fefff2e9a91824081a" +dependencies = [ + "generic-array", + "subtle", +] + +[[package]] +name = "crypto-mac" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" +dependencies = [ + "generic-array", + "subtle", +] + [[package]] name = "ctor" version = "0.1.26" @@ -624,13 +814,22 @@ dependencies = [ "syn", ] +[[package]] +name = "ctr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb4a30d54f7443bf3d6191dcd486aca19e67cb3c49fa7a06a319966346707e7f" +dependencies = [ + "cipher 0.2.5", +] + [[package]] name = "ctr" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" dependencies = [ - "cipher", + "cipher 0.3.0", ] [[package]] @@ -720,13 +919,38 @@ dependencies = [ "syn", ] +[[package]] +name = "der" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13dd2ae565c0a381dde7fade45fce95984c568bdcb4700a4fdbe3175e0380b2f" +dependencies = [ + "const-oid", + "pem-rfc7468", + "zeroize", +] + +[[package]] +name = "der-parser" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe398ac75057914d7d07307bf67dc7f3f574a26783b4fc7805a20ffa9f506e82" +dependencies = [ + "asn1-rs 0.3.1", + "displaydoc", + "nom", + "num-bigint", + "num-traits", + "rusticata-macros", +] + [[package]] name = "der-parser" version = "8.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42d4bc9b0db0a0df9ae64634ac5bdefb7afcb534e182275ca0beadbe486701c1" dependencies = [ - "asn1-rs", + "asn1-rs 0.5.1", "displaydoc", "nom", "num-bigint", @@ -734,6 +958,37 @@ dependencies = [ "rusticata-macros", ] +[[package]] +name = "derive_builder" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d07adf7be193b71cc36b193d0f5fe60b918a3a9db4dad0449f57bcfd519704a3" +dependencies = [ + "derive_builder_macro", +] + +[[package]] +name = "derive_builder_core" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f91d4cfa921f1c05904dc3c57b4a32c38aed3340cce209f3a6fd1478babafc4" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "derive_builder_macro" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f0314b72bed045f3a68671b3c86328386762c93f82d98c65c3cb5e5f573dd68" +dependencies = [ + "derive_builder_core", + "syn", +] + [[package]] name = "digest" version = "0.9.0" @@ -745,9 +1000,9 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c" +checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" dependencies = [ "block-buffer 0.10.3", "crypto-common", @@ -781,6 +1036,18 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8a6eee2d5d0d113f015688310da018bd1d864d86bd567c8fca9c266889e1bfa" +[[package]] +name = "ecdsa" +version = "0.14.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" +dependencies = [ + "der", + "elliptic-curve", + "rfc6979", + "signature", +] + [[package]] name = "ed25519" version = "1.5.2" @@ -810,6 +1077,28 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +[[package]] +name = "elliptic-curve" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" +dependencies = [ + "base16ct", + "crypto-bigint", + "der", + "digest 0.10.6", + "ff", + "generic-array", + "group", + "hkdf", + "pem-rfc7468", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + [[package]] name = "encoding_rs" version = "0.8.31" @@ -871,6 +1160,16 @@ dependencies = [ "instant", ] +[[package]] +name = "ff" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "fixedbitset" version = "0.4.2" @@ -985,8 +1284,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2411eed028cdf8c8034eaf21f9915f956b6c3abec4d4c7949ee67f0721127bd" dependencies = [ "futures-io", - "rustls", - "webpki", + "rustls 0.20.7", + "webpki 0.22.0", ] [[package]] @@ -1057,6 +1356,16 @@ dependencies = [ "wasi 0.11.0+wasi-snapshot-preview1", ] +[[package]] +name = "ghash" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97304e4cd182c3846f7575ced3890c53012ce534ad9114046b0a9e00bb30a375" +dependencies = [ + "opaque-debug", + "polyval 0.4.5", +] + [[package]] name = "ghash" version = "0.4.4" @@ -1064,7 +1373,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" dependencies = [ "opaque-debug", - "polyval", + "polyval 0.5.3", ] [[package]] @@ -1079,6 +1388,17 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "group" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "h2" version = "0.3.15" @@ -1128,6 +1448,50 @@ dependencies = [ "libc", ] +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hkdf" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" +dependencies = [ + "hmac 0.12.1", +] + +[[package]] +name = "hmac" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" +dependencies = [ + "crypto-mac 0.10.1", + "digest 0.9.0", +] + +[[package]] +name = "hmac" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" +dependencies = [ + "crypto-mac 0.11.1", + "digest 0.9.0", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.6", +] + [[package]] name = "hostname" version = "0.3.1" @@ -1290,16 +1654,16 @@ dependencies = [ "ipnet", "log", "rtnetlink", - "smol", "system-configuration", + "tokio", "windows", ] [[package]] name = "indexmap" -version = "1.9.1" +version = "1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" dependencies = [ "autocfg", "hashbrown", @@ -1343,16 +1707,35 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "interceptor" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ffaa4d24f546a18eaeee91f7b2c52e080e20e285e43cd7c27a527b4712cfdad" +dependencies = [ + "async-trait", + "bytes", + "log", + "rand 0.8.5", + "rtcp", + "rtp", + "thiserror", + "tokio", + "waitgroup", + "webrtc-srtp", + "webrtc-util", +] + [[package]] name = "ipconfig" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "723519edce41262b05d4143ceb95050e4c614f483e78e9fd9e39a8275a84ad98" +checksum = "bd302af1b90f2463a98fa5ad469fc212c8e3175a41c3068601bfa2727591c5be" dependencies = [ "socket2", "widestring", "winapi", - "winreg 0.7.0", + "winreg", ] [[package]] @@ -1589,7 +1972,7 @@ dependencies = [ "libp2p-swarm-derive 0.30.1", "libp2p-tcp 0.37.0", "libp2p-websocket 0.39.0", - "libp2p-yamux 0.41.0", + "libp2p-yamux 0.41.1", "multiaddr 0.14.0", "parking_lot", "pin-project 1.0.12", @@ -1599,7 +1982,7 @@ dependencies = [ [[package]] name = "libp2p" version = "0.50.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=368705a1465c4322948d14ee46d42475c472ca1e#368705a1465c4322948d14ee46d42475c472ca1e" +source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" dependencies = [ "bytes", "futures", @@ -1616,6 +1999,7 @@ dependencies = [ "libp2p-quic", "libp2p-swarm 0.41.0", "libp2p-tcp 0.38.0", + "libp2p-webrtc", "libp2p-websocket 0.40.0", "libp2p-yamux 0.42.0", "multiaddr 0.16.0", @@ -1831,7 +2215,7 @@ dependencies = [ [[package]] name = "libp2p-core" version = "0.38.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=368705a1465c4322948d14ee46d42475c472ca1e#368705a1465c4322948d14ee46d42475c472ca1e" +source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" dependencies = [ "asn1_der", "bs58", @@ -1844,7 +2228,7 @@ dependencies = [ "log", "multiaddr 0.16.0", "multihash", - "multistream-select 0.12.0 (git+https://github.com/libp2p/rust-libp2p?rev=368705a1465c4322948d14ee46d42475c472ca1e)", + "multistream-select 0.12.0 (git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4)", "once_cell", "parking_lot", "pin-project 1.0.12", @@ -1852,7 +2236,7 @@ dependencies = [ "prost-build 0.11.2", "rand 0.8.5", "ring", - "rw-stream-sink 0.3.0 (git+https://github.com/libp2p/rust-libp2p?rev=368705a1465c4322948d14ee46d42475c472ca1e)", + "rw-stream-sink 0.3.0 (git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4)", "sha2 0.10.6", "smallvec", "thiserror", @@ -1953,9 +2337,8 @@ dependencies = [ [[package]] name = "libp2p-dns" version = "0.38.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=368705a1465c4322948d14ee46d42475c472ca1e#368705a1465c4322948d14ee46d42475c472ca1e" +source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" dependencies = [ - "async-std-resolver 0.22.0", "futures", "libp2p-core 0.38.0", "log", @@ -1987,9 +2370,8 @@ dependencies = [ [[package]] name = "libp2p-mdns" version = "0.42.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=368705a1465c4322948d14ee46d42475c472ca1e#368705a1465c4322948d14ee46d42475c472ca1e" +source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" dependencies = [ - "async-io", "data-encoding", "futures", "if-watch 2.0.0", @@ -1999,6 +2381,7 @@ dependencies = [ "rand 0.8.5", "smallvec", "socket2", + "tokio", "trust-dns-proto 0.22.0", "void", ] @@ -2078,7 +2461,7 @@ dependencies = [ [[package]] name = "libp2p-metrics" version = "0.11.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=368705a1465c4322948d14ee46d42475c472ca1e#368705a1465c4322948d14ee46d42475c472ca1e" +source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" dependencies = [ "libp2p-core 0.38.0", "libp2p-ping 0.41.0", @@ -2197,7 +2580,7 @@ dependencies = [ [[package]] name = "libp2p-mplex" version = "0.38.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=368705a1465c4322948d14ee46d42475c472ca1e#368705a1465c4322948d14ee46d42475c472ca1e" +source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" dependencies = [ "asynchronous-codec", "bytes", @@ -2229,7 +2612,7 @@ dependencies = [ "sha2 0.10.6", "snow", "static_assertions", - "x25519-dalek", + "x25519-dalek 1.1.1", "zeroize", ] @@ -2251,7 +2634,7 @@ dependencies = [ "sha2 0.10.6", "snow", "static_assertions", - "x25519-dalek", + "x25519-dalek 1.1.1", "zeroize", ] @@ -2273,7 +2656,7 @@ dependencies = [ "sha2 0.10.6", "snow", "static_assertions", - "x25519-dalek", + "x25519-dalek 1.1.1", "zeroize", ] @@ -2295,7 +2678,7 @@ dependencies = [ "sha2 0.10.6", "snow", "static_assertions", - "x25519-dalek", + "x25519-dalek 1.1.1", "zeroize", ] @@ -2317,7 +2700,7 @@ dependencies = [ "sha2 0.10.6", "snow", "static_assertions", - "x25519-dalek", + "x25519-dalek 1.1.1", "zeroize", ] @@ -2339,14 +2722,14 @@ dependencies = [ "sha2 0.10.6", "snow", "static_assertions", - "x25519-dalek", + "x25519-dalek 1.1.1", "zeroize", ] [[package]] name = "libp2p-noise" version = "0.41.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=368705a1465c4322948d14ee46d42475c472ca1e#368705a1465c4322948d14ee46d42475c472ca1e" +source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" dependencies = [ "bytes", "curve25519-dalek 3.2.0", @@ -2360,7 +2743,7 @@ dependencies = [ "sha2 0.10.6", "snow", "static_assertions", - "x25519-dalek", + "x25519-dalek 1.1.1", "zeroize", ] @@ -2463,7 +2846,7 @@ dependencies = [ [[package]] name = "libp2p-ping" version = "0.41.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=368705a1465c4322948d14ee46d42475c472ca1e#368705a1465c4322948d14ee46d42475c472ca1e" +source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" dependencies = [ "futures", "futures-timer", @@ -2478,9 +2861,8 @@ dependencies = [ [[package]] name = "libp2p-quic" version = "0.7.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=368705a1465c4322948d14ee46d42475c472ca1e#368705a1465c4322948d14ee46d42475c472ca1e" +source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" dependencies = [ - "async-std", "bytes", "futures", "futures-timer", @@ -2491,8 +2873,9 @@ dependencies = [ "parking_lot", "quinn-proto", "rand 0.8.5", - "rustls", + "rustls 0.20.7", "thiserror", + "tokio", ] [[package]] @@ -2618,7 +3001,7 @@ dependencies = [ [[package]] name = "libp2p-swarm" version = "0.41.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=368705a1465c4322948d14ee46d42475c472ca1e#368705a1465c4322948d14ee46d42475c472ca1e" +source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" dependencies = [ "either", "fnv", @@ -2632,6 +3015,7 @@ dependencies = [ "rand 0.8.5", "smallvec", "thiserror", + "tokio", "void", ] @@ -2680,7 +3064,7 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" version = "0.30.2" -source = "git+https://github.com/libp2p/rust-libp2p?rev=368705a1465c4322948d14ee46d42475c472ca1e#368705a1465c4322948d14ee46d42475c472ca1e" +source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" dependencies = [ "heck 0.4.0", "quote", @@ -2791,35 +3175,65 @@ dependencies = [ [[package]] name = "libp2p-tcp" version = "0.38.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=368705a1465c4322948d14ee46d42475c472ca1e#368705a1465c4322948d14ee46d42475c472ca1e" +source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" dependencies = [ - "async-io", "futures", "futures-timer", - "if-watch 2.0.0", + "if-watch 3.0.0", "libc", "libp2p-core 0.38.0", "log", "socket2", + "tokio", ] [[package]] name = "libp2p-tls" version = "0.1.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=368705a1465c4322948d14ee46d42475c472ca1e#368705a1465c4322948d14ee46d42475c472ca1e" +source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" dependencies = [ "futures", "futures-rustls", "libp2p-core 0.38.0", - "rcgen", + "rcgen 0.10.0", "ring", - "rustls", + "rustls 0.20.7", "thiserror", - "webpki", - "x509-parser", + "webpki 0.22.0", + "x509-parser 0.14.0", "yasna", ] +[[package]] +name = "libp2p-webrtc" +version = "0.1.0-alpha" +source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" +dependencies = [ + "async-trait", + "asynchronous-codec", + "bytes", + "futures", + "futures-timer", + "hex", + "if-watch 2.0.0", + "libp2p-core 0.38.0", + "libp2p-noise 0.41.0", + "log", + "multihash", + "prost 0.11.2", + "prost-build 0.11.2", + "prost-codec", + "rand 0.8.5", + "rcgen 0.9.3", + "serde", + "stun", + "thiserror", + "tinytemplate", + "tokio", + "tokio-util", + "webrtc", +] + [[package]] name = "libp2p-websocket" version = "0.34.0" @@ -2936,7 +3350,7 @@ dependencies = [ [[package]] name = "libp2p-websocket" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=368705a1465c4322948d14ee46d42475c472ca1e#368705a1465c4322948d14ee46d42475c472ca1e" +source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" dependencies = [ "either", "futures", @@ -2945,7 +3359,7 @@ dependencies = [ "log", "parking_lot", "quicksink", - "rw-stream-sink 0.3.0 (git+https://github.com/libp2p/rust-libp2p?rev=368705a1465c4322948d14ee46d42475c472ca1e)", + "rw-stream-sink 0.3.0 (git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4)", "soketto", "url", "webpki-roots", @@ -3018,9 +3432,9 @@ dependencies = [ [[package]] name = "libp2p-yamux" -version = "0.41.0" +version = "0.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30f079097a21ad017fc8139460630286f02488c8c13b26affb46623aa20d8845" +checksum = "0d6874d66543c4f7e26e3b8ca9a6bead351563a13ab4fafd43c7927f7c0d6c12" dependencies = [ "futures", "libp2p-core 0.37.0", @@ -3033,7 +3447,7 @@ dependencies = [ [[package]] name = "libp2p-yamux" version = "0.42.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=368705a1465c4322948d14ee46d42475c472ca1e#368705a1465c4322948d14ee46d42475c472ca1e" +source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" dependencies = [ "futures", "libp2p-core 0.38.0", @@ -3101,12 +3515,30 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" +[[package]] +name = "md-5" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" +dependencies = [ + "digest 0.10.6", +] + [[package]] name = "memchr" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +[[package]] +name = "memoffset" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +dependencies = [ + "autocfg", +] + [[package]] name = "mime" version = "0.3.16" @@ -3194,7 +3626,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c346cf9999c631f002d8f977c4eaeaa0e6386f16007202308d0b3757522c2cc" dependencies = [ "core2", - "digest 0.10.5", + "digest 0.10.6", "multihash-derive", "sha2 0.10.6", "unsigned-varint", @@ -3251,7 +3683,7 @@ dependencies = [ [[package]] name = "multistream-select" version = "0.12.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=368705a1465c4322948d14ee46d42475c472ca1e#368705a1465c4322948d14ee46d42475c472ca1e" +source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" dependencies = [ "bytes", "futures", @@ -3325,6 +3757,7 @@ dependencies = [ "futures", "libc", "log", + "tokio", ] [[package]] @@ -3336,6 +3769,7 @@ dependencies = [ "bitflags", "cfg-if", "libc", + "memoffset", ] [[package]] @@ -3394,13 +3828,22 @@ dependencies = [ "libc", ] +[[package]] +name = "oid-registry" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38e20717fa0541f39bd146692035c37bedfa532b3e5071b35761082407546b2a" +dependencies = [ + "asn1-rs 0.3.1", +] + [[package]] name = "oid-registry" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d4bda43fd1b844cbc6e6e54b5444e2b1bc7838bce59ad205902cccbb26d6761" dependencies = [ - "asn1-rs", + "asn1-rs 0.5.1", ] [[package]] @@ -3417,9 +3860,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "os_str_bytes" -version = "6.3.1" +version = "6.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3baf96e39c5359d2eb0dd6ccb42c62b91d9678aa68160d261b9e0ccbf9e9dea9" +checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" [[package]] name = "owning_ref" @@ -3430,6 +3873,28 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "p256" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51f44edd08f51e2ade572f141051021c5af22677e42b7dd28a88155151c33594" +dependencies = [ + "ecdsa", + "elliptic-curve", + "sha2 0.10.6", +] + +[[package]] +name = "p384" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc8c5bf642dde52bb9e87c0ecd8ca5a76faac2eeed98dedb7c717997e1080aa" +dependencies = [ + "ecdsa", + "elliptic-curve", + "sha2 0.10.6", +] + [[package]] name = "parking" version = "2.0.0" @@ -3474,6 +3939,15 @@ dependencies = [ "base64", ] +[[package]] +name = "pem-rfc7468" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d159833a9105500e0398934e205e0773f0b27529557134ecfc51c27646adac" +dependencies = [ + "base64ct", +] + [[package]] name = "percent-encoding" version = "2.2.0" @@ -3548,6 +4022,16 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" +dependencies = [ + "der", + "spki", +] + [[package]] name = "pkg-config" version = "0.3.26" @@ -3579,6 +4063,17 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "polyval" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eebcc4aa140b9abd2bc40d9c3f7ccec842679cd79045ac3a7ac698c1a064b7cd" +dependencies = [ + "cpuid-bool", + "opaque-debug", + "universal-hash", +] + [[package]] name = "polyval" version = "0.5.3" @@ -3802,6 +4297,18 @@ dependencies = [ "which", ] +[[package]] +name = "prost-codec" +version = "0.3.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" +dependencies = [ + "asynchronous-codec", + "bytes", + "prost 0.11.2", + "thiserror", + "unsigned-varint", +] + [[package]] name = "prost-derive" version = "0.9.0" @@ -3890,20 +4397,20 @@ dependencies = [ [[package]] name = "quinn-proto" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1268269057c3f78dab82fe8d8b7834e656710cff55b97dbc890a67dcc113b2e" +checksum = "57098b1a3d2159d13dc3a98c0e3a5f8ab91ac3dd2471e52b1d712ea0c1085555" dependencies = [ "bytes", "rand 0.8.5", "ring", "rustc-hash", - "rustls", + "rustls 0.20.7", "slab", "thiserror", "tinyvec", "tracing", - "webpki", + "webpki 0.22.0", ] [[package]] @@ -3986,6 +4493,19 @@ dependencies = [ "rand_core 0.5.1", ] +[[package]] +name = "rcgen" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6413f3de1edee53342e6138e75b56d32e7bc6e332b3bd62d497b1929d4cfbcdd" +dependencies = [ + "pem", + "ring", + "time", + "x509-parser 0.13.2", + "yasna", +] + [[package]] name = "rcgen" version = "0.10.0" @@ -4035,9 +4555,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.12" +version = "0.11.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "431949c384f4e2ae07605ccaa56d1d9d2ecdb5cadd4f9577ccfab29f2e5149fc" +checksum = "68cc60575865c7831548863cc02356512e3f1dc2f3f82cb837d7fc4cc8f3c97c" dependencies = [ "base64", "bytes", @@ -4064,7 +4584,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "winreg 0.10.1", + "winreg", ] [[package]] @@ -4077,6 +4597,17 @@ dependencies = [ "quick-error", ] +[[package]] +name = "rfc6979" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" +dependencies = [ + "crypto-bigint", + "hmac 0.12.1", + "zeroize", +] + [[package]] name = "ring" version = "0.16.20" @@ -4092,6 +4623,17 @@ dependencies = [ "winapi", ] +[[package]] +name = "rtcp" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c11171e7e37998dcf54a9e9d4a6e2e1932c994424c7d39bc6349fed1424c45c3" +dependencies = [ + "bytes", + "thiserror", + "webrtc-util", +] + [[package]] name = "rtnetlink" version = "0.10.1" @@ -4105,6 +4647,21 @@ dependencies = [ "netlink-proto", "nix", "thiserror", + "tokio", +] + +[[package]] +name = "rtp" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2a095411ff00eed7b12e4c6a118ba984d113e1079582570d56a5ee723f11f80" +dependencies = [ + "async-trait", + "bytes", + "rand 0.8.5", + "serde", + "thiserror", + "webrtc-util", ] [[package]] @@ -4131,6 +4688,19 @@ dependencies = [ "nom", ] +[[package]] +name = "rustls" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" +dependencies = [ + "base64", + "log", + "ring", + "sct 0.6.1", + "webpki 0.21.4", +] + [[package]] name = "rustls" version = "0.20.7" @@ -4139,8 +4709,8 @@ checksum = "539a2bfe908f471bfa933876bd1eb6a19cf2176d375f82ef7f99530a40e48c2c" dependencies = [ "log", "ring", - "sct", - "webpki", + "sct 0.7.0", + "webpki 0.22.0", ] [[package]] @@ -4168,7 +4738,7 @@ dependencies = [ [[package]] name = "rw-stream-sink" version = "0.3.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=368705a1465c4322948d14ee46d42475c472ca1e#368705a1465c4322948d14ee46d42475c472ca1e" +source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" dependencies = [ "futures", "pin-project 1.0.12", @@ -4187,6 +4757,16 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "sct" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "sct" version = "0.7.0" @@ -4197,6 +4777,32 @@ dependencies = [ "untrusted", ] +[[package]] +name = "sdp" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d22a5ef407871893fd72b4562ee15e4742269b173959db4b8df6f538c414e13" +dependencies = [ + "rand 0.8.5", + "substring", + "thiserror", + "url", +] + +[[package]] +name = "sec1" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "1.0.14" @@ -4225,9 +4831,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.87" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" +checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db" dependencies = [ "itoa", "ryu", @@ -4259,9 +4865,9 @@ dependencies = [ [[package]] name = "serde_with" -version = "2.0.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368f2d60d049ea019a84dcd6687b0d1e0030fe663ae105039bdf967ed5e6a9a7" +checksum = "25bf4a5a814902cd1014dbccfa4d4560fb8432c779471e96e035602519f82eef" dependencies = [ "serde", "serde_with_macros", @@ -4269,9 +4875,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "2.0.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ccadfacf6cf10faad22bbadf55986bdd0856edfb5d9210aa1dcf1f516e84e93" +checksum = "e3452b4c0f6c1e357f73fdb87cd1efabaa12acf328c7a528e252893baeb3f4aa" dependencies = [ "darling", "proc-macro2", @@ -4313,7 +4919,7 @@ checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.5", + "digest 0.10.6", ] [[package]] @@ -4340,6 +4946,10 @@ name = "signature" version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" +dependencies = [ + "digest 0.10.6", + "rand_core 0.6.4", +] [[package]] name = "slab" @@ -4356,31 +4966,13 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" -[[package]] -name = "smol" -version = "1.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85cf3b5351f3e783c1d79ab5fc604eeed8b8ae9abd36b166e8b87a089efd85e4" -dependencies = [ - "async-channel", - "async-executor", - "async-fs", - "async-io", - "async-lock", - "async-net", - "async-process", - "blocking", - "futures-lite", - "once_cell", -] - [[package]] name = "snow" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "774d05a3edae07ce6d68ea6984f3c05e9bba8927e3dd591e3b479e5b03213d0d" dependencies = [ - "aes-gcm", + "aes-gcm 0.9.4", "blake2", "chacha20poly1305", "curve25519-dalek 4.0.0-pre.1", @@ -4423,6 +5015,16 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "spki" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" +dependencies = [ + "base64ct", + "der", +] + [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -4441,6 +5043,34 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "stun" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7e94b1ec00bad60e6410e058b52f1c66de3dc5fe4d62d09b3e52bb7d3b73e25" +dependencies = [ + "base64", + "crc", + "lazy_static", + "md-5", + "rand 0.8.5", + "ring", + "subtle", + "thiserror", + "tokio", + "url", + "webrtc-util", +] + +[[package]] +name = "substring" +version = "1.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ee6433ecef213b2e72f587ef64a2f5943e7cd16fbd82dbe8bc07486c534c86" +dependencies = [ + "autocfg", +] + [[package]] name = "subtle" version = "2.4.1" @@ -4618,6 +5248,16 @@ dependencies = [ "time-core", ] +[[package]] +name = "tinytemplate" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" +dependencies = [ + "serde", + "serde_json", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -4635,9 +5275,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.21.2" +version = "1.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099" +checksum = "d76ce4a75fb488c605c54bf610f221cea8b0dafb53333c1a67e8ee199dcd2ae3" dependencies = [ "autocfg", "bytes", @@ -4645,7 +5285,9 @@ dependencies = [ "memchr", "mio", "num_cpus", + "parking_lot", "pin-project-lite 0.2.9", + "signal-hook-registry", "socket2", "tokio-macros", "winapi", @@ -4780,6 +5422,7 @@ dependencies = [ "socket2", "thiserror", "tinyvec", + "tokio", "tracing", "url", ] @@ -4818,6 +5461,7 @@ dependencies = [ "resolv-conf", "smallvec", "thiserror", + "tokio", "tracing", "trust-dns-proto 0.22.0", ] @@ -4828,6 +5472,25 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" +[[package]] +name = "turn" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4712ee30d123ec7ae26d1e1b218395a16c87cdbaf4b3925d170d684af62ea5e8" +dependencies = [ + "async-trait", + "base64", + "futures", + "log", + "md-5", + "rand 0.8.5", + "ring", + "stun", + "thiserror", + "tokio", + "webrtc-util", +] + [[package]] name = "typenum" version = "1.15.0" @@ -4904,6 +5567,15 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "uuid" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "422ee0de9031b5b948b97a8fc04e3aa35230001a722ddd27943e0be31564ce4c" +dependencies = [ + "getrandom 0.2.8", +] + [[package]] name = "value-bag" version = "1.0.0-alpha.9" @@ -4932,6 +5604,15 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +[[package]] +name = "waitgroup" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1f50000a783467e6c0200f9d10642f4bc424e39efc1b770203e88b488f79292" +dependencies = [ + "atomic-waker", +] + [[package]] name = "waker-fn" version = "1.1.0" @@ -5036,6 +5717,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webpki" +version = "0.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "webpki" version = "0.22.0" @@ -5052,7 +5743,221 @@ version = "0.22.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "368bfe657969fb01238bb756d351dcade285e0f6fcbd36dcb23359a5169975be" dependencies = [ - "webpki", + "webpki 0.22.0", +] + +[[package]] +name = "webrtc" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d3bc9049bdb2cea52f5fd4f6f728184225bdb867ed0dc2410eab6df5bdd67bb" +dependencies = [ + "arc-swap", + "async-trait", + "bytes", + "hex", + "interceptor", + "lazy_static", + "log", + "pem", + "rand 0.8.5", + "rcgen 0.9.3", + "regex", + "ring", + "rtcp", + "rtp", + "rustls 0.19.1", + "sdp", + "serde", + "serde_json", + "sha2 0.10.6", + "stun", + "thiserror", + "time", + "tokio", + "turn", + "url", + "waitgroup", + "webrtc-data", + "webrtc-dtls", + "webrtc-ice", + "webrtc-mdns", + "webrtc-media", + "webrtc-sctp", + "webrtc-srtp", + "webrtc-util", +] + +[[package]] +name = "webrtc-data" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ef36a4d12baa6e842582fe9ec16a57184ba35e1a09308307b67d43ec8883100" +dependencies = [ + "bytes", + "derive_builder", + "log", + "thiserror", + "tokio", + "webrtc-sctp", + "webrtc-util", +] + +[[package]] +name = "webrtc-dtls" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7021987ae0a2ed6c8cd33f68e98e49bb6e74ffe9543310267b48a1bbe3900e5f" +dependencies = [ + "aes 0.6.0", + "aes-gcm 0.8.0", + "async-trait", + "bincode", + "block-modes", + "byteorder", + "ccm", + "curve25519-dalek 3.2.0", + "der-parser 8.1.0", + "elliptic-curve", + "hkdf", + "hmac 0.10.1", + "log", + "oid-registry 0.6.0", + "p256", + "p384", + "pem", + "rand 0.8.5", + "rand_core 0.6.4", + "rcgen 0.9.3", + "ring", + "rustls 0.19.1", + "sec1", + "serde", + "sha-1", + "sha2 0.9.9", + "signature", + "subtle", + "thiserror", + "tokio", + "webpki 0.21.4", + "webrtc-util", + "x25519-dalek 2.0.0-pre.1", + "x509-parser 0.13.2", +] + +[[package]] +name = "webrtc-ice" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "494483fbb2f5492620871fdc78b084aed8807377f6e3fe88b2e49f0a9c9c41d7" +dependencies = [ + "arc-swap", + "async-trait", + "crc", + "log", + "rand 0.8.5", + "serde", + "serde_json", + "stun", + "thiserror", + "tokio", + "turn", + "url", + "uuid", + "waitgroup", + "webrtc-mdns", + "webrtc-util", +] + +[[package]] +name = "webrtc-mdns" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2548ae970afc2ae8e0b0dbfdacd9602d426d4f0ff6cda4602a45c0fd7ceaa82a" +dependencies = [ + "log", + "socket2", + "thiserror", + "tokio", + "webrtc-util", +] + +[[package]] +name = "webrtc-media" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee2a3c157a040324e5049bcbd644ffc9079e6738fa2cfab2bcff64e5cc4c00d7" +dependencies = [ + "byteorder", + "bytes", + "derive_builder", + "displaydoc", + "rand 0.8.5", + "rtp", + "thiserror", + "webrtc-util", +] + +[[package]] +name = "webrtc-sctp" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d47adcd9427eb3ede33d5a7f3424038f63c965491beafcc20bc650a2f6679c0" +dependencies = [ + "arc-swap", + "async-trait", + "bytes", + "crc", + "log", + "rand 0.8.5", + "thiserror", + "tokio", + "webrtc-util", +] + +[[package]] +name = "webrtc-srtp" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6183edc4c1c6c0175f8812eefdce84dfa0aea9c3ece71c2bf6ddd3c964de3da5" +dependencies = [ + "aead 0.4.3", + "aes 0.7.5", + "aes-gcm 0.9.4", + "async-trait", + "byteorder", + "bytes", + "ctr 0.8.0", + "hmac 0.11.0", + "log", + "rtcp", + "rtp", + "sha-1", + "subtle", + "thiserror", + "tokio", + "webrtc-util", +] + +[[package]] +name = "webrtc-util" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93f1db1727772c05cf7a2cfece52c3aca8045ca1e176cd517d323489aa3c6d87" +dependencies = [ + "async-trait", + "bitflags", + "bytes", + "cc", + "ipnet", + "lazy_static", + "libc", + "log", + "nix", + "rand 0.8.5", + "thiserror", + "tokio", + "winapi", ] [[package]] @@ -5212,15 +6117,6 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" -[[package]] -name = "winreg" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" -dependencies = [ - "winapi", -] - [[package]] name = "winreg" version = "0.10.1" @@ -5241,19 +6137,49 @@ dependencies = [ "zeroize", ] +[[package]] +name = "x25519-dalek" +version = "2.0.0-pre.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5da623d8af10a62342bcbbb230e33e58a63255a58012f8653c578e54bab48df" +dependencies = [ + "curve25519-dalek 3.2.0", + "rand_core 0.6.4", + "zeroize", +] + +[[package]] +name = "x509-parser" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb9bace5b5589ffead1afb76e43e34cff39cd0f3ce7e170ae0c29e53b88eb1c" +dependencies = [ + "asn1-rs 0.3.1", + "base64", + "data-encoding", + "der-parser 7.0.0", + "lazy_static", + "nom", + "oid-registry 0.4.0", + "ring", + "rusticata-macros", + "thiserror", + "time", +] + [[package]] name = "x509-parser" version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e0ecbeb7b67ce215e40e3cc7f2ff902f94a223acf44995934763467e7b1febc8" dependencies = [ - "asn1-rs", + "asn1-rs 0.5.1", "base64", "data-encoding", - "der-parser", + "der-parser 8.1.0", "lazy_static", "nom", - "oid-registry", + "oid-registry 0.6.0", "rusticata-macros", "thiserror", "time", diff --git a/ping/rust/Cargo.toml b/ping/rust/Cargo.toml index 4a9850606..9c39b0460 100644 --- a/ping/rust/Cargo.toml +++ b/ping/rust/Cargo.toml @@ -31,5 +31,6 @@ libp2pv0490 = { package = "libp2p", version = "0.49.0", features = ["websocket", [dependencies."libp2pv0500"] package = "libp2p" git = "https://github.com/libp2p/rust-libp2p" -rev = "368705a1465c4322948d14ee46d42475c472ca1e" # This should usually point to a commit on master. -features = ["websocket", "mplex", "yamux", "tcp", "ping", "noise", "dns", "async-std", "rsa", "macros"] +#path = "../../../rust-libp2p" +rev = "6d49bf4a532dc2399bdf7e3bca30529d762abcc4" # This should usually point to a commit on master. +features = ["websocket", "mplex", "yamux", "tcp", "ping", "noise", "dns", "tokio", "rsa", "macros", "webrtc"] diff --git a/ping/rust/src/bin/testplan_0500.rs b/ping/rust/src/bin/testplan_0500.rs index 6e602445d..cd7959bf3 100644 --- a/ping/rust/src/bin/testplan_0500.rs +++ b/ping/rust/src/bin/testplan_0500.rs @@ -2,32 +2,45 @@ use anyhow::Result; use async_trait::async_trait; use futures::StreamExt; use libp2pv0500::swarm::{keep_alive, NetworkBehaviour, SwarmEvent}; -use libp2pv0500::*; +use libp2pv0500::{tokio_development_transport,webrtc}; +use libp2pv0490::*; +use rand::thread_rng; use std::collections::HashSet; +use std::env; use std::time::Duration; -use testplan::{run_ping, PingSwarm}; +use testplan::*; #[async_std::main] async fn main() -> Result<()> { let local_key = identity::Keypair::generate_ed25519(); let local_peer_id = PeerId::from(local_key.public()); - + let transport_env = env::var("TRANSPORT").unwrap_or_else(|_|"tcp".to_string()); + let transport = match transport_env.trim() { + "tcp" => tokio_development_transport(local_key).await?, + "webrtc" => webrtc::tokio::Transport::new( + local_key, + webrtc::tokio::Certificate::generate(&mut thread_rng())?, + ), + unhandled => unimplemented!("Transport unhandled in test: {}", unhandled), + }; let swarm = OrphanRuleWorkaround(Swarm::new( - development_transport(local_key).await?, + transport, Behaviour { keep_alive: keep_alive::Behaviour, ping: ping::Behaviour::new(ping::Config::new().with_interval(Duration::from_secs(1))), }, local_peer_id, )); - - run_ping(swarm).await?; + match transport_env.trim() { + "tcp" => run_ping(swarm).await?, + "webrtc" => run_ping_with_ma_pattern(swarm, "/ip4/ip4_address/udp/listening_port/webrtc".to_string()).await?, + unhandled => unimplemented!("Transport unhandled in test: {}", unhandled), + } Ok(()) } -#[derive(NetworkBehaviour)] -#[behaviour(prelude = "libp2pv0500::swarm::derive_prelude")] +// #[behaviour(prelude = "libp2pv0500::swarm::derive_prelude")] struct Behaviour { keep_alive: keep_alive::Behaviour, ping: ping::Behaviour, diff --git a/ping/rust/src/lib.rs b/ping/rust/src/lib.rs index c6f79ec04..aa9c58a30 100644 --- a/ping/rust/src/lib.rs +++ b/ping/rust/src/lib.rs @@ -10,7 +10,7 @@ use testground::network_conf::{ FilterAction, LinkShape, NetworkConfiguration, RoutingPolicyType, DEFAULT_DATA_NETWORK, }; -const LISTENING_PORT: u16 = 1234; +const LISTENING_PORT: &str = "1234"; #[async_trait::async_trait] pub trait PingSwarm: Sized { @@ -27,16 +27,21 @@ pub trait PingSwarm: Sized { fn local_peer_id(&self) -> String; } -pub async fn run_ping(mut swarm: S) -> Result<()> -where - S: PingSwarm, +pub async fn run_ping(swarm: S) -> Result<()> + where + S: PingSwarm, +{ + run_ping_with_ma_pattern(swarm, format!("/ip4/ip4_address/tcp/listening_port")).await +} +pub async fn run_ping_with_ma_pattern(mut swarm: S, ma_pattern: String) -> Result<()> + where + S: PingSwarm, { info!("Running ping test: {}", swarm.local_peer_id()); env_logger::Builder::from_env(Env::default().default_filter_or("info")).init(); let client = testground::client::Client::new_and_init().await.unwrap(); - let local_addr = match if_addrs::get_if_addrs() .unwrap() .into_iter() @@ -45,7 +50,7 @@ where .addr .ip() { - std::net::IpAddr::V4(addr) => format!("/ip4/{addr}/tcp/{LISTENING_PORT}"), + std::net::IpAddr::V4(addr) => ma_pattern.replace("ip4_address", addr.to_string().as_str()).replace("listening_port",LISTENING_PORT), std::net::IpAddr::V6(_) => unimplemented!(), }; From 65117e18041bbf6e200f9916535682044c1bccd3 Mon Sep 17 00:00:00 2001 From: John Turpish Date: Mon, 28 Nov 2022 17:47:32 -0500 Subject: [PATCH 02/24] squash! Merge remote-tracking branch 'up/master' into jt/82_webrtcinrustping checkpoint --- ping/rust/src/bin/testplan_0500.rs | 62 ++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 21 deletions(-) diff --git a/ping/rust/src/bin/testplan_0500.rs b/ping/rust/src/bin/testplan_0500.rs index cd7959bf3..2800093f5 100644 --- a/ping/rust/src/bin/testplan_0500.rs +++ b/ping/rust/src/bin/testplan_0500.rs @@ -3,44 +3,64 @@ use async_trait::async_trait; use futures::StreamExt; use libp2pv0500::swarm::{keep_alive, NetworkBehaviour, SwarmEvent}; use libp2pv0500::{tokio_development_transport,webrtc}; -use libp2pv0490::*; +use libp2pv0500::*; use rand::thread_rng; use std::collections::HashSet; use std::env; use std::time::Duration; use testplan::*; +use crate::core::transport::Boxed; #[async_std::main] async fn main() -> Result<()> { let local_key = identity::Keypair::generate_ed25519(); let local_peer_id = PeerId::from(local_key.public()); let transport_env = env::var("TRANSPORT").unwrap_or_else(|_|"tcp".to_string()); - let transport = match transport_env.trim() { - "tcp" => tokio_development_transport(local_key).await?, - "webrtc" => webrtc::tokio::Transport::new( - local_key, - webrtc::tokio::Certificate::generate(&mut thread_rng())?, - ), - unhandled => unimplemented!("Transport unhandled in test: {}", unhandled), - }; - let swarm = OrphanRuleWorkaround(Swarm::new( - transport, - Behaviour { - keep_alive: keep_alive::Behaviour, - ping: ping::Behaviour::new(ping::Config::new().with_interval(Duration::from_secs(1))), + match transport_env.trim() { + "tcp" => { + let transport = tokio_development_transport(local_key)?; + let swarm = OrphanRuleWorkaround(Swarm::new( + transport, + Behaviour { + keep_alive: keep_alive::Behaviour, + ping: ping::Behaviour::new(ping::Config::new().with_interval(Duration::from_secs(1))), + }, + local_peer_id, + )); + match transport_env.trim() { + "tcp" => run_ping(swarm).await?, + "webrtc" => run_ping_with_ma_pattern(swarm, "/ip4/ip4_address/udp/listening_port/webrtc".to_string()).await?, + unhandled => unimplemented!("Transport unhandled in test: {}", unhandled), + } + }, + "webrtc" => { + let transport = webrtc::tokio::Transport::new( + local_key, + webrtc::tokio::Certificate::generate(&mut thread_rng())?, + ).boxed(); + let swarm = OrphanRuleWorkaround(Swarm::new( + transport, + Behaviour { + keep_alive: keep_alive::Behaviour, + ping: ping::Behaviour::new(ping::Config::new().with_interval(Duration::from_secs(1))), + }, + local_peer_id, + )); + match transport_env.trim() { + "tcp" => run_ping(swarm).await?, + "webrtc" => run_ping_with_ma_pattern(swarm, "/ip4/ip4_address/udp/listening_port/webrtc".to_string()).await?, + unhandled => unimplemented!("Transport unhandled in test: {}", unhandled), + } }, - local_peer_id, - )); - match transport_env.trim() { - "tcp" => run_ping(swarm).await?, - "webrtc" => run_ping_with_ma_pattern(swarm, "/ip4/ip4_address/udp/listening_port/webrtc".to_string()).await?, unhandled => unimplemented!("Transport unhandled in test: {}", unhandled), - } + }; Ok(()) } -// #[behaviour(prelude = "libp2pv0500::swarm::derive_prelude")] + +#[derive(NetworkBehaviour)] +#[behaviour(prelude = "libp2pv0500::swarm::derive_prelude")] struct Behaviour { keep_alive: keep_alive::Behaviour, ping: ping::Behaviour, From 54466ddcc07413ec950752d5246fe4928e215fba Mon Sep 17 00:00:00 2001 From: John Turpish Date: Tue, 29 Nov 2022 10:12:49 -0500 Subject: [PATCH 03/24] compiles... --- ping/rust/src/bin/testplan_0500.rs | 59 ++++++++++++------------------ 1 file changed, 23 insertions(+), 36 deletions(-) diff --git a/ping/rust/src/bin/testplan_0500.rs b/ping/rust/src/bin/testplan_0500.rs index 2800093f5..b33943cc2 100644 --- a/ping/rust/src/bin/testplan_0500.rs +++ b/ping/rust/src/bin/testplan_0500.rs @@ -9,51 +9,38 @@ use std::collections::HashSet; use std::env; use std::time::Duration; use testplan::*; -use crate::core::transport::Boxed; +use crate::core::{ + muxing::StreamMuxerBox, + // transport::Boxed, +}; #[async_std::main] async fn main() -> Result<()> { let local_key = identity::Keypair::generate_ed25519(); let local_peer_id = PeerId::from(local_key.public()); let transport_env = env::var("TRANSPORT").unwrap_or_else(|_|"tcp".to_string()); - match transport_env.trim() { - "tcp" => { - let transport = tokio_development_transport(local_key)?; - let swarm = OrphanRuleWorkaround(Swarm::new( - transport, - Behaviour { - keep_alive: keep_alive::Behaviour, - ping: ping::Behaviour::new(ping::Config::new().with_interval(Duration::from_secs(1))), - }, - local_peer_id, - )); - match transport_env.trim() { - "tcp" => run_ping(swarm).await?, - "webrtc" => run_ping_with_ma_pattern(swarm, "/ip4/ip4_address/udp/listening_port/webrtc".to_string()).await?, - unhandled => unimplemented!("Transport unhandled in test: {}", unhandled), - } - }, - "webrtc" => { - let transport = webrtc::tokio::Transport::new( + let transport = match transport_env.trim() { + "tcp" => tokio_development_transport(local_key)?, + "webrtc" => webrtc::tokio::Transport::new( local_key, - webrtc::tokio::Certificate::generate(&mut thread_rng())?, - ).boxed(); - let swarm = OrphanRuleWorkaround(Swarm::new( - transport, - Behaviour { - keep_alive: keep_alive::Behaviour, - ping: ping::Behaviour::new(ping::Config::new().with_interval(Duration::from_secs(1))), - }, - local_peer_id, - )); - match transport_env.trim() { - "tcp" => run_ping(swarm).await?, - "webrtc" => run_ping_with_ma_pattern(swarm, "/ip4/ip4_address/udp/listening_port/webrtc".to_string()).await?, - unhandled => unimplemented!("Transport unhandled in test: {}", unhandled), - } - }, + webrtc::tokio::Certificate::generate(&mut thread_rng())?) + .map(|(peer_id, conn), _| (peer_id, StreamMuxerBox::new(conn))) + .boxed(), unhandled => unimplemented!("Transport unhandled in test: {}", unhandled), }; + let swarm = OrphanRuleWorkaround(Swarm::with_tokio_executor( + transport, + Behaviour { + keep_alive: keep_alive::Behaviour, + ping: ping::Behaviour::new(ping::Config::new().with_interval(Duration::from_secs(1))), + }, + local_peer_id, + )); + match transport_env.trim() { + "tcp" => run_ping(swarm).await?, + "webrtc" => run_ping_with_ma_pattern(swarm, "/ip4/ip4_address/udp/listening_port/webrtc".to_string()).await?, + unhandled => unimplemented!("Transport unhandled in test: {}", unhandled), + } Ok(()) } From 2653436f19d9ccc435de2fe9024fac301644a15f Mon Sep 17 00:00:00 2001 From: John Turpish Date: Tue, 29 Nov 2022 17:30:54 -0500 Subject: [PATCH 04/24] unknown protocol string: webrtc --- ping/rust/Dockerfile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ping/rust/Dockerfile b/ping/rust/Dockerfile index 9406109bb..beb60fc3a 100644 --- a/ping/rust/Dockerfile +++ b/ping/rust/Dockerfile @@ -10,6 +10,7 @@ COPY ./plan/${PLAN_PATH}/src/main.rs ./plan/src/main.rs COPY ./plan/${PLAN_PATH}/Cargo.toml ./plan/Cargo.toml COPY ./plan/${PLAN_PATH}/Cargo.lock ./plan/Cargo.lock +RUN echo initial build RUN cd ./plan/ && cargo build # Initial build acts as a cache. ARG GIT_TARGET="" @@ -23,12 +24,14 @@ COPY ./plan/${PLAN_PATH}/src/bin/ ./plan/src/bin/ # Build the requested binary: Cargo will update lockfile on changed manifest (i.e. if one of the above `sed`s patched it). ARG BINARY_NAME -RUN cd ./plan/ \ - && cargo build --bin=${BINARY_NAME} \ - && mv /usr/src/testplan/plan/target/debug/${BINARY_NAME} /usr/local/bin/testplan +RUN echo BINARY_NAME=${BINARY_NAME} +RUN cd ./plan/ && cargo build --bin=${BINARY_NAME} +RUN cd ./plan/ && cargo build --bin=${BINARY_NAME} +RUN cd ./plan/ && mv /usr/src/testplan/plan/target/debug/${BINARY_NAME} /usr/local/bin/testplan FROM debian:bullseye-slim COPY --from=builder /usr/local/bin/testplan /usr/local/bin/testplan EXPOSE 6060 +ENV TRANSPORT=webrtc # TODO revert ENV RUST_BACKTRACE=1 ENTRYPOINT ["testplan"] From a9a4f1844718019045b41deb84225e204d37c662 Mon Sep 17 00:00:00 2001 From: John Turpish Date: Wed, 30 Nov 2022 11:05:24 -0500 Subject: [PATCH 05/24] Update Cargo.toml to pull in new release --- ping/rust/Cargo.lock | 605 +++++++++++++++++++++++++++++++++---------- ping/rust/Cargo.toml | 5 +- 2 files changed, 466 insertions(+), 144 deletions(-) diff --git a/ping/rust/Cargo.lock b/ping/rust/Cargo.lock index 462c20135..5ce12a65c 100644 --- a/ping/rust/Cargo.lock +++ b/ping/rust/Cargo.lock @@ -210,11 +210,11 @@ dependencies = [ [[package]] name = "async-channel" -version = "1.7.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14485364214912d3b19cc3435dde4df66065127f05fa0d75c712f36f12c2f28" +checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833" dependencies = [ - "concurrent-queue 1.2.4", + "concurrent-queue", "event-listener", "futures-core", ] @@ -227,7 +227,7 @@ checksum = "17adb73da160dfb475c183343c8cccd80721ea5a605d3eb57125f0a7b7a92d0b" dependencies = [ "async-lock", "async-task", - "concurrent-queue 2.0.0", + "concurrent-queue", "fastrand", "futures-lite", "slab", @@ -251,13 +251,13 @@ dependencies = [ [[package]] name = "async-io" -version = "1.10.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8121296a9f05be7f34aa4196b1747243b3b62e048bb7906f644f3fbfc490cf7" +checksum = "8c374dda1ed3e7d8f0d9ba58715f924862c63eae6849c92d3a18e7fbde9e2794" dependencies = [ "async-lock", "autocfg", - "concurrent-queue 1.2.4", + "concurrent-queue", "futures-lite", "libc", "log", @@ -266,7 +266,7 @@ dependencies = [ "slab", "socket2", "waker-fn", - "winapi", + "windows-sys", ] [[package]] @@ -281,20 +281,20 @@ dependencies = [ [[package]] name = "async-process" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02111fd8655a613c25069ea89fc8d9bb89331fa77486eb3bc059ee757cfa481c" +checksum = "6381ead98388605d0d9ff86371043b5aa922a3905824244de40dc263a14fcba4" dependencies = [ "async-io", + "async-lock", "autocfg", "blocking", "cfg-if", "event-listener", "futures-lite", "libc", - "once_cell", "signal-hook", - "winapi", + "windows-sys", ] [[package]] @@ -363,9 +363,9 @@ checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" [[package]] name = "async-trait" -version = "0.1.58" +version = "0.1.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e805d94e6b5001b651426cf4cd446b1ab5f319d27bab5c644f61de0a804360c" +checksum = "31e6e93155431f3931513b243d371981bb2770112b370c82745a1d19d2f99364" dependencies = [ "proc-macro2", "quote", @@ -501,16 +501,16 @@ checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" [[package]] name = "blocking" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6ccb65d468978a086b69884437ded69a90faab3bbe6e67f242173ea728acccc" +checksum = "3c67b173a56acffd6d2326fb7ab938ba0b00a71480e14902b2591c87bc5741e8" dependencies = [ "async-channel", + "async-lock", "async-task", "atomic-waker", "fastrand", "futures-lite", - "once_cell", ] [[package]] @@ -537,12 +537,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" -[[package]] -name = "cache-padded" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c" - [[package]] name = "cc" version = "1.0.77" @@ -665,15 +659,6 @@ dependencies = [ "cc", ] -[[package]] -name = "concurrent-queue" -version = "1.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af4780a44ab5696ea9e28294517f1fffb421a83a25af521333c838635509db9c" -dependencies = [ - "cache-padded", -] - [[package]] name = "concurrent-queue" version = "2.0.0" @@ -1178,9 +1163,9 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.24" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" +checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" dependencies = [ "crc32fast", "libz-sys", @@ -1378,9 +1363,9 @@ dependencies = [ [[package]] name = "gloo-timers" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fb7d06c1c8cc2a29bee7ec961009a0b2caa0793ee4900c2ffb348734ba1c8f9" +checksum = "98c4a8d6391675c6b2ee1a6c8d06e8e2d03605c44cec1270675985a4c2a5500b" dependencies = [ "futures-channel", "futures-core", @@ -1982,26 +1967,56 @@ dependencies = [ [[package]] name = "libp2p" version = "0.50.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e0a0d2f693675f49ded13c5d510c48b78069e23cbd9108d7ccd59f6dc568819" +dependencies = [ + "bytes", + "futures", + "futures-timer", + "getrandom 0.2.8", + "instant", + "libp2p-core 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-dns 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-mdns 0.42.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-metrics 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-mplex 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-noise 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-ping 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-quic 0.7.0-alpha (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-swarm 0.41.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-tcp 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-webrtc 0.4.0-alpha (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-websocket 0.40.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-yamux 0.42.0 (registry+https://github.com/rust-lang/crates.io-index)", + "multiaddr 0.16.0", + "parking_lot", + "pin-project 1.0.12", + "smallvec", +] + +[[package]] +name = "libp2p" +version = "0.50.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35#be0b62a78fe9d72811b9eda742137cc8ddc4da35" dependencies = [ "bytes", "futures", "futures-timer", "getrandom 0.2.8", "instant", - "libp2p-core 0.38.0", - "libp2p-dns 0.38.0", - "libp2p-mdns 0.42.0", - "libp2p-metrics 0.11.0", - "libp2p-mplex 0.38.0", - "libp2p-noise 0.41.0", - "libp2p-ping 0.41.0", - "libp2p-quic", - "libp2p-swarm 0.41.0", - "libp2p-tcp 0.38.0", - "libp2p-webrtc", - "libp2p-websocket 0.40.0", - "libp2p-yamux 0.42.0", + "libp2p-core 0.38.0 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", + "libp2p-dns 0.38.0 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", + "libp2p-mdns 0.42.0 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", + "libp2p-metrics 0.11.0 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", + "libp2p-mplex 0.38.0 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", + "libp2p-noise 0.41.0 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", + "libp2p-ping 0.41.0 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", + "libp2p-quic 0.7.0-alpha (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", + "libp2p-swarm 0.41.1 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", + "libp2p-tcp 0.38.0 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", + "libp2p-webrtc 0.4.0-alpha (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", + "libp2p-websocket 0.40.0 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", + "libp2p-yamux 0.42.0 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", "multiaddr 0.16.0", "parking_lot", "pin-project 1.0.12", @@ -2131,8 +2146,8 @@ dependencies = [ "multistream-select 0.11.0", "parking_lot", "pin-project 1.0.12", - "prost 0.11.2", - "prost-build 0.11.2", + "prost 0.11.3", + "prost-build 0.11.3", "rand 0.8.5", "ring", "rw-stream-sink 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2165,8 +2180,8 @@ dependencies = [ "multistream-select 0.11.0", "parking_lot", "pin-project 1.0.12", - "prost 0.11.2", - "prost-build 0.11.2", + "prost 0.11.3", + "prost-build 0.11.3", "rand 0.8.5", "ring", "rw-stream-sink 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2196,14 +2211,49 @@ dependencies = [ "log", "multiaddr 0.14.0", "multihash", - "multistream-select 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "multistream-select 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot", + "pin-project 1.0.12", + "prost 0.11.3", + "prost-build 0.11.3", + "rand 0.8.5", + "ring", + "rw-stream-sink 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sha2 0.10.6", + "smallvec", + "thiserror", + "unsigned-varint", + "void", + "zeroize", +] + +[[package]] +name = "libp2p-core" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6a8fcd392ff67af6cc3f03b1426c41f7f26b6b9aff2dc632c1c56dd649e571f" +dependencies = [ + "asn1_der", + "bs58", + "ed25519-dalek", + "either", + "fnv", + "futures", + "futures-timer", + "instant", + "log", + "multiaddr 0.16.0", + "multihash", + "multistream-select 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "once_cell", "parking_lot", "pin-project 1.0.12", - "prost 0.11.2", - "prost-build 0.11.2", + "prost 0.11.3", + "prost-build 0.11.3", "rand 0.8.5", "ring", "rw-stream-sink 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sec1", "sha2 0.10.6", "smallvec", "thiserror", @@ -2215,7 +2265,7 @@ dependencies = [ [[package]] name = "libp2p-core" version = "0.38.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" +source = "git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35#be0b62a78fe9d72811b9eda742137cc8ddc4da35" dependencies = [ "asn1_der", "bs58", @@ -2228,15 +2278,16 @@ dependencies = [ "log", "multiaddr 0.16.0", "multihash", - "multistream-select 0.12.0 (git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4)", + "multistream-select 0.12.1 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", "once_cell", "parking_lot", "pin-project 1.0.12", - "prost 0.11.2", - "prost-build 0.11.2", + "prost 0.11.3", + "prost-build 0.11.3", "rand 0.8.5", "ring", - "rw-stream-sink 0.3.0 (git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4)", + "rw-stream-sink 0.3.0 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", + "sec1", "sha2 0.10.6", "smallvec", "thiserror", @@ -2337,10 +2388,24 @@ dependencies = [ [[package]] name = "libp2p-dns" version = "0.38.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e42a271c1b49f789b92f7fc87749fa79ce5c7bdc88cbdfacb818a4bca47fec5" +dependencies = [ + "futures", + "libp2p-core 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log", + "parking_lot", + "smallvec", + "trust-dns-resolver 0.22.0", +] + +[[package]] +name = "libp2p-dns" +version = "0.38.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35#be0b62a78fe9d72811b9eda742137cc8ddc4da35" dependencies = [ "futures", - "libp2p-core 0.38.0", + "libp2p-core 0.38.0 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", "log", "parking_lot", "smallvec", @@ -2370,13 +2435,33 @@ dependencies = [ [[package]] name = "libp2p-mdns" version = "0.42.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04f378264aade9872d6ccd315c0accc18be3a35d15fc1b9c36e5b6f983b62b5b" dependencies = [ "data-encoding", "futures", - "if-watch 2.0.0", - "libp2p-core 0.38.0", - "libp2p-swarm 0.41.0", + "if-watch 3.0.0", + "libp2p-core 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-swarm 0.41.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log", + "rand 0.8.5", + "smallvec", + "socket2", + "tokio", + "trust-dns-proto 0.22.0", + "void", +] + +[[package]] +name = "libp2p-mdns" +version = "0.42.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35#be0b62a78fe9d72811b9eda742137cc8ddc4da35" +dependencies = [ + "data-encoding", + "futures", + "if-watch 3.0.0", + "libp2p-core 0.38.0 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", + "libp2p-swarm 0.41.1 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", "log", "rand 0.8.5", "smallvec", @@ -2461,11 +2546,23 @@ dependencies = [ [[package]] name = "libp2p-metrics" version = "0.11.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ad8a64f29da86005c86a4d2728b8a0719e9b192f4092b609fd8790acb9dec55" +dependencies = [ + "libp2p-core 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-ping 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-swarm 0.41.1 (registry+https://github.com/rust-lang/crates.io-index)", + "prometheus-client 0.18.1", +] + +[[package]] +name = "libp2p-metrics" +version = "0.11.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35#be0b62a78fe9d72811b9eda742137cc8ddc4da35" dependencies = [ - "libp2p-core 0.38.0", - "libp2p-ping 0.41.0", - "libp2p-swarm 0.41.0", + "libp2p-core 0.38.0 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", + "libp2p-ping 0.41.0 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", + "libp2p-swarm 0.41.1 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", "prometheus-client 0.18.1", ] @@ -2580,12 +2677,30 @@ dependencies = [ [[package]] name = "libp2p-mplex" version = "0.38.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03805b44107aa013e7cbbfa5627b31c36cbedfdfb00603c0311998882bc4bace" +dependencies = [ + "asynchronous-codec", + "bytes", + "futures", + "libp2p-core 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log", + "nohash-hasher", + "parking_lot", + "rand 0.8.5", + "smallvec", + "unsigned-varint", +] + +[[package]] +name = "libp2p-mplex" +version = "0.38.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35#be0b62a78fe9d72811b9eda742137cc8ddc4da35" dependencies = [ "asynchronous-codec", "bytes", "futures", - "libp2p-core 0.38.0", + "libp2p-core 0.38.0 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", "log", "nohash-hasher", "parking_lot", @@ -2672,8 +2787,8 @@ dependencies = [ "lazy_static", "libp2p-core 0.35.1", "log", - "prost 0.11.2", - "prost-build 0.11.2", + "prost 0.11.3", + "prost-build 0.11.3", "rand 0.8.5", "sha2 0.10.6", "snow", @@ -2694,8 +2809,8 @@ dependencies = [ "lazy_static", "libp2p-core 0.36.0", "log", - "prost 0.11.2", - "prost-build 0.11.2", + "prost 0.11.3", + "prost-build 0.11.3", "rand 0.8.5", "sha2 0.10.6", "snow", @@ -2716,12 +2831,35 @@ dependencies = [ "lazy_static", "libp2p-core 0.37.0", "log", - "prost 0.11.2", - "prost-build 0.11.2", + "prost 0.11.3", + "prost-build 0.11.3", + "rand 0.8.5", + "sha2 0.10.6", + "snow", + "static_assertions", + "x25519-dalek 1.1.1", + "zeroize", +] + +[[package]] +name = "libp2p-noise" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a978cb57efe82e892ec6f348a536bfbd9fee677adbe5689d7a93ad3a9bffbf2e" +dependencies = [ + "bytes", + "curve25519-dalek 3.2.0", + "futures", + "libp2p-core 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log", + "once_cell", + "prost 0.11.3", + "prost-build 0.11.3", "rand 0.8.5", "sha2 0.10.6", "snow", "static_assertions", + "thiserror", "x25519-dalek 1.1.1", "zeroize", ] @@ -2729,20 +2867,21 @@ dependencies = [ [[package]] name = "libp2p-noise" version = "0.41.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" +source = "git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35#be0b62a78fe9d72811b9eda742137cc8ddc4da35" dependencies = [ "bytes", "curve25519-dalek 3.2.0", "futures", - "libp2p-core 0.38.0", + "libp2p-core 0.38.0 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", "log", "once_cell", - "prost 0.11.2", - "prost-build 0.11.2", + "prost 0.11.3", + "prost-build 0.11.3", "rand 0.8.5", "sha2 0.10.6", "snow", "static_assertions", + "thiserror", "x25519-dalek 1.1.1", "zeroize", ] @@ -2846,13 +2985,29 @@ dependencies = [ [[package]] name = "libp2p-ping" version = "0.41.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "929fcace45a112536e22b3dcfd4db538723ef9c3cb79f672b98be2cc8e25f37f" +dependencies = [ + "futures", + "futures-timer", + "instant", + "libp2p-core 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-swarm 0.41.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log", + "rand 0.8.5", + "void", +] + +[[package]] +name = "libp2p-ping" +version = "0.41.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35#be0b62a78fe9d72811b9eda742137cc8ddc4da35" dependencies = [ "futures", "futures-timer", "instant", - "libp2p-core 0.38.0", - "libp2p-swarm 0.41.0", + "libp2p-core 0.38.0 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", + "libp2p-swarm 0.41.1 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", "log", "rand 0.8.5", "void", @@ -2861,14 +3016,35 @@ dependencies = [ [[package]] name = "libp2p-quic" version = "0.7.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01e7c867e95c8130667b24409d236d37598270e6da69b3baf54213ba31ffca59" +dependencies = [ + "bytes", + "futures", + "futures-timer", + "if-watch 3.0.0", + "libp2p-core 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-tls 0.1.0-alpha (registry+https://github.com/rust-lang/crates.io-index)", + "log", + "parking_lot", + "quinn-proto", + "rand 0.8.5", + "rustls 0.20.7", + "thiserror", + "tokio", +] + +[[package]] +name = "libp2p-quic" +version = "0.7.0-alpha" +source = "git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35#be0b62a78fe9d72811b9eda742137cc8ddc4da35" dependencies = [ "bytes", "futures", "futures-timer", "if-watch 3.0.0", - "libp2p-core 0.38.0", - "libp2p-tls", + "libp2p-core 0.38.0 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", + "libp2p-tls 0.1.0-alpha (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", "log", "parking_lot", "quinn-proto", @@ -3000,16 +3176,38 @@ dependencies = [ [[package]] name = "libp2p-swarm" -version = "0.41.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" +version = "0.41.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a35472fe3276b3855c00f1c032ea8413615e030256429ad5349cdf67c6e1a0" +dependencies = [ + "either", + "fnv", + "futures", + "futures-timer", + "instant", + "libp2p-core 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-swarm-derive 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log", + "pin-project 1.0.12", + "rand 0.8.5", + "smallvec", + "thiserror", + "tokio", + "void", +] + +[[package]] +name = "libp2p-swarm" +version = "0.41.1" +source = "git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35#be0b62a78fe9d72811b9eda742137cc8ddc4da35" dependencies = [ "either", "fnv", "futures", "futures-timer", "instant", - "libp2p-core 0.38.0", - "libp2p-swarm-derive 0.30.2", + "libp2p-core 0.38.0 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", + "libp2p-swarm-derive 0.31.0 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", "log", "pin-project 1.0.12", "rand 0.8.5", @@ -3063,8 +3261,19 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" -version = "0.30.2" -source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d527d5827582abd44a6d80c07ff8b50b4ee238a8979e05998474179e79dc400" +dependencies = [ + "heck 0.4.0", + "quote", + "syn", +] + +[[package]] +name = "libp2p-swarm-derive" +version = "0.31.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35#be0b62a78fe9d72811b9eda742137cc8ddc4da35" dependencies = [ "heck 0.4.0", "quote", @@ -3175,13 +3384,29 @@ dependencies = [ [[package]] name = "libp2p-tcp" version = "0.38.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4b257baf6df8f2df39678b86c578961d48cc8b68642a12f0f763f56c8e5858d" +dependencies = [ + "futures", + "futures-timer", + "if-watch 3.0.0", + "libc", + "libp2p-core 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log", + "socket2", + "tokio", +] + +[[package]] +name = "libp2p-tcp" +version = "0.38.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35#be0b62a78fe9d72811b9eda742137cc8ddc4da35" dependencies = [ "futures", "futures-timer", "if-watch 3.0.0", "libc", - "libp2p-core 0.38.0", + "libp2p-core 0.38.0 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", "log", "socket2", "tokio", @@ -3190,11 +3415,12 @@ dependencies = [ [[package]] name = "libp2p-tls" version = "0.1.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7905ce0d040576634e8a3229a7587cc8beab83f79db6023800f1792895defa8" dependencies = [ "futures", "futures-rustls", - "libp2p-core 0.38.0", + "libp2p-core 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", "rcgen 0.10.0", "ring", "rustls 0.20.7", @@ -3205,9 +3431,27 @@ dependencies = [ ] [[package]] -name = "libp2p-webrtc" +name = "libp2p-tls" version = "0.1.0-alpha" -source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" +source = "git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35#be0b62a78fe9d72811b9eda742137cc8ddc4da35" +dependencies = [ + "futures", + "futures-rustls", + "libp2p-core 0.38.0 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", + "rcgen 0.10.0", + "ring", + "rustls 0.20.7", + "thiserror", + "webpki 0.22.0", + "x509-parser 0.14.0", + "yasna", +] + +[[package]] +name = "libp2p-webrtc" +version = "0.4.0-alpha" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb6cd86dd68cba72308ea05de1cebf3ba0ae6e187c40548167955d4e3970f6a" dependencies = [ "async-trait", "asynchronous-codec", @@ -3215,14 +3459,44 @@ dependencies = [ "futures", "futures-timer", "hex", - "if-watch 2.0.0", - "libp2p-core 0.38.0", - "libp2p-noise 0.41.0", + "if-watch 3.0.0", + "libp2p-core 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-noise 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log", + "multihash", + "prost 0.11.3", + "prost-build 0.11.3", + "prost-codec 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.8.5", + "rcgen 0.9.3", + "serde", + "stun", + "thiserror", + "tinytemplate", + "tokio", + "tokio-util", + "webrtc", +] + +[[package]] +name = "libp2p-webrtc" +version = "0.4.0-alpha" +source = "git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35#be0b62a78fe9d72811b9eda742137cc8ddc4da35" +dependencies = [ + "async-trait", + "asynchronous-codec", + "bytes", + "futures", + "futures-timer", + "hex", + "if-watch 3.0.0", + "libp2p-core 0.38.0 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", + "libp2p-noise 0.41.0 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", "log", "multihash", - "prost 0.11.2", - "prost-build 0.11.2", - "prost-codec", + "prost 0.11.3", + "prost-build 0.11.3", + "prost-codec 0.3.0 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", "rand 0.8.5", "rcgen 0.9.3", "serde", @@ -3350,16 +3624,35 @@ dependencies = [ [[package]] name = "libp2p-websocket" version = "0.40.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d705506030d5c0aaf2882437c70dab437605f21c5f9811978f694e6917a3b54" +dependencies = [ + "either", + "futures", + "futures-rustls", + "libp2p-core 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log", + "parking_lot", + "quicksink", + "rw-stream-sink 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "soketto", + "url", + "webpki-roots", +] + +[[package]] +name = "libp2p-websocket" +version = "0.40.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35#be0b62a78fe9d72811b9eda742137cc8ddc4da35" dependencies = [ "either", "futures", "futures-rustls", - "libp2p-core 0.38.0", + "libp2p-core 0.38.0 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", "log", "parking_lot", "quicksink", - "rw-stream-sink 0.3.0 (git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4)", + "rw-stream-sink 0.3.0 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", "soketto", "url", "webpki-roots", @@ -3447,10 +3740,24 @@ dependencies = [ [[package]] name = "libp2p-yamux" version = "0.42.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f63594a0aa818642d9d4915c791945053877253f08a3626f13416b5cd928a29" +dependencies = [ + "futures", + "libp2p-core 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log", + "parking_lot", + "thiserror", + "yamux", +] + +[[package]] +name = "libp2p-yamux" +version = "0.42.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35#be0b62a78fe9d72811b9eda742137cc8ddc4da35" dependencies = [ "futures", - "libp2p-core 0.38.0", + "libp2p-core 0.38.0 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", "log", "parking_lot", "thiserror", @@ -3553,9 +3860,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.5.4" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34" +checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" dependencies = [ "adler", ] @@ -3668,9 +3975,9 @@ dependencies = [ [[package]] name = "multistream-select" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bc41247ec209813e2fd414d6e16b9d94297dacf3cd613fa6ef09cd4d9755c10" +checksum = "c8552ab875c1313b97b8d20cb857b9fd63e2d1d6a0a1b53ce9821e575405f27a" dependencies = [ "bytes", "futures", @@ -3682,8 +3989,8 @@ dependencies = [ [[package]] name = "multistream-select" -version = "0.12.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" +version = "0.12.1" +source = "git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35#be0b62a78fe9d72811b9eda742137cc8ddc4da35" dependencies = [ "bytes", "futures", @@ -3913,9 +4220,9 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" +checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba" dependencies = [ "cfg-if", "libc", @@ -4040,16 +4347,16 @@ checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" [[package]] name = "polling" -version = "2.4.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab4609a838d88b73d8238967b60dd115cc08d38e2bbaf51ee1e4b695f89122e2" +checksum = "166ca89eb77fd403230b9c156612965a81e094ec6ec3aa13663d4c8b113fa748" dependencies = [ "autocfg", "cfg-if", "libc", "log", "wepoll-ffi", - "winapi", + "windows-sys", ] [[package]] @@ -4225,9 +4532,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0841812012b2d4a6145fae9a6af1534873c32aa67fff26bd09f8fa42c83f95a" +checksum = "c0b18e655c21ff5ac2084a5ad0611e827b3f92badf79f4910b5a5c58f4d87ff0" dependencies = [ "bytes", "prost-derive 0.11.2", @@ -4277,9 +4584,9 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d8b442418ea0822409d9e7d047cbf1e7e9e1760b172bf9982cf29d517c93511" +checksum = "e330bf1316db56b12c2bcfa399e8edddd4821965ea25ddb2c134b610b1c1c604" dependencies = [ "bytes", "heck 0.4.0", @@ -4289,7 +4596,7 @@ dependencies = [ "multimap", "petgraph", "prettyplease", - "prost 0.11.2", + "prost 0.11.3", "prost-types 0.11.2", "regex", "syn", @@ -4300,11 +4607,24 @@ dependencies = [ [[package]] name = "prost-codec" version = "0.3.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc34979ff898b6e141106178981ce2596c387ea6e62533facfc61a37fc879c0" +dependencies = [ + "asynchronous-codec", + "bytes", + "prost 0.11.3", + "thiserror", + "unsigned-varint", +] + +[[package]] +name = "prost-codec" +version = "0.3.0" +source = "git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35#be0b62a78fe9d72811b9eda742137cc8ddc4da35" dependencies = [ "asynchronous-codec", "bytes", - "prost 0.11.2", + "prost 0.11.3", "thiserror", "unsigned-varint", ] @@ -4375,7 +4695,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "747761bc3dc48f9a34553bf65605cf6cb6288ba219f3450b4275dbd81539551a" dependencies = [ "bytes", - "prost 0.11.2", + "prost 0.11.3", ] [[package]] @@ -4738,7 +5058,7 @@ dependencies = [ [[package]] name = "rw-stream-sink" version = "0.3.0" -source = "git+https://github.com/libp2p/rust-libp2p?rev=6d49bf4a532dc2399bdf7e3bca30529d762abcc4#6d49bf4a532dc2399bdf7e3bca30529d762abcc4" +source = "git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35#be0b62a78fe9d72811b9eda742137cc8ddc4da35" dependencies = [ "futures", "pin-project 1.0.12", @@ -4811,18 +5131,18 @@ checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" [[package]] name = "serde" -version = "1.0.147" +version = "1.0.148" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" +checksum = "e53f64bb4ba0191d6d0676e1b141ca55047d83b74f5607e6d8eb88126c52c2dc" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.147" +version = "1.0.148" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" +checksum = "a55492425aa53521babf6137309e7d34c20bbfbbfcfe2c7f3a047fd1f6b92c0c" dependencies = [ "proc-macro2", "quote", @@ -5079,9 +5399,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.103" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" +checksum = "4ae548ec36cf198c0ef7710d3c230987c2d6d7bd98ad6edc0274462724c585ce" dependencies = [ "proc-macro2", "quote", @@ -5183,7 +5503,8 @@ dependencies = [ "libp2p 0.47.0", "libp2p 0.48.0", "libp2p 0.49.0", - "libp2p 0.50.0", + "libp2p 0.50.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p 0.50.0 (git+https://github.com/libp2p/rust-libp2p?rev=be0b62a78fe9d72811b9eda742137cc8ddc4da35)", "log", "rand 0.8.5", "serde_json", @@ -5295,9 +5616,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "1.8.0" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" +checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" dependencies = [ "proc-macro2", "quote", diff --git a/ping/rust/Cargo.toml b/ping/rust/Cargo.toml index dfeb77c58..acdea2e55 100644 --- a/ping/rust/Cargo.toml +++ b/ping/rust/Cargo.toml @@ -26,11 +26,12 @@ libp2pv0461 = { package = "libp2p", version = "0.46.1", default_features = false libp2pv0470 = { package = "libp2p", version = "0.47.0", default_features = false, features = ["websocket", "mplex", "yamux", "tcp-async-io", "ping", "noise", "dns-async-std"] } libp2pv0480 = { package = "libp2p", version = "0.48.0", default_features = false, features = ["websocket", "mplex", "yamux", "tcp-async-io", "ping", "noise", "dns-async-std", "rsa"] } libp2pv0490 = { package = "libp2p", version = "0.49.0", features = ["websocket", "mplex", "yamux", "tcp", "async-std", "ping", "noise", "dns", "rsa"] } +libp2pv0500 = { package = "libp2p", version = "0.50.0", features = ["websocket", "mplex", "yamux", "tcp", "ping", "noise", "dns", "tokio", "rsa", "macros", "webrtc"] } # Next release -[dependencies."libp2pv0500"] +[dependencies."libp2pv0510"] package = "libp2p" git = "https://github.com/libp2p/rust-libp2p" #path = "../../../rust-libp2p" -rev = "6d49bf4a532dc2399bdf7e3bca30529d762abcc4" # This should usually point to a commit on master. +rev = "be0b62a78fe9d72811b9eda742137cc8ddc4da35" # This should usually point to a commit on master. features = ["websocket", "mplex", "yamux", "tcp", "ping", "noise", "dns", "tokio", "rsa", "macros", "webrtc"] From 79b4441925d015554d19691dba7bf581deeed26d Mon Sep 17 00:00:00 2001 From: John Turpish Date: Wed, 30 Nov 2022 18:47:28 -0500 Subject: [PATCH 06/24] hold --- ping/rust/Cargo.toml | 1 + ping/rust/Dockerfile | 6 ++++-- ping/rust/src/bin/testplan_0500.rs | 21 ++++++++++++--------- ping/rust/src/lib.rs | 1 + 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/ping/rust/Cargo.toml b/ping/rust/Cargo.toml index acdea2e55..fef33c715 100644 --- a/ping/rust/Cargo.toml +++ b/ping/rust/Cargo.toml @@ -10,6 +10,7 @@ async-std = { version = "1.10", features = ["attributes", "tokio1"] } env_logger = "0.9.0" if-addrs = "0.7.0" log = "0.4" +#multiaddr = "0.16.0" rand = "0.8" serde_json = "1" soketto = "0.7.1" diff --git a/ping/rust/Dockerfile b/ping/rust/Dockerfile index beb60fc3a..be4470576 100644 --- a/ping/rust/Dockerfile +++ b/ping/rust/Dockerfile @@ -26,12 +26,14 @@ COPY ./plan/${PLAN_PATH}/src/bin/ ./plan/src/bin/ ARG BINARY_NAME RUN echo BINARY_NAME=${BINARY_NAME} RUN cd ./plan/ && cargo build --bin=${BINARY_NAME} -RUN cd ./plan/ && cargo build --bin=${BINARY_NAME} RUN cd ./plan/ && mv /usr/src/testplan/plan/target/debug/${BINARY_NAME} /usr/local/bin/testplan FROM debian:bullseye-slim COPY --from=builder /usr/local/bin/testplan /usr/local/bin/testplan EXPOSE 6060 -ENV TRANSPORT=webrtc # TODO revert + +#TODO revert +ENV UNIQUELY_NAMED_ENV=webrtc + ENV RUST_BACKTRACE=1 ENTRYPOINT ["testplan"] diff --git a/ping/rust/src/bin/testplan_0500.rs b/ping/rust/src/bin/testplan_0500.rs index b33943cc2..269171f75 100644 --- a/ping/rust/src/bin/testplan_0500.rs +++ b/ping/rust/src/bin/testplan_0500.rs @@ -3,22 +3,23 @@ use async_trait::async_trait; use futures::StreamExt; use libp2pv0500::swarm::{keep_alive, NetworkBehaviour, SwarmEvent}; use libp2pv0500::{tokio_development_transport,webrtc}; +use libp2pv0500::core::multiaddr::*; +use libp2pv0500::core::muxing::*; use libp2pv0500::*; use rand::thread_rng; -use std::collections::HashSet; -use std::env; -use std::time::Duration; -use testplan::*; -use crate::core::{ - muxing::StreamMuxerBox, - // transport::Boxed, +use std::{ + collections::HashSet, + env, + str::FromStr, + time::Duration, }; +use testplan::*; #[async_std::main] async fn main() -> Result<()> { let local_key = identity::Keypair::generate_ed25519(); let local_peer_id = PeerId::from(local_key.public()); - let transport_env = env::var("TRANSPORT").unwrap_or_else(|_|"tcp".to_string()); + let transport_env = env::var("UNIQUELY_NAMED_ENV").unwrap_or_else(|_|"tcp".to_string()); let transport = match transport_env.trim() { "tcp" => tokio_development_transport(local_key)?, "webrtc" => webrtc::tokio::Transport::new( @@ -36,9 +37,11 @@ async fn main() -> Result<()> { }, local_peer_id, )); + println!("Compiled as if using a recent version of multiaddr: {:?}", Multiaddr::from_str("/ip4/127.0.0.1/tcp/8080").expect("could not parse simple multiaddr").protocol_stack().collect::>()); + println!("Compiled as if using a webrtc-enabled recent version of multiaddr: {:?}", Multiaddr::from_str("/ip4/127.0.0.1/udp/8080/webrtc").expect("could not parse simple multiaddr").protocol_stack().collect::>()); match transport_env.trim() { "tcp" => run_ping(swarm).await?, - "webrtc" => run_ping_with_ma_pattern(swarm, "/ip4/ip4_address/udp/listening_port/webrtc".to_string()).await?, + "webrtc" => run_ping_with_ma_pattern(swarm, "/ip4/ip4_address/udp/listening_port/webrtc".to_string()).await?,//TODO certhash unhandled => unimplemented!("Transport unhandled in test: {}", unhandled), } diff --git a/ping/rust/src/lib.rs b/ping/rust/src/lib.rs index aa9c58a30..2627fed63 100644 --- a/ping/rust/src/lib.rs +++ b/ping/rust/src/lib.rs @@ -87,6 +87,7 @@ pub async fn run_ping_with_ma_pattern(mut swarm: S, ma_pattern: String) -> Re client.publish("peers", Cow::Owned(payload)).await?; while let Some(addr) = address_stream.next().await { + println!("About to dial: {}",&addr); swarm.dial(&addr).unwrap(); } From b1142124e6ede77d48586914c35cecbb3a67d4fc Mon Sep 17 00:00:00 2001 From: John Turpish Date: Fri, 2 Dec 2022 00:51:18 -0500 Subject: [PATCH 07/24] Restricting to webrtc-enabled versions to verify that. --- ping/_compositions/rust.toml | 38 +++++++++++++++++------------- ping/rust/Cargo.toml | 3 +-- ping/rust/Dockerfile | 4 ++-- ping/rust/src/bin/testplan_0490.rs | 1 + ping/rust/src/bin/testplan_0500.rs | 2 +- ping/rust/src/lib.rs | 18 ++++++++++---- 6 files changed, 40 insertions(+), 26 deletions(-) diff --git a/ping/_compositions/rust.toml b/ping/_compositions/rust.toml index e18cce173..a556e5cc1 100644 --- a/ping/_compositions/rust.toml +++ b/ping/_compositions/rust.toml @@ -5,25 +5,29 @@ BinaryName = 'testplan_0500' BinaryName = 'testplan_0500' [[groups]] -Id = '0.49.0' -BinaryName = 'testplan_0490' +Id = '0.50.0' +BinaryName = 'testplan_0500' -[[groups]] -Id = '0.48.0' -BinaryName = 'testplan_0480' +# [[groups]] +# Id = '0.49.0' +# BinaryName = 'testplan_0490' +# +# [[groups]] +# Id = '0.48.0' +# BinaryName = 'testplan_0480' -[[groups]] -Id = "v0.47.0" -BinaryName = 'testplan_0470' +# [[groups]] +# Id = "v0.47.0" +# BinaryName = 'testplan_0470' -[[groups]] -Id = "v0.46.1" -BinaryName = 'testplan_0461' +# [[groups]] +# Id = "v0.46.1" +# BinaryName = 'testplan_0461' -[[groups]] -Id = "v0.45.1" -BinaryName = 'testplan_0451' +# [[groups]] +# Id = "v0.45.1" +# BinaryName = 'testplan_0451' -[[groups]] -Id = "v0.44.0" -BinaryName = 'testplan_0440' +# [[groups]] +# Id = "v0.44.0" +# BinaryName = 'testplan_0440' diff --git a/ping/rust/Cargo.toml b/ping/rust/Cargo.toml index fef33c715..d31de7dc2 100644 --- a/ping/rust/Cargo.toml +++ b/ping/rust/Cargo.toml @@ -27,12 +27,11 @@ libp2pv0461 = { package = "libp2p", version = "0.46.1", default_features = false libp2pv0470 = { package = "libp2p", version = "0.47.0", default_features = false, features = ["websocket", "mplex", "yamux", "tcp-async-io", "ping", "noise", "dns-async-std"] } libp2pv0480 = { package = "libp2p", version = "0.48.0", default_features = false, features = ["websocket", "mplex", "yamux", "tcp-async-io", "ping", "noise", "dns-async-std", "rsa"] } libp2pv0490 = { package = "libp2p", version = "0.49.0", features = ["websocket", "mplex", "yamux", "tcp", "async-std", "ping", "noise", "dns", "rsa"] } -libp2pv0500 = { package = "libp2p", version = "0.50.0", features = ["websocket", "mplex", "yamux", "tcp", "ping", "noise", "dns", "tokio", "rsa", "macros", "webrtc"] } +libp2pv0500 = { package = "libp2p", version = "0.50.0", features = ["websocket", "mplex", "yamux", "tcp", "tokio", "ping", "noise", "dns", "rsa", "macros", "webrtc"] } # Next release [dependencies."libp2pv0510"] package = "libp2p" git = "https://github.com/libp2p/rust-libp2p" -#path = "../../../rust-libp2p" rev = "be0b62a78fe9d72811b9eda742137cc8ddc4da35" # This should usually point to a commit on master. features = ["websocket", "mplex", "yamux", "tcp", "ping", "noise", "dns", "tokio", "rsa", "macros", "webrtc"] diff --git a/ping/rust/Dockerfile b/ping/rust/Dockerfile index be4470576..7b8af34c5 100644 --- a/ping/rust/Dockerfile +++ b/ping/rust/Dockerfile @@ -26,7 +26,7 @@ COPY ./plan/${PLAN_PATH}/src/bin/ ./plan/src/bin/ ARG BINARY_NAME RUN echo BINARY_NAME=${BINARY_NAME} RUN cd ./plan/ && cargo build --bin=${BINARY_NAME} -RUN cd ./plan/ && mv /usr/src/testplan/plan/target/debug/${BINARY_NAME} /usr/local/bin/testplan +RUN cd ./plan/ && mv -v /usr/src/testplan/plan/target/debug/${BINARY_NAME} /usr/local/bin/testplan FROM debian:bullseye-slim COPY --from=builder /usr/local/bin/testplan /usr/local/bin/testplan @@ -35,5 +35,5 @@ EXPOSE 6060 #TODO revert ENV UNIQUELY_NAMED_ENV=webrtc -ENV RUST_BACKTRACE=1 +ENV RUST_BACKTRACE=full ENTRYPOINT ["testplan"] diff --git a/ping/rust/src/bin/testplan_0490.rs b/ping/rust/src/bin/testplan_0490.rs index 156e16b0c..10c21a82b 100644 --- a/ping/rust/src/bin/testplan_0490.rs +++ b/ping/rust/src/bin/testplan_0490.rs @@ -9,6 +9,7 @@ use testplan::{run_ping, PingSwarm}; #[async_std::main] async fn main() -> Result<()> { + println!("0.49.0"); let local_key = identity::Keypair::generate_ed25519(); let local_peer_id = PeerId::from(local_key.public()); diff --git a/ping/rust/src/bin/testplan_0500.rs b/ping/rust/src/bin/testplan_0500.rs index 269171f75..c09f39d08 100644 --- a/ping/rust/src/bin/testplan_0500.rs +++ b/ping/rust/src/bin/testplan_0500.rs @@ -17,6 +17,7 @@ use testplan::*; #[async_std::main] async fn main() -> Result<()> { + println!("0.50.0"); let local_key = identity::Keypair::generate_ed25519(); let local_peer_id = PeerId::from(local_key.public()); let transport_env = env::var("UNIQUELY_NAMED_ENV").unwrap_or_else(|_|"tcp".to_string()); @@ -37,7 +38,6 @@ async fn main() -> Result<()> { }, local_peer_id, )); - println!("Compiled as if using a recent version of multiaddr: {:?}", Multiaddr::from_str("/ip4/127.0.0.1/tcp/8080").expect("could not parse simple multiaddr").protocol_stack().collect::>()); println!("Compiled as if using a webrtc-enabled recent version of multiaddr: {:?}", Multiaddr::from_str("/ip4/127.0.0.1/udp/8080/webrtc").expect("could not parse simple multiaddr").protocol_stack().collect::>()); match transport_env.trim() { "tcp" => run_ping(swarm).await?, diff --git a/ping/rust/src/lib.rs b/ping/rust/src/lib.rs index 2627fed63..ae88fc60d 100644 --- a/ping/rust/src/lib.rs +++ b/ping/rust/src/lib.rs @@ -2,7 +2,7 @@ use anyhow::Result; use env_logger::Env; use futures::future::ready; use futures::{FutureExt, StreamExt}; -use log::info; +use log::{error, info}; use rand::Rng; use std::borrow::Cow; use std::time::Duration; @@ -31,13 +31,14 @@ pub async fn run_ping(swarm: S) -> Result<()> where S: PingSwarm, { + info!("info run_ping uses hard-coded tcp"); run_ping_with_ma_pattern(swarm, format!("/ip4/ip4_address/tcp/listening_port")).await } pub async fn run_ping_with_ma_pattern(mut swarm: S, ma_pattern: String) -> Result<()> where S: PingSwarm, { - info!("Running ping test: {}", swarm.local_peer_id()); + info!("info Running ping test: {} with pattern {}", swarm.local_peer_id(), &ma_pattern); env_logger::Builder::from_env(Env::default().default_filter_or("info")).init(); @@ -86,10 +87,19 @@ pub async fn run_ping_with_ma_pattern(mut swarm: S, ma_pattern: String) -> Re client.publish("peers", Cow::Owned(payload)).await?; + let mut dialed_count = 0; while let Some(addr) = address_stream.next().await { - println!("About to dial: {}",&addr); - swarm.dial(&addr).unwrap(); + info!("About to dial: {}",&addr); + match swarm.dial(&addr) { + Ok(()) => dialed_count += 1, + Err(e) => { + client.record_message(format!("Dial failure for {}: {:?}", addr,&e)); + info!("ERROR: could not dial {} : {:?}", &addr, e); + error!("ERROR: could not dial {} : {:?}", &addr, e); + }, + } } + assert_ne!(dialed_count,0); // Otherwise the testground background task gets blocked sending // subscription upgrades to the backpressured channel. From 2cc28e018f6b5eebd1317fd5b589a05e8d949553 Mon Sep 17 00:00:00 2001 From: John Turpish Date: Fri, 2 Dec 2022 01:21:26 -0500 Subject: [PATCH 08/24] switch to test_param. Currently taking its value only from default, and default is set to webrtc for my own sake ATM --- ping/rust/Dockerfile | 3 --- ping/rust/manifest.toml | 3 ++- ping/rust/src/bin/testplan_0440.rs | 4 ++-- ping/rust/src/bin/testplan_0451.rs | 4 ++-- ping/rust/src/bin/testplan_0461.rs | 4 ++-- ping/rust/src/bin/testplan_0470.rs | 4 ++-- ping/rust/src/bin/testplan_0480.rs | 4 ++-- ping/rust/src/bin/testplan_0490.rs | 4 ++-- ping/rust/src/bin/testplan_0500.rs | 22 +++++++++---------- ping/rust/src/lib.rs | 34 ++++++++++++++---------------- 10 files changed, 41 insertions(+), 45 deletions(-) diff --git a/ping/rust/Dockerfile b/ping/rust/Dockerfile index 7b8af34c5..937832c0f 100644 --- a/ping/rust/Dockerfile +++ b/ping/rust/Dockerfile @@ -32,8 +32,5 @@ FROM debian:bullseye-slim COPY --from=builder /usr/local/bin/testplan /usr/local/bin/testplan EXPOSE 6060 -#TODO revert -ENV UNIQUELY_NAMED_ENV=webrtc - ENV RUST_BACKTRACE=full ENTRYPOINT ["testplan"] diff --git a/ping/rust/manifest.toml b/ping/rust/manifest.toml index f87e77afe..3876bf72b 100644 --- a/ping/rust/manifest.toml +++ b/ping/rust/manifest.toml @@ -16,4 +16,5 @@ instances = { min = 2, max = 10000, default = 5 } [testcases.params] max_latency_ms = { type = "int", desc = "maximum value for random local link latency", unit = "ms", default = 1000 } - iterations = { type = "int", desc = "number of ping iterations we'll run against each peer", unit = "count", default = 5 } \ No newline at end of file + iterations = { type = "int", desc = "number of ping iterations we'll run against each peer", unit = "count", default = 5 } + transport = { type = "enum", desc = "transport used", values = ["tcp", "webrtc"], default = "webrtc" } diff --git a/ping/rust/src/bin/testplan_0440.rs b/ping/rust/src/bin/testplan_0440.rs index 113f72324..223f2c36b 100644 --- a/ping/rust/src/bin/testplan_0440.rs +++ b/ping/rust/src/bin/testplan_0440.rs @@ -21,8 +21,8 @@ async fn main() -> Result<()> { ), local_peer_id, )); - - run_ping(swarm).await?; + let client = testground::client::Client::new_and_init().await.unwrap(); + run_ping(swarm,client).await?; Ok(()) } diff --git a/ping/rust/src/bin/testplan_0451.rs b/ping/rust/src/bin/testplan_0451.rs index 5a351135a..f1d650c5c 100644 --- a/ping/rust/src/bin/testplan_0451.rs +++ b/ping/rust/src/bin/testplan_0451.rs @@ -21,8 +21,8 @@ async fn main() -> Result<()> { ), local_peer_id, )); - - run_ping(swarm).await?; + let client = testground::client::Client::new_and_init().await.unwrap(); + run_ping(swarm,client).await?; Ok(()) } diff --git a/ping/rust/src/bin/testplan_0461.rs b/ping/rust/src/bin/testplan_0461.rs index 9caa59096..54a51f9c2 100644 --- a/ping/rust/src/bin/testplan_0461.rs +++ b/ping/rust/src/bin/testplan_0461.rs @@ -21,8 +21,8 @@ async fn main() -> Result<()> { ), local_peer_id, )); - - run_ping(swarm).await?; + let client = testground::client::Client::new_and_init().await.unwrap(); + run_ping(swarm,client).await?; Ok(()) } diff --git a/ping/rust/src/bin/testplan_0470.rs b/ping/rust/src/bin/testplan_0470.rs index 0b68bb9e7..53e1b8578 100644 --- a/ping/rust/src/bin/testplan_0470.rs +++ b/ping/rust/src/bin/testplan_0470.rs @@ -21,8 +21,8 @@ async fn main() -> Result<()> { ), local_peer_id, )); - - run_ping(swarm).await?; + let client = testground::client::Client::new_and_init().await.unwrap(); + run_ping(swarm,client).await?; Ok(()) } diff --git a/ping/rust/src/bin/testplan_0480.rs b/ping/rust/src/bin/testplan_0480.rs index 133c1813d..90a811a9b 100644 --- a/ping/rust/src/bin/testplan_0480.rs +++ b/ping/rust/src/bin/testplan_0480.rs @@ -21,8 +21,8 @@ async fn main() -> Result<()> { ), local_peer_id, )); - - run_ping(swarm).await?; + let client = testground::client::Client::new_and_init().await.unwrap(); + run_ping(swarm,client).await?; Ok(()) } diff --git a/ping/rust/src/bin/testplan_0490.rs b/ping/rust/src/bin/testplan_0490.rs index 10c21a82b..72a09b923 100644 --- a/ping/rust/src/bin/testplan_0490.rs +++ b/ping/rust/src/bin/testplan_0490.rs @@ -24,8 +24,8 @@ async fn main() -> Result<()> { ), local_peer_id, )); - - run_ping(swarm).await?; + let client = testground::client::Client::new_and_init().await.unwrap(); + run_ping(swarm, client).await?; Ok(()) } diff --git a/ping/rust/src/bin/testplan_0500.rs b/ping/rust/src/bin/testplan_0500.rs index c09f39d08..2a9f42d1d 100644 --- a/ping/rust/src/bin/testplan_0500.rs +++ b/ping/rust/src/bin/testplan_0500.rs @@ -9,19 +9,23 @@ use libp2pv0500::*; use rand::thread_rng; use std::{ collections::HashSet, - env, - str::FromStr, time::Duration, }; use testplan::*; #[async_std::main] async fn main() -> Result<()> { - println!("0.50.0"); let local_key = identity::Keypair::generate_ed25519(); let local_peer_id = PeerId::from(local_key.public()); - let transport_env = env::var("UNIQUELY_NAMED_ENV").unwrap_or_else(|_|"tcp".to_string()); - let transport = match transport_env.trim() { + let client = testground::client::Client::new_and_init().await.unwrap(); + let transport_name: String = client + .run_parameters() + .test_instance_params + .get("max_latency_ms") + .unwrap() + .parse() + .unwrap(); + let transport = match transport_name.trim() { "tcp" => tokio_development_transport(local_key)?, "webrtc" => webrtc::tokio::Transport::new( local_key, @@ -38,12 +42,8 @@ async fn main() -> Result<()> { }, local_peer_id, )); - println!("Compiled as if using a webrtc-enabled recent version of multiaddr: {:?}", Multiaddr::from_str("/ip4/127.0.0.1/udp/8080/webrtc").expect("could not parse simple multiaddr").protocol_stack().collect::>()); - match transport_env.trim() { - "tcp" => run_ping(swarm).await?, - "webrtc" => run_ping_with_ma_pattern(swarm, "/ip4/ip4_address/udp/listening_port/webrtc".to_string()).await?,//TODO certhash - unhandled => unimplemented!("Transport unhandled in test: {}", unhandled), - } + + run_ping(swarm, client).await?; Ok(()) } diff --git a/ping/rust/src/lib.rs b/ping/rust/src/lib.rs index ae88fc60d..babcb5699 100644 --- a/ping/rust/src/lib.rs +++ b/ping/rust/src/lib.rs @@ -27,23 +27,20 @@ pub trait PingSwarm: Sized { fn local_peer_id(&self) -> String; } -pub async fn run_ping(swarm: S) -> Result<()> +pub async fn run_ping(mut swarm: S, client: testground::client::Client) -> Result<()> where S: PingSwarm, { - info!("info run_ping uses hard-coded tcp"); - run_ping_with_ma_pattern(swarm, format!("/ip4/ip4_address/tcp/listening_port")).await -} -pub async fn run_ping_with_ma_pattern(mut swarm: S, ma_pattern: String) -> Result<()> - where - S: PingSwarm, -{ - info!("info Running ping test: {} with pattern {}", swarm.local_peer_id(), &ma_pattern); - env_logger::Builder::from_env(Env::default().default_filter_or("info")).init(); - let client = testground::client::Client::new_and_init().await.unwrap(); - let local_addr = match if_addrs::get_if_addrs() + let transport: String = client + .run_parameters() + .test_instance_params + .get("max_latency_ms") + .unwrap() + .parse() + .unwrap(); + let local_ip_addr = match if_addrs::get_if_addrs() .unwrap() .into_iter() .find(|iface| iface.name == "eth1") @@ -51,14 +48,15 @@ pub async fn run_ping_with_ma_pattern(mut swarm: S, ma_pattern: String) -> Re .addr .ip() { - std::net::IpAddr::V4(addr) => ma_pattern.replace("ip4_address", addr.to_string().as_str()).replace("listening_port",LISTENING_PORT), + std::net::IpAddr::V4(addr) => addr.to_string(), std::net::IpAddr::V6(_) => unimplemented!(), }; - - info!( - "Test instance, listening for incoming connections on: {:?}.", - local_addr - ); + let local_addr = match transport.as_str() { + "tcp" => format!("/ip4/{local_ip_addr}/tcp/{LISTENING_PORT}"), + "webrtc" => format!("/ip4/{local_ip_addr}/udp/{LISTENING_PORT}/webrtc"), + unhandled => unimplemented!("Transport unhandled in test: {}", unhandled), + }; + info!("Test instance, listening for incoming connections on: {:?}.", local_addr); swarm.listen_on(&local_addr).await?; From 2d0bc4abb8daaa9cbb24698051c468bba299c476 Mon Sep 17 00:00:00 2001 From: John Turpish Date: Fri, 2 Dec 2022 01:27:28 -0500 Subject: [PATCH 09/24] removing some temporary stuff --- ping/rust/src/bin/testplan_0490.rs | 1 - ping/rust/src/lib.rs | 15 ++++----------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/ping/rust/src/bin/testplan_0490.rs b/ping/rust/src/bin/testplan_0490.rs index 72a09b923..0227c8158 100644 --- a/ping/rust/src/bin/testplan_0490.rs +++ b/ping/rust/src/bin/testplan_0490.rs @@ -9,7 +9,6 @@ use testplan::{run_ping, PingSwarm}; #[async_std::main] async fn main() -> Result<()> { - println!("0.49.0"); let local_key = identity::Keypair::generate_ed25519(); let local_peer_id = PeerId::from(local_key.public()); diff --git a/ping/rust/src/lib.rs b/ping/rust/src/lib.rs index babcb5699..49c72eae0 100644 --- a/ping/rust/src/lib.rs +++ b/ping/rust/src/lib.rs @@ -2,7 +2,7 @@ use anyhow::Result; use env_logger::Env; use futures::future::ready; use futures::{FutureExt, StreamExt}; -use log::{error, info}; +use log::info; use rand::Rng; use std::borrow::Cow; use std::time::Duration; @@ -33,6 +33,8 @@ pub async fn run_ping(mut swarm: S, client: testground::client::Client) -> Re { env_logger::Builder::from_env(Env::default().default_filter_or("info")).init(); + info!("Running ping test: {}", swarm.local_peer_id()); + let transport: String = client .run_parameters() .test_instance_params @@ -85,19 +87,10 @@ pub async fn run_ping(mut swarm: S, client: testground::client::Client) -> Re client.publish("peers", Cow::Owned(payload)).await?; - let mut dialed_count = 0; while let Some(addr) = address_stream.next().await { info!("About to dial: {}",&addr); - match swarm.dial(&addr) { - Ok(()) => dialed_count += 1, - Err(e) => { - client.record_message(format!("Dial failure for {}: {:?}", addr,&e)); - info!("ERROR: could not dial {} : {:?}", &addr, e); - error!("ERROR: could not dial {} : {:?}", &addr, e); - }, - } + swarm.dial(&addr).expect("Dialing failure"); } - assert_ne!(dialed_count,0); // Otherwise the testground background task gets blocked sending // subscription upgrades to the backpressured channel. From 31666f56dc3fe5d09840fa13c90b7b8fa8117e5a Mon Sep 17 00:00:00 2001 From: John Turpish Date: Fri, 2 Dec 2022 04:23:26 -0500 Subject: [PATCH 10/24] oops --- ping/rust/src/bin/testplan_0500.rs | 13 ++++++------- ping/rust/src/lib.rs | 13 ++++++------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/ping/rust/src/bin/testplan_0500.rs b/ping/rust/src/bin/testplan_0500.rs index 2a9f42d1d..4c976c752 100644 --- a/ping/rust/src/bin/testplan_0500.rs +++ b/ping/rust/src/bin/testplan_0500.rs @@ -18,21 +18,20 @@ async fn main() -> Result<()> { let local_key = identity::Keypair::generate_ed25519(); let local_peer_id = PeerId::from(local_key.public()); let client = testground::client::Client::new_and_init().await.unwrap(); - let transport_name: String = client + let transport_name = client .run_parameters() .test_instance_params - .get("max_latency_ms") - .unwrap() - .parse() - .unwrap(); - let transport = match transport_name.trim() { + .get("transport") + .expect("transport testparam should be available, possibly defaulted") + .clone(); + let transport = match transport_name.as_str() { "tcp" => tokio_development_transport(local_key)?, "webrtc" => webrtc::tokio::Transport::new( local_key, webrtc::tokio::Certificate::generate(&mut thread_rng())?) .map(|(peer_id, conn), _| (peer_id, StreamMuxerBox::new(conn))) .boxed(), - unhandled => unimplemented!("Transport unhandled in test: {}", unhandled), + unhandled => unimplemented!("Transport unhandled in test: '{}'", unhandled), }; let swarm = OrphanRuleWorkaround(Swarm::with_tokio_executor( transport, diff --git a/ping/rust/src/lib.rs b/ping/rust/src/lib.rs index 49c72eae0..7bc827d1e 100644 --- a/ping/rust/src/lib.rs +++ b/ping/rust/src/lib.rs @@ -35,13 +35,12 @@ pub async fn run_ping(mut swarm: S, client: testground::client::Client) -> Re info!("Running ping test: {}", swarm.local_peer_id()); - let transport: String = client + let transport = client .run_parameters() .test_instance_params - .get("max_latency_ms") - .unwrap() - .parse() - .unwrap(); + .get("transport") + .expect("transport testparam should be available, possibly defaulted") + .clone(); let local_ip_addr = match if_addrs::get_if_addrs() .unwrap() .into_iter() @@ -56,7 +55,7 @@ pub async fn run_ping(mut swarm: S, client: testground::client::Client) -> Re let local_addr = match transport.as_str() { "tcp" => format!("/ip4/{local_ip_addr}/tcp/{LISTENING_PORT}"), "webrtc" => format!("/ip4/{local_ip_addr}/udp/{LISTENING_PORT}/webrtc"), - unhandled => unimplemented!("Transport unhandled in test: {}", unhandled), + unhandled => unimplemented!("Transport unhandled in test: '{}'", unhandled), }; info!("Test instance, listening for incoming connections on: {:?}.", local_addr); @@ -101,7 +100,7 @@ pub async fn run_ping(mut swarm: S, client: testground::client::Client) -> Re swarm .await_connections(client.run_parameters().test_instance_count as usize - 1) .await; - + info!("Connections awaited."); signal_wait_and_drive_swarm(&client, &mut swarm, "connected".to_string()).await?; ping(&client, &mut swarm, "initial".to_string()).await?; From 31e819736ddf29dc56c8544c2342287f9673720e Mon Sep 17 00:00:00 2001 From: John Turpish Date: Fri, 2 Dec 2022 10:49:10 -0500 Subject: [PATCH 11/24] Change to optional return value --- ping/rust/Dockerfile | 2 +- ping/rust/src/bin/testplan_0440.rs | 4 ++-- ping/rust/src/bin/testplan_0451.rs | 4 ++-- ping/rust/src/bin/testplan_0461.rs | 4 ++-- ping/rust/src/bin/testplan_0470.rs | 4 ++-- ping/rust/src/bin/testplan_0480.rs | 4 ++-- ping/rust/src/bin/testplan_0490.rs | 4 ++-- ping/rust/src/bin/testplan_0500.rs | 20 ++++++++++++-------- ping/rust/src/lib.rs | 11 +++++++---- 9 files changed, 32 insertions(+), 25 deletions(-) diff --git a/ping/rust/Dockerfile b/ping/rust/Dockerfile index 937832c0f..2bc4449bd 100644 --- a/ping/rust/Dockerfile +++ b/ping/rust/Dockerfile @@ -31,6 +31,6 @@ RUN cd ./plan/ && mv -v /usr/src/testplan/plan/target/debug/${BINARY_NAME} /usr/ FROM debian:bullseye-slim COPY --from=builder /usr/local/bin/testplan /usr/local/bin/testplan EXPOSE 6060 - +EXPOSE 1234 ENV RUST_BACKTRACE=full ENTRYPOINT ["testplan"] diff --git a/ping/rust/src/bin/testplan_0440.rs b/ping/rust/src/bin/testplan_0440.rs index 223f2c36b..b01ae05e6 100644 --- a/ping/rust/src/bin/testplan_0440.rs +++ b/ping/rust/src/bin/testplan_0440.rs @@ -31,7 +31,7 @@ struct OrphanRuleWorkaround(Swarm); #[async_trait] impl PingSwarm for OrphanRuleWorkaround { - async fn listen_on(&mut self, address: &str) -> Result<()> { + async fn listen_on(&mut self, address: &str) -> Result> { let id = self.0.listen_on(address.parse()?)?; loop { @@ -42,7 +42,7 @@ impl PingSwarm for OrphanRuleWorkaround { } } - Ok(()) + Ok(None) } fn dial(&mut self, address: &str) -> Result<()> { diff --git a/ping/rust/src/bin/testplan_0451.rs b/ping/rust/src/bin/testplan_0451.rs index f1d650c5c..4a5c3413f 100644 --- a/ping/rust/src/bin/testplan_0451.rs +++ b/ping/rust/src/bin/testplan_0451.rs @@ -31,7 +31,7 @@ struct OrphanRuleWorkaround(Swarm); #[async_trait] impl PingSwarm for OrphanRuleWorkaround { - async fn listen_on(&mut self, address: &str) -> Result<()> { + async fn listen_on(&mut self, address: &str) -> Result> { let id = self.0.listen_on(address.parse()?)?; loop { @@ -42,7 +42,7 @@ impl PingSwarm for OrphanRuleWorkaround { } } - Ok(()) + Ok(None) } fn dial(&mut self, address: &str) -> Result<()> { diff --git a/ping/rust/src/bin/testplan_0461.rs b/ping/rust/src/bin/testplan_0461.rs index 54a51f9c2..b3dbaed8a 100644 --- a/ping/rust/src/bin/testplan_0461.rs +++ b/ping/rust/src/bin/testplan_0461.rs @@ -31,7 +31,7 @@ struct OrphanRuleWorkaround(Swarm); #[async_trait] impl PingSwarm for OrphanRuleWorkaround { - async fn listen_on(&mut self, address: &str) -> Result<()> { + async fn listen_on(&mut self, address: &str) -> Result> { let id = self.0.listen_on(address.parse()?)?; loop { @@ -42,7 +42,7 @@ impl PingSwarm for OrphanRuleWorkaround { } } - Ok(()) + Ok(None) } fn dial(&mut self, address: &str) -> Result<()> { diff --git a/ping/rust/src/bin/testplan_0470.rs b/ping/rust/src/bin/testplan_0470.rs index 53e1b8578..e72150859 100644 --- a/ping/rust/src/bin/testplan_0470.rs +++ b/ping/rust/src/bin/testplan_0470.rs @@ -31,7 +31,7 @@ struct OrphanRuleWorkaround(Swarm); #[async_trait] impl PingSwarm for OrphanRuleWorkaround { - async fn listen_on(&mut self, address: &str) -> Result<()> { + async fn listen_on(&mut self, address: &str) -> Result> { let id = self.0.listen_on(address.parse()?)?; loop { @@ -42,7 +42,7 @@ impl PingSwarm for OrphanRuleWorkaround { } } - Ok(()) + Ok(None) } fn dial(&mut self, address: &str) -> Result<()> { diff --git a/ping/rust/src/bin/testplan_0480.rs b/ping/rust/src/bin/testplan_0480.rs index 90a811a9b..d91d5d135 100644 --- a/ping/rust/src/bin/testplan_0480.rs +++ b/ping/rust/src/bin/testplan_0480.rs @@ -31,7 +31,7 @@ struct OrphanRuleWorkaround(Swarm); #[async_trait] impl PingSwarm for OrphanRuleWorkaround { - async fn listen_on(&mut self, address: &str) -> Result<()> { + async fn listen_on(&mut self, address: &str) -> Result> { let id = self.0.listen_on(address.parse()?)?; loop { @@ -42,7 +42,7 @@ impl PingSwarm for OrphanRuleWorkaround { } } - Ok(()) + Ok(None) } fn dial(&mut self, address: &str) -> Result<()> { diff --git a/ping/rust/src/bin/testplan_0490.rs b/ping/rust/src/bin/testplan_0490.rs index 0227c8158..32ca64b2a 100644 --- a/ping/rust/src/bin/testplan_0490.rs +++ b/ping/rust/src/bin/testplan_0490.rs @@ -33,7 +33,7 @@ struct OrphanRuleWorkaround(Swarm); #[async_trait] impl PingSwarm for OrphanRuleWorkaround { - async fn listen_on(&mut self, address: &str) -> Result<()> { + async fn listen_on(&mut self, address: &str) -> Result> { let id = self.0.listen_on(address.parse()?)?; loop { @@ -44,7 +44,7 @@ impl PingSwarm for OrphanRuleWorkaround { } } - Ok(()) + Ok(None) } fn dial(&mut self, address: &str) -> Result<()> { diff --git a/ping/rust/src/bin/testplan_0500.rs b/ping/rust/src/bin/testplan_0500.rs index 4c976c752..ae9eca0ee 100644 --- a/ping/rust/src/bin/testplan_0500.rs +++ b/ping/rust/src/bin/testplan_0500.rs @@ -11,6 +11,7 @@ use std::{ collections::HashSet, time::Duration, }; +use log::info; use testplan::*; #[async_std::main] @@ -59,18 +60,16 @@ struct OrphanRuleWorkaround(Swarm); #[async_trait] impl PingSwarm for OrphanRuleWorkaround { - async fn listen_on(&mut self, address: &str) -> Result<()> { + async fn listen_on(&mut self, address: &str) -> Result> { let id = self.0.listen_on(address.parse()?)?; - loop { - if let Some(SwarmEvent::NewListenAddr { listener_id, .. }) = self.0.next().await { + if let Some(SwarmEvent::NewListenAddr { listener_id, address }) = self.0.next().await { if listener_id == id { - break; + info!("NewListenAddr event: listener_id={:?}, address={:?}", &listener_id, &address); + return Ok(Some(address.to_string())); } } } - - Ok(()) } fn dial(&mut self, address: &str) -> Result<()> { @@ -83,8 +82,13 @@ impl PingSwarm for OrphanRuleWorkaround { let mut connected = HashSet::with_capacity(number); while connected.len() < number { - if let Some(SwarmEvent::ConnectionEstablished { peer_id, .. }) = self.0.next().await { - connected.insert(peer_id); + match self.0.next().await { + Some(SwarmEvent::ConnectionEstablished { peer_id, endpoint, .. }) => { + info!("Connection established! {:?}={:?}", &peer_id, &endpoint); + connected.insert(peer_id); + }, + Some(event) => info!("Received event {:?}",&event), + None => (), } } } diff --git a/ping/rust/src/lib.rs b/ping/rust/src/lib.rs index 7bc827d1e..f66393678 100644 --- a/ping/rust/src/lib.rs +++ b/ping/rust/src/lib.rs @@ -14,7 +14,7 @@ const LISTENING_PORT: &str = "1234"; #[async_trait::async_trait] pub trait PingSwarm: Sized { - async fn listen_on(&mut self, address: &str) -> Result<()>; + async fn listen_on(&mut self, address: &str) -> Result>; fn dial(&mut self, address: &str) -> Result<()>; @@ -59,7 +59,10 @@ pub async fn run_ping(mut swarm: S, client: testground::client::Client) -> Re }; info!("Test instance, listening for incoming connections on: {:?}.", local_addr); - swarm.listen_on(&local_addr).await?; + let dialable_multiaddr = match swarm.listen_on(&local_addr).await? { + Some(reported) => reported, + None => local_addr.clone(), + }; let test_instance_count = client.run_parameters().test_instance_count as usize; let mut address_stream = client @@ -75,12 +78,12 @@ pub async fn run_ping(mut swarm: S, client: testground::client::Client) -> Re // two peers dialling each other at the same time). // // We can do this because sync service pubsub is ordered. - .take_while(|a| ready(a != &local_addr)); + .take_while(|a| ready(a != &local_addr && a != &dialable_multiaddr)); let payload = serde_json::json!({ "ID": swarm.local_peer_id(), "Addrs": [ - local_addr + dialable_multiaddr ], }); From 899162553ed47c04820f87bc6b73a5d4cf2c490b Mon Sep 17 00:00:00 2001 From: John Turpish Date: Fri, 2 Dec 2022 11:12:57 -0500 Subject: [PATCH 12/24] Post-merge duplicate group IDs, also reverting inappropriate type change on a port constant - the motivation for the change is gone anyhow. --- ping/_compositions/rust.toml | 46 ++++++++++++++++-------------------- ping/rust/manifest.toml | 2 +- ping/rust/src/lib.rs | 2 +- 3 files changed, 23 insertions(+), 27 deletions(-) diff --git a/ping/_compositions/rust.toml b/ping/_compositions/rust.toml index ff4a02eee..a931e799e 100644 --- a/ping/_compositions/rust.toml +++ b/ping/_compositions/rust.toml @@ -9,29 +9,25 @@ Id = '0.50.0' BinaryName = 'testplan_0500' [[groups]] -Id = '0.50.0' -BinaryName = 'testplan_0500' +Id = '0.49.0' +BinaryName = 'testplan_0490' + +[[groups]] +Id = '0.48.0' +BinaryName = 'testplan_0480' + +[[groups]] +Id = "v0.47.0" +BinaryName = 'testplan_0470' -# [[groups]] -# Id = '0.49.0' -# BinaryName = 'testplan_0490' -# -# [[groups]] -# Id = '0.48.0' -# BinaryName = 'testplan_0480' - -# [[groups]] -# Id = "v0.47.0" -# BinaryName = 'testplan_0470' - -# [[groups]] -# Id = "v0.46.1" -# BinaryName = 'testplan_0461' - -# [[groups]] -# Id = "v0.45.1" -# BinaryName = 'testplan_0451' - -# [[groups]] -# Id = "v0.44.0" -# BinaryName = 'testplan_0440' +[[groups]] +Id = "v0.46.1" +BinaryName = 'testplan_0461' + +[[groups]] +Id = "v0.45.1" +BinaryName = 'testplan_0451' + +[[groups]] +Id = "v0.44.0" +BinaryName = 'testplan_0440' diff --git a/ping/rust/manifest.toml b/ping/rust/manifest.toml index 3876bf72b..505997b17 100644 --- a/ping/rust/manifest.toml +++ b/ping/rust/manifest.toml @@ -17,4 +17,4 @@ instances = { min = 2, max = 10000, default = 5 } [testcases.params] max_latency_ms = { type = "int", desc = "maximum value for random local link latency", unit = "ms", default = 1000 } iterations = { type = "int", desc = "number of ping iterations we'll run against each peer", unit = "count", default = 5 } - transport = { type = "enum", desc = "transport used", values = ["tcp", "webrtc"], default = "webrtc" } + transport = { type = "enum", desc = "transport used", values = ["tcp", "webrtc"], default = "tcp" } diff --git a/ping/rust/src/lib.rs b/ping/rust/src/lib.rs index f66393678..ef24172f6 100644 --- a/ping/rust/src/lib.rs +++ b/ping/rust/src/lib.rs @@ -10,7 +10,7 @@ use testground::network_conf::{ FilterAction, LinkShape, NetworkConfiguration, RoutingPolicyType, DEFAULT_DATA_NETWORK, }; -const LISTENING_PORT: &str = "1234"; +const LISTENING_PORT: u16 = 1234; #[async_trait::async_trait] pub trait PingSwarm: Sized { From 89ce9f156394d77b28dc7c6b601a8aeb62f8283d Mon Sep 17 00:00:00 2001 From: John Turpish Date: Fri, 2 Dec 2022 11:34:21 -0500 Subject: [PATCH 13/24] express it in code --- ping/rust/src/bin/testplan_0500.rs | 8 +------- ping/rust/src/lib.rs | 16 ++++++++++------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/ping/rust/src/bin/testplan_0500.rs b/ping/rust/src/bin/testplan_0500.rs index ae9eca0ee..48bf6274f 100644 --- a/ping/rust/src/bin/testplan_0500.rs +++ b/ping/rust/src/bin/testplan_0500.rs @@ -19,13 +19,7 @@ async fn main() -> Result<()> { let local_key = identity::Keypair::generate_ed25519(); let local_peer_id = PeerId::from(local_key.public()); let client = testground::client::Client::new_and_init().await.unwrap(); - let transport_name = client - .run_parameters() - .test_instance_params - .get("transport") - .expect("transport testparam should be available, possibly defaulted") - .clone(); - let transport = match transport_name.as_str() { + let transport = match transport_param(&client).as_str() { "tcp" => tokio_development_transport(local_key)?, "webrtc" => webrtc::tokio::Transport::new( local_key, diff --git a/ping/rust/src/lib.rs b/ping/rust/src/lib.rs index ef24172f6..2ce39572a 100644 --- a/ping/rust/src/lib.rs +++ b/ping/rust/src/lib.rs @@ -35,12 +35,7 @@ pub async fn run_ping(mut swarm: S, client: testground::client::Client) -> Re info!("Running ping test: {}", swarm.local_peer_id()); - let transport = client - .run_parameters() - .test_instance_params - .get("transport") - .expect("transport testparam should be available, possibly defaulted") - .clone(); + let transport = transport_param(&client); let local_ip_addr = match if_addrs::get_if_addrs() .unwrap() .into_iter() @@ -202,3 +197,12 @@ where Ok(()) } + +pub fn transport_param(client: &testground::client::Client) -> String { + client + .run_parameters() + .test_instance_params + .get("transport") + .map(|s|s.clone()) + .unwrap_or_else(||"tcp".to_owned()) +} From 35869fede20ecf53c2c870af0f1444374a42cbf5 Mon Sep 17 00:00:00 2001 From: John Turpish Date: Fri, 2 Dec 2022 13:10:17 -0500 Subject: [PATCH 14/24] Porting updates to testplan_0510 --- ping/rust/src/bin/testplan_0510.rs | 56 ++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/ping/rust/src/bin/testplan_0510.rs b/ping/rust/src/bin/testplan_0510.rs index 64b6e5e81..f51e6ea32 100644 --- a/ping/rust/src/bin/testplan_0510.rs +++ b/ping/rust/src/bin/testplan_0510.rs @@ -1,19 +1,44 @@ use anyhow::Result; use async_trait::async_trait; use futures::StreamExt; -use libp2pv0510::swarm::{keep_alive, NetworkBehaviour, SwarmEvent}; -use libp2pv0510::*; +use libp2pv0510::{ + core::muxing::StreamMuxerBox, + identity, + PeerId, + ping, + swarm::{ + keep_alive, + NetworkBehaviour, + SwarmEvent + }, + tokio_development_transport, + Transport, + Multiaddr, + Swarm, + webrtc, +}; +use log::info; +use rand::thread_rng; use std::collections::HashSet; use std::time::Duration; -use testplan::{run_ping, PingSwarm}; +use testplan::{run_ping, PingSwarm, transport_param}; #[async_std::main] async fn main() -> Result<()> { let local_key = identity::Keypair::generate_ed25519(); let local_peer_id = PeerId::from(local_key.public()); - - let swarm = OrphanRuleWorkaround(Swarm::with_async_std_executor( - development_transport(local_key).await?, + let client = testground::client::Client::new_and_init().await.unwrap(); + let transport = match transport_param(&client).as_str() { + "tcp" => tokio_development_transport(local_key)?, + "webrtc" => webrtc::tokio::Transport::new( + local_key, + webrtc::tokio::Certificate::generate(&mut thread_rng())?) + .map(|(peer_id, conn), _| (peer_id, StreamMuxerBox::new(conn))) + .boxed(), + unhandled => unimplemented!("Transport unhandled in test: '{}'", unhandled), + }; + let swarm = OrphanRuleWorkaround(Swarm::with_tokio_executor( + transport, Behaviour { keep_alive: keep_alive::Behaviour, ping: ping::Behaviour::new(ping::Config::new().with_interval(Duration::from_secs(1))), @@ -21,7 +46,7 @@ async fn main() -> Result<()> { local_peer_id, )); - run_ping(swarm).await?; + run_ping(swarm, client).await?; Ok(()) } @@ -37,18 +62,16 @@ struct OrphanRuleWorkaround(Swarm); #[async_trait] impl PingSwarm for OrphanRuleWorkaround { - async fn listen_on(&mut self, address: &str) -> Result<()> { + async fn listen_on(&mut self, address: &str) -> Result> { let id = self.0.listen_on(address.parse()?)?; loop { - if let Some(SwarmEvent::NewListenAddr { listener_id, .. }) = self.0.next().await { + if let Some(SwarmEvent::NewListenAddr { listener_id, address }) = self.0.next().await { if listener_id == id { - break; + return Ok(Some(address.to_string())); } } } - - Ok(()) } fn dial(&mut self, address: &str) -> Result<()> { @@ -61,8 +84,13 @@ impl PingSwarm for OrphanRuleWorkaround { let mut connected = HashSet::with_capacity(number); while connected.len() < number { - if let Some(SwarmEvent::ConnectionEstablished { peer_id, .. }) = self.0.next().await { - connected.insert(peer_id); + match self.0.next().await { + Some(SwarmEvent::ConnectionEstablished { peer_id, endpoint, .. }) => { + info!("Connection established! {:?}={:?}", &peer_id, &endpoint); + connected.insert(peer_id); + }, + Some(event) => info!("Received event {:?}",&event),//This is useful, because it sometimes logs error messages + None => (), } } } From e9c0ba4e4538031bde5af9d405b127c58b57e5e8 Mon Sep 17 00:00:00 2001 From: John Turpish Date: Mon, 5 Dec 2022 12:44:10 -0500 Subject: [PATCH 15/24] Some PR comments --- ping/rust/Dockerfile | 10 +++--- ping/rust/src/bin/testplan_0440.rs | 4 +-- ping/rust/src/bin/testplan_0451.rs | 4 +-- ping/rust/src/bin/testplan_0461.rs | 4 +-- ping/rust/src/bin/testplan_0470.rs | 4 +-- ping/rust/src/bin/testplan_0480.rs | 4 +-- ping/rust/src/bin/testplan_0490.rs | 2 +- ping/rust/src/bin/testplan_0500.rs | 48 ++++++++++++++++------------- ping/rust/src/bin/testplan_0510.rs | 49 ++++++++++++++---------------- ping/rust/src/lib.rs | 17 ++++++----- 10 files changed, 75 insertions(+), 71 deletions(-) diff --git a/ping/rust/Dockerfile b/ping/rust/Dockerfile index e2bc36a4b..437acc449 100644 --- a/ping/rust/Dockerfile +++ b/ping/rust/Dockerfile @@ -10,7 +10,6 @@ COPY ./plan/${PLAN_PATH}/src/main.rs ./plan/src/main.rs COPY ./plan/${PLAN_PATH}/Cargo.toml ./plan/Cargo.toml COPY ./plan/${PLAN_PATH}/Cargo.lock ./plan/Cargo.lock -RUN echo initial build RUN cd ./plan/ && cargo build # Initial build acts as a cache. ARG GIT_TARGET="" @@ -24,13 +23,12 @@ COPY ./plan/${PLAN_PATH}/src/bin/ ./plan/src/bin/ # Build the requested binary: Cargo will update lockfile on changed manifest (i.e. if one of the above `sed`s patched it). ARG BINARY_NAME -RUN echo BINARY_NAME=${BINARY_NAME} -RUN cd ./plan/ && cargo build --bin=${BINARY_NAME} -RUN cd ./plan/ && mv -v /usr/src/testplan/plan/target/debug/${BINARY_NAME} /usr/local/bin/testplan +RUN cd ./plan/ \ + && cargo build --bin=${BINARY_NAME} \ + && mv /usr/src/testplan/plan/target/debug/${BINARY_NAME} /usr/local/bin/testplan FROM debian:bullseye-slim COPY --from=builder /usr/local/bin/testplan /usr/local/bin/testplan EXPOSE 6060 -EXPOSE 1234 -ENV RUST_BACKTRACE=full +ENV RUST_BACKTRACE=1 ENTRYPOINT ["testplan"] diff --git a/ping/rust/src/bin/testplan_0440.rs b/ping/rust/src/bin/testplan_0440.rs index b01ae05e6..d5bae9215 100644 --- a/ping/rust/src/bin/testplan_0440.rs +++ b/ping/rust/src/bin/testplan_0440.rs @@ -21,8 +21,8 @@ async fn main() -> Result<()> { ), local_peer_id, )); - let client = testground::client::Client::new_and_init().await.unwrap(); - run_ping(swarm,client).await?; + let client = testground::client::Client::new_and_init().await?; + run_ping(swarm, client).await?; Ok(()) } diff --git a/ping/rust/src/bin/testplan_0451.rs b/ping/rust/src/bin/testplan_0451.rs index 4a5c3413f..d3a4fd8b7 100644 --- a/ping/rust/src/bin/testplan_0451.rs +++ b/ping/rust/src/bin/testplan_0451.rs @@ -21,8 +21,8 @@ async fn main() -> Result<()> { ), local_peer_id, )); - let client = testground::client::Client::new_and_init().await.unwrap(); - run_ping(swarm,client).await?; + let client = testground::client::Client::new_and_init().await?; + run_ping(swarm, client).await?; Ok(()) } diff --git a/ping/rust/src/bin/testplan_0461.rs b/ping/rust/src/bin/testplan_0461.rs index b3dbaed8a..a939723b1 100644 --- a/ping/rust/src/bin/testplan_0461.rs +++ b/ping/rust/src/bin/testplan_0461.rs @@ -21,8 +21,8 @@ async fn main() -> Result<()> { ), local_peer_id, )); - let client = testground::client::Client::new_and_init().await.unwrap(); - run_ping(swarm,client).await?; + let client = testground::client::Client::new_and_init().await?; + run_ping(swarm, client).await?; Ok(()) } diff --git a/ping/rust/src/bin/testplan_0470.rs b/ping/rust/src/bin/testplan_0470.rs index e72150859..febd27d4d 100644 --- a/ping/rust/src/bin/testplan_0470.rs +++ b/ping/rust/src/bin/testplan_0470.rs @@ -21,8 +21,8 @@ async fn main() -> Result<()> { ), local_peer_id, )); - let client = testground::client::Client::new_and_init().await.unwrap(); - run_ping(swarm,client).await?; + let client = testground::client::Client::new_and_init().await?; + run_ping(swarm, client).await?; Ok(()) } diff --git a/ping/rust/src/bin/testplan_0480.rs b/ping/rust/src/bin/testplan_0480.rs index d91d5d135..19214cb59 100644 --- a/ping/rust/src/bin/testplan_0480.rs +++ b/ping/rust/src/bin/testplan_0480.rs @@ -21,8 +21,8 @@ async fn main() -> Result<()> { ), local_peer_id, )); - let client = testground::client::Client::new_and_init().await.unwrap(); - run_ping(swarm,client).await?; + let client = testground::client::Client::new_and_init().await?; + run_ping(swarm, client).await?; Ok(()) } diff --git a/ping/rust/src/bin/testplan_0490.rs b/ping/rust/src/bin/testplan_0490.rs index 32ca64b2a..a258a57a2 100644 --- a/ping/rust/src/bin/testplan_0490.rs +++ b/ping/rust/src/bin/testplan_0490.rs @@ -23,7 +23,7 @@ async fn main() -> Result<()> { ), local_peer_id, )); - let client = testground::client::Client::new_and_init().await.unwrap(); + let client = testground::client::Client::new_and_init().await?; run_ping(swarm, client).await?; Ok(()) diff --git a/ping/rust/src/bin/testplan_0500.rs b/ping/rust/src/bin/testplan_0500.rs index 48bf6274f..82873d1ea 100644 --- a/ping/rust/src/bin/testplan_0500.rs +++ b/ping/rust/src/bin/testplan_0500.rs @@ -1,31 +1,29 @@ use anyhow::Result; use async_trait::async_trait; use futures::StreamExt; -use libp2pv0500::swarm::{keep_alive, NetworkBehaviour, SwarmEvent}; -use libp2pv0500::{tokio_development_transport,webrtc}; use libp2pv0500::core::multiaddr::*; use libp2pv0500::core::muxing::*; +use libp2pv0500::swarm::{keep_alive, NetworkBehaviour, SwarmEvent}; use libp2pv0500::*; -use rand::thread_rng; -use std::{ - collections::HashSet, - time::Duration, -}; +use libp2pv0500::{tokio_development_transport, webrtc}; use log::info; +use rand::thread_rng; +use std::{collections::HashSet, time::Duration}; use testplan::*; #[async_std::main] async fn main() -> Result<()> { let local_key = identity::Keypair::generate_ed25519(); let local_peer_id = PeerId::from(local_key.public()); - let client = testground::client::Client::new_and_init().await.unwrap(); - let transport = match transport_param(&client).as_str() { - "tcp" => tokio_development_transport(local_key)?, - "webrtc" => webrtc::tokio::Transport::new( - local_key, - webrtc::tokio::Certificate::generate(&mut thread_rng())?) - .map(|(peer_id, conn), _| (peer_id, StreamMuxerBox::new(conn))) - .boxed(), + let client = testground::client::Client::new_and_init().await?; + let transport = match transport_param(&client).as_str() { + "tcp" => tokio_development_transport(local_key)?, + "webrtc" => webrtc::tokio::Transport::new( + local_key, + webrtc::tokio::Certificate::generate(&mut thread_rng())?, + ) + .map(|(peer_id, conn), _| (peer_id, StreamMuxerBox::new(conn))) + .boxed(), unhandled => unimplemented!("Transport unhandled in test: '{}'", unhandled), }; let swarm = OrphanRuleWorkaround(Swarm::with_tokio_executor( @@ -42,7 +40,6 @@ async fn main() -> Result<()> { Ok(()) } - #[derive(NetworkBehaviour)] #[behaviour(prelude = "libp2pv0500::swarm::derive_prelude")] struct Behaviour { @@ -57,9 +54,16 @@ impl PingSwarm for OrphanRuleWorkaround { async fn listen_on(&mut self, address: &str) -> Result> { let id = self.0.listen_on(address.parse()?)?; loop { - if let Some(SwarmEvent::NewListenAddr { listener_id, address }) = self.0.next().await { + if let Some(SwarmEvent::NewListenAddr { + listener_id, + address, + }) = self.0.next().await + { if listener_id == id { - info!("NewListenAddr event: listener_id={:?}, address={:?}", &listener_id, &address); + info!( + "NewListenAddr event: listener_id={:?}, address={:?}", + &listener_id, &address + ); return Ok(Some(address.to_string())); } } @@ -77,11 +81,13 @@ impl PingSwarm for OrphanRuleWorkaround { while connected.len() < number { match self.0.next().await { - Some(SwarmEvent::ConnectionEstablished { peer_id, endpoint, .. }) => { + Some(SwarmEvent::ConnectionEstablished { + peer_id, endpoint, .. + }) => { info!("Connection established! {:?}={:?}", &peer_id, &endpoint); connected.insert(peer_id); - }, - Some(event) => info!("Received event {:?}",&event), + } + Some(event) => info!("Received event {:?}", &event), None => (), } } diff --git a/ping/rust/src/bin/testplan_0510.rs b/ping/rust/src/bin/testplan_0510.rs index f51e6ea32..8572447ab 100644 --- a/ping/rust/src/bin/testplan_0510.rs +++ b/ping/rust/src/bin/testplan_0510.rs @@ -3,38 +3,29 @@ use async_trait::async_trait; use futures::StreamExt; use libp2pv0510::{ core::muxing::StreamMuxerBox, - identity, - PeerId, - ping, - swarm::{ - keep_alive, - NetworkBehaviour, - SwarmEvent - }, - tokio_development_transport, - Transport, - Multiaddr, - Swarm, - webrtc, + identity, ping, + swarm::{keep_alive, NetworkBehaviour, SwarmEvent}, + tokio_development_transport, webrtc, Multiaddr, PeerId, Swarm, Transport, }; use log::info; use rand::thread_rng; use std::collections::HashSet; use std::time::Duration; -use testplan::{run_ping, PingSwarm, transport_param}; +use testplan::{run_ping, transport_param, PingSwarm}; #[async_std::main] async fn main() -> Result<()> { let local_key = identity::Keypair::generate_ed25519(); let local_peer_id = PeerId::from(local_key.public()); - let client = testground::client::Client::new_and_init().await.unwrap(); - let transport = match transport_param(&client).as_str() { - "tcp" => tokio_development_transport(local_key)?, - "webrtc" => webrtc::tokio::Transport::new( - local_key, - webrtc::tokio::Certificate::generate(&mut thread_rng())?) - .map(|(peer_id, conn), _| (peer_id, StreamMuxerBox::new(conn))) - .boxed(), + let client = testground::client::Client::new_and_init().await?; + let transport = match transport_param(&client).as_str() { + "tcp" => tokio_development_transport(local_key)?, + "webrtc" => webrtc::tokio::Transport::new( + local_key, + webrtc::tokio::Certificate::generate(&mut thread_rng())?, + ) + .map(|(peer_id, conn), _| (peer_id, StreamMuxerBox::new(conn))) + .boxed(), unhandled => unimplemented!("Transport unhandled in test: '{}'", unhandled), }; let swarm = OrphanRuleWorkaround(Swarm::with_tokio_executor( @@ -66,7 +57,11 @@ impl PingSwarm for OrphanRuleWorkaround { let id = self.0.listen_on(address.parse()?)?; loop { - if let Some(SwarmEvent::NewListenAddr { listener_id, address }) = self.0.next().await { + if let Some(SwarmEvent::NewListenAddr { + listener_id, + address, + }) = self.0.next().await + { if listener_id == id { return Ok(Some(address.to_string())); } @@ -85,11 +80,13 @@ impl PingSwarm for OrphanRuleWorkaround { while connected.len() < number { match self.0.next().await { - Some(SwarmEvent::ConnectionEstablished { peer_id, endpoint, .. }) => { + Some(SwarmEvent::ConnectionEstablished { + peer_id, endpoint, .. + }) => { info!("Connection established! {:?}={:?}", &peer_id, &endpoint); connected.insert(peer_id); - }, - Some(event) => info!("Received event {:?}",&event),//This is useful, because it sometimes logs error messages + } + Some(event) => info!("Received event {:?}", &event), //This is useful, because it sometimes logs error messages None => (), } } diff --git a/ping/rust/src/lib.rs b/ping/rust/src/lib.rs index 2ce39572a..b57bbf0a4 100644 --- a/ping/rust/src/lib.rs +++ b/ping/rust/src/lib.rs @@ -28,8 +28,8 @@ pub trait PingSwarm: Sized { } pub async fn run_ping(mut swarm: S, client: testground::client::Client) -> Result<()> - where - S: PingSwarm, +where + S: PingSwarm, { env_logger::Builder::from_env(Env::default().default_filter_or("info")).init(); @@ -52,7 +52,10 @@ pub async fn run_ping(mut swarm: S, client: testground::client::Client) -> Re "webrtc" => format!("/ip4/{local_ip_addr}/udp/{LISTENING_PORT}/webrtc"), unhandled => unimplemented!("Transport unhandled in test: '{}'", unhandled), }; - info!("Test instance, listening for incoming connections on: {:?}.", local_addr); + info!( + "Test instance, listening for incoming connections on: {:?}.", + local_addr + ); let dialable_multiaddr = match swarm.listen_on(&local_addr).await? { Some(reported) => reported, @@ -85,8 +88,8 @@ pub async fn run_ping(mut swarm: S, client: testground::client::Client) -> Re client.publish("peers", Cow::Owned(payload)).await?; while let Some(addr) = address_stream.next().await { - info!("About to dial: {}",&addr); - swarm.dial(&addr).expect("Dialing failure"); + info!("About to dial: {}", &addr); + swarm.dial(&addr)?; } // Otherwise the testground background task gets blocked sending @@ -203,6 +206,6 @@ pub fn transport_param(client: &testground::client::Client) -> String { .run_parameters() .test_instance_params .get("transport") - .map(|s|s.clone()) - .unwrap_or_else(||"tcp".to_owned()) + .map(|s| s.clone()) + .unwrap_or_else(|| "tcp".to_owned()) } From 5cae933bce64127c5f7e3e8b57dcde12fceeb3df Mon Sep 17 00:00:00 2001 From: John Turpish Date: Tue, 6 Dec 2022 12:03:04 -0500 Subject: [PATCH 16/24] expect --- ping/rust/src/bin/testplan_0440.rs | 2 +- ping/rust/src/bin/testplan_0451.rs | 2 +- ping/rust/src/bin/testplan_0461.rs | 2 +- ping/rust/src/bin/testplan_0470.rs | 2 +- ping/rust/src/bin/testplan_0480.rs | 2 +- ping/rust/src/bin/testplan_0490.rs | 2 +- ping/rust/src/bin/testplan_0500.rs | 4 ++-- ping/rust/src/bin/testplan_0510.rs | 4 ++-- ping/rust/src/lib.rs | 9 ++++----- 9 files changed, 14 insertions(+), 15 deletions(-) diff --git a/ping/rust/src/bin/testplan_0440.rs b/ping/rust/src/bin/testplan_0440.rs index d5bae9215..2b7513a55 100644 --- a/ping/rust/src/bin/testplan_0440.rs +++ b/ping/rust/src/bin/testplan_0440.rs @@ -21,7 +21,7 @@ async fn main() -> Result<()> { ), local_peer_id, )); - let client = testground::client::Client::new_and_init().await?; + let client = testground::client::Client::new_and_init().await.expect("Unable to init testground cient."); run_ping(swarm, client).await?; Ok(()) diff --git a/ping/rust/src/bin/testplan_0451.rs b/ping/rust/src/bin/testplan_0451.rs index d3a4fd8b7..07fd39eea 100644 --- a/ping/rust/src/bin/testplan_0451.rs +++ b/ping/rust/src/bin/testplan_0451.rs @@ -21,7 +21,7 @@ async fn main() -> Result<()> { ), local_peer_id, )); - let client = testground::client::Client::new_and_init().await?; + let client = testground::client::Client::new_and_init().await.expect("Unable to init testground cient."); run_ping(swarm, client).await?; Ok(()) diff --git a/ping/rust/src/bin/testplan_0461.rs b/ping/rust/src/bin/testplan_0461.rs index a939723b1..4eae524da 100644 --- a/ping/rust/src/bin/testplan_0461.rs +++ b/ping/rust/src/bin/testplan_0461.rs @@ -21,7 +21,7 @@ async fn main() -> Result<()> { ), local_peer_id, )); - let client = testground::client::Client::new_and_init().await?; + let client = testground::client::Client::new_and_init().await.expect("Unable to init testground cient."); run_ping(swarm, client).await?; Ok(()) diff --git a/ping/rust/src/bin/testplan_0470.rs b/ping/rust/src/bin/testplan_0470.rs index febd27d4d..9f940909a 100644 --- a/ping/rust/src/bin/testplan_0470.rs +++ b/ping/rust/src/bin/testplan_0470.rs @@ -21,7 +21,7 @@ async fn main() -> Result<()> { ), local_peer_id, )); - let client = testground::client::Client::new_and_init().await?; + let client = testground::client::Client::new_and_init().await.expect("Unable to init testground cient."); run_ping(swarm, client).await?; Ok(()) diff --git a/ping/rust/src/bin/testplan_0480.rs b/ping/rust/src/bin/testplan_0480.rs index 19214cb59..abe9f73a2 100644 --- a/ping/rust/src/bin/testplan_0480.rs +++ b/ping/rust/src/bin/testplan_0480.rs @@ -21,7 +21,7 @@ async fn main() -> Result<()> { ), local_peer_id, )); - let client = testground::client::Client::new_and_init().await?; + let client = testground::client::Client::new_and_init().await.expect("Unable to init testground cient."); run_ping(swarm, client).await?; Ok(()) diff --git a/ping/rust/src/bin/testplan_0490.rs b/ping/rust/src/bin/testplan_0490.rs index a258a57a2..f5895e35b 100644 --- a/ping/rust/src/bin/testplan_0490.rs +++ b/ping/rust/src/bin/testplan_0490.rs @@ -23,7 +23,7 @@ async fn main() -> Result<()> { ), local_peer_id, )); - let client = testground::client::Client::new_and_init().await?; + let client = testground::client::Client::new_and_init().await.expect("Unable to init testground cient."); run_ping(swarm, client).await?; Ok(()) diff --git a/ping/rust/src/bin/testplan_0500.rs b/ping/rust/src/bin/testplan_0500.rs index 82873d1ea..84026a273 100644 --- a/ping/rust/src/bin/testplan_0500.rs +++ b/ping/rust/src/bin/testplan_0500.rs @@ -11,11 +11,11 @@ use rand::thread_rng; use std::{collections::HashSet, time::Duration}; use testplan::*; -#[async_std::main] +#[tokio::main] async fn main() -> Result<()> { let local_key = identity::Keypair::generate_ed25519(); let local_peer_id = PeerId::from(local_key.public()); - let client = testground::client::Client::new_and_init().await?; + let client = testground::client::Client::new_and_init().await.expect("Unable to init testground cient."); let transport = match transport_param(&client).as_str() { "tcp" => tokio_development_transport(local_key)?, "webrtc" => webrtc::tokio::Transport::new( diff --git a/ping/rust/src/bin/testplan_0510.rs b/ping/rust/src/bin/testplan_0510.rs index 8572447ab..ea8d161f8 100644 --- a/ping/rust/src/bin/testplan_0510.rs +++ b/ping/rust/src/bin/testplan_0510.rs @@ -13,11 +13,11 @@ use std::collections::HashSet; use std::time::Duration; use testplan::{run_ping, transport_param, PingSwarm}; -#[async_std::main] +#[tokio::main] async fn main() -> Result<()> { let local_key = identity::Keypair::generate_ed25519(); let local_peer_id = PeerId::from(local_key.public()); - let client = testground::client::Client::new_and_init().await?; + let client = testground::client::Client::new_and_init().await.expect("Unable to init testground cient."); let transport = match transport_param(&client).as_str() { "tcp" => tokio_development_transport(local_key)?, "webrtc" => webrtc::tokio::Transport::new( diff --git a/ping/rust/src/lib.rs b/ping/rust/src/lib.rs index b57bbf0a4..0099eac5e 100644 --- a/ping/rust/src/lib.rs +++ b/ping/rust/src/lib.rs @@ -1,10 +1,11 @@ -use anyhow::Result; +use anyhow::{Result}; use env_logger::Env; use futures::future::ready; use futures::{FutureExt, StreamExt}; use log::info; use rand::Rng; use std::borrow::Cow; +use std::io; use std::time::Duration; use testground::network_conf::{ FilterAction, LinkShape, NetworkConfiguration, RoutingPolicyType, DEFAULT_DATA_NETWORK, @@ -36,11 +37,9 @@ where info!("Running ping test: {}", swarm.local_peer_id()); let transport = transport_param(&client); - let local_ip_addr = match if_addrs::get_if_addrs() - .unwrap() + let local_ip_addr = match if_addrs::get_if_addrs()? .into_iter() - .find(|iface| iface.name == "eth1") - .unwrap() + .find(|iface| iface.name == "eth1").ok_or_else(||io::Error::new(io::ErrorKind::Other,"Can't find iface eth1"))? .addr .ip() { From afe3a77e80030ad57caa104921eaf55624777218 Mon Sep 17 00:00:00 2001 From: John Turpish Date: Fri, 9 Dec 2022 01:16:27 -0500 Subject: [PATCH 17/24] logging verbosity --- ping/rust/src/bin/testplan_0500.rs | 8 ++++---- ping/rust/src/bin/testplan_0510.rs | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ping/rust/src/bin/testplan_0500.rs b/ping/rust/src/bin/testplan_0500.rs index 84026a273..9debcfe62 100644 --- a/ping/rust/src/bin/testplan_0500.rs +++ b/ping/rust/src/bin/testplan_0500.rs @@ -6,7 +6,7 @@ use libp2pv0500::core::muxing::*; use libp2pv0500::swarm::{keep_alive, NetworkBehaviour, SwarmEvent}; use libp2pv0500::*; use libp2pv0500::{tokio_development_transport, webrtc}; -use log::info; +use log::{debug,info}; use rand::thread_rng; use std::{collections::HashSet, time::Duration}; use testplan::*; @@ -60,7 +60,7 @@ impl PingSwarm for OrphanRuleWorkaround { }) = self.0.next().await { if listener_id == id { - info!( + debug!( "NewListenAddr event: listener_id={:?}, address={:?}", &listener_id, &address ); @@ -84,10 +84,10 @@ impl PingSwarm for OrphanRuleWorkaround { Some(SwarmEvent::ConnectionEstablished { peer_id, endpoint, .. }) => { - info!("Connection established! {:?}={:?}", &peer_id, &endpoint); + info!("Connection established! {}={}", &peer_id, &endpoint.get_remote_address()); connected.insert(peer_id); } - Some(event) => info!("Received event {:?}", &event), + Some(event) => debug!("Received event {:?}", &event), //This is useful, because it sometimes logs error messages None => (), } } diff --git a/ping/rust/src/bin/testplan_0510.rs b/ping/rust/src/bin/testplan_0510.rs index ea8d161f8..732931994 100644 --- a/ping/rust/src/bin/testplan_0510.rs +++ b/ping/rust/src/bin/testplan_0510.rs @@ -7,7 +7,7 @@ use libp2pv0510::{ swarm::{keep_alive, NetworkBehaviour, SwarmEvent}, tokio_development_transport, webrtc, Multiaddr, PeerId, Swarm, Transport, }; -use log::info; +use log::{debug,info}; use rand::thread_rng; use std::collections::HashSet; use std::time::Duration; @@ -83,10 +83,10 @@ impl PingSwarm for OrphanRuleWorkaround { Some(SwarmEvent::ConnectionEstablished { peer_id, endpoint, .. }) => { - info!("Connection established! {:?}={:?}", &peer_id, &endpoint); + info!("Connection established! {}={}", &peer_id, &endpoint.get_remote_address()); connected.insert(peer_id); } - Some(event) => info!("Received event {:?}", &event), //This is useful, because it sometimes logs error messages + Some(event) => debug!("Received event {:?}", &event), //This is useful, because it sometimes logs error messages None => (), } } From 24c1f23b92672756c12810d3b31752b8c4387a9b Mon Sep 17 00:00:00 2001 From: John Turpish Date: Fri, 9 Dec 2022 01:33:19 -0500 Subject: [PATCH 18/24] listen_on now returns an address across all versions. --- ping/rust/src/bin/testplan_0440.rs | 16 ++++++------- ping/rust/src/bin/testplan_0451.rs | 16 ++++++------- ping/rust/src/bin/testplan_0461.rs | 16 ++++++------- ping/rust/src/bin/testplan_0470.rs | 16 ++++++------- ping/rust/src/bin/testplan_0480.rs | 16 ++++++------- ping/rust/src/bin/testplan_0490.rs | 20 ++++++++--------- ping/rust/src/bin/testplan_0500.rs | 36 +++++++++++++++++------------- ping/rust/src/bin/testplan_0510.rs | 36 +++++++++++++++++------------- ping/rust/src/lib.rs | 26 ++++++++++----------- 9 files changed, 104 insertions(+), 94 deletions(-) diff --git a/ping/rust/src/bin/testplan_0440.rs b/ping/rust/src/bin/testplan_0440.rs index 2b7513a55..3a9be0951 100644 --- a/ping/rust/src/bin/testplan_0440.rs +++ b/ping/rust/src/bin/testplan_0440.rs @@ -21,7 +21,9 @@ async fn main() -> Result<()> { ), local_peer_id, )); - let client = testground::client::Client::new_and_init().await.expect("Unable to init testground cient."); + let client = testground::client::Client::new_and_init() + .await + .expect("Unable to init testground cient."); run_ping(swarm, client).await?; Ok(()) @@ -31,18 +33,16 @@ struct OrphanRuleWorkaround(Swarm); #[async_trait] impl PingSwarm for OrphanRuleWorkaround { - async fn listen_on(&mut self, address: &str) -> Result> { + async fn listen_on(&mut self, address: &str) -> Result { let id = self.0.listen_on(address.parse()?)?; loop { if let Some(SwarmEvent::NewListenAddr { listener_id, .. }) = self.0.next().await { if listener_id == id { - break; + return Ok(address.to_string()); } } } - - Ok(None) } fn dial(&mut self, address: &str) -> Result<()> { @@ -66,9 +66,9 @@ impl PingSwarm for OrphanRuleWorkaround { while received_pings.len() < number { if let Some(SwarmEvent::Behaviour(ping::Event { - peer, - result: Ok(ping::Success::Ping { .. }), - })) = self.0.next().await + peer, + result: Ok(ping::Success::Ping { .. }), + })) = self.0.next().await { received_pings.insert(peer); } diff --git a/ping/rust/src/bin/testplan_0451.rs b/ping/rust/src/bin/testplan_0451.rs index 07fd39eea..a3159c3d1 100644 --- a/ping/rust/src/bin/testplan_0451.rs +++ b/ping/rust/src/bin/testplan_0451.rs @@ -21,7 +21,9 @@ async fn main() -> Result<()> { ), local_peer_id, )); - let client = testground::client::Client::new_and_init().await.expect("Unable to init testground cient."); + let client = testground::client::Client::new_and_init() + .await + .expect("Unable to init testground cient."); run_ping(swarm, client).await?; Ok(()) @@ -31,18 +33,16 @@ struct OrphanRuleWorkaround(Swarm); #[async_trait] impl PingSwarm for OrphanRuleWorkaround { - async fn listen_on(&mut self, address: &str) -> Result> { + async fn listen_on(&mut self, address: &str) -> Result { let id = self.0.listen_on(address.parse()?)?; loop { if let Some(SwarmEvent::NewListenAddr { listener_id, .. }) = self.0.next().await { if listener_id == id { - break; + return Ok(address.to_string()); } } } - - Ok(None) } fn dial(&mut self, address: &str) -> Result<()> { @@ -66,9 +66,9 @@ impl PingSwarm for OrphanRuleWorkaround { while received_pings.len() < number { if let Some(SwarmEvent::Behaviour(ping::Event { - peer, - result: Ok(ping::Success::Ping { .. }), - })) = self.0.next().await + peer, + result: Ok(ping::Success::Ping { .. }), + })) = self.0.next().await { received_pings.insert(peer); } diff --git a/ping/rust/src/bin/testplan_0461.rs b/ping/rust/src/bin/testplan_0461.rs index 4eae524da..7aaabf566 100644 --- a/ping/rust/src/bin/testplan_0461.rs +++ b/ping/rust/src/bin/testplan_0461.rs @@ -21,7 +21,9 @@ async fn main() -> Result<()> { ), local_peer_id, )); - let client = testground::client::Client::new_and_init().await.expect("Unable to init testground cient."); + let client = testground::client::Client::new_and_init() + .await + .expect("Unable to init testground cient."); run_ping(swarm, client).await?; Ok(()) @@ -31,18 +33,16 @@ struct OrphanRuleWorkaround(Swarm); #[async_trait] impl PingSwarm for OrphanRuleWorkaround { - async fn listen_on(&mut self, address: &str) -> Result> { + async fn listen_on(&mut self, address: &str) -> Result { let id = self.0.listen_on(address.parse()?)?; loop { if let Some(SwarmEvent::NewListenAddr { listener_id, .. }) = self.0.next().await { if listener_id == id { - break; + return Ok(address.to_string()); } } } - - Ok(None) } fn dial(&mut self, address: &str) -> Result<()> { @@ -66,9 +66,9 @@ impl PingSwarm for OrphanRuleWorkaround { while received_pings.len() < number { if let Some(SwarmEvent::Behaviour(ping::Event { - peer, - result: Ok(ping::Success::Ping { .. }), - })) = self.0.next().await + peer, + result: Ok(ping::Success::Ping { .. }), + })) = self.0.next().await { received_pings.insert(peer); } diff --git a/ping/rust/src/bin/testplan_0470.rs b/ping/rust/src/bin/testplan_0470.rs index 9f940909a..49c274be2 100644 --- a/ping/rust/src/bin/testplan_0470.rs +++ b/ping/rust/src/bin/testplan_0470.rs @@ -21,7 +21,9 @@ async fn main() -> Result<()> { ), local_peer_id, )); - let client = testground::client::Client::new_and_init().await.expect("Unable to init testground cient."); + let client = testground::client::Client::new_and_init() + .await + .expect("Unable to init testground cient."); run_ping(swarm, client).await?; Ok(()) @@ -31,18 +33,16 @@ struct OrphanRuleWorkaround(Swarm); #[async_trait] impl PingSwarm for OrphanRuleWorkaround { - async fn listen_on(&mut self, address: &str) -> Result> { + async fn listen_on(&mut self, address: &str) -> Result { let id = self.0.listen_on(address.parse()?)?; loop { if let Some(SwarmEvent::NewListenAddr { listener_id, .. }) = self.0.next().await { if listener_id == id { - break; + return Ok(address.to_string()); } } } - - Ok(None) } fn dial(&mut self, address: &str) -> Result<()> { @@ -66,9 +66,9 @@ impl PingSwarm for OrphanRuleWorkaround { while received_pings.len() < number { if let Some(SwarmEvent::Behaviour(ping::Event { - peer, - result: Ok(ping::Success::Ping { .. }), - })) = self.0.next().await + peer, + result: Ok(ping::Success::Ping { .. }), + })) = self.0.next().await { received_pings.insert(peer); } diff --git a/ping/rust/src/bin/testplan_0480.rs b/ping/rust/src/bin/testplan_0480.rs index abe9f73a2..51ef95b4f 100644 --- a/ping/rust/src/bin/testplan_0480.rs +++ b/ping/rust/src/bin/testplan_0480.rs @@ -21,7 +21,9 @@ async fn main() -> Result<()> { ), local_peer_id, )); - let client = testground::client::Client::new_and_init().await.expect("Unable to init testground cient."); + let client = testground::client::Client::new_and_init() + .await + .expect("Unable to init testground cient."); run_ping(swarm, client).await?; Ok(()) @@ -31,18 +33,16 @@ struct OrphanRuleWorkaround(Swarm); #[async_trait] impl PingSwarm for OrphanRuleWorkaround { - async fn listen_on(&mut self, address: &str) -> Result> { + async fn listen_on(&mut self, address: &str) -> Result { let id = self.0.listen_on(address.parse()?)?; loop { if let Some(SwarmEvent::NewListenAddr { listener_id, .. }) = self.0.next().await { if listener_id == id { - break; + return Ok(address.to_string()); } } } - - Ok(None) } fn dial(&mut self, address: &str) -> Result<()> { @@ -66,9 +66,9 @@ impl PingSwarm for OrphanRuleWorkaround { while received_pings.len() < number { if let Some(SwarmEvent::Behaviour(ping::Event { - peer, - result: Ok(ping::Success::Ping { .. }), - })) = self.0.next().await + peer, + result: Ok(ping::Success::Ping { .. }), + })) = self.0.next().await { received_pings.insert(peer); } diff --git a/ping/rust/src/bin/testplan_0490.rs b/ping/rust/src/bin/testplan_0490.rs index f5895e35b..e45b02b40 100644 --- a/ping/rust/src/bin/testplan_0490.rs +++ b/ping/rust/src/bin/testplan_0490.rs @@ -16,14 +16,16 @@ async fn main() -> Result<()> { development_transport(local_key).await?, ping::Behaviour::new( #[allow(deprecated)] - // TODO: Fixing this deprecation requires https://github.com/libp2p/rust-libp2p/pull/3055. - ping::Config::new() + // TODO: Fixing this deprecation requires https://github.com/libp2p/rust-libp2p/pull/3055. + ping::Config::new() .with_interval(Duration::from_secs(1)) .with_keep_alive(true), ), local_peer_id, )); - let client = testground::client::Client::new_and_init().await.expect("Unable to init testground cient."); + let client = testground::client::Client::new_and_init() + .await + .expect("Unable to init testground cient."); run_ping(swarm, client).await?; Ok(()) @@ -33,18 +35,16 @@ struct OrphanRuleWorkaround(Swarm); #[async_trait] impl PingSwarm for OrphanRuleWorkaround { - async fn listen_on(&mut self, address: &str) -> Result> { + async fn listen_on(&mut self, address: &str) -> Result { let id = self.0.listen_on(address.parse()?)?; loop { if let Some(SwarmEvent::NewListenAddr { listener_id, .. }) = self.0.next().await { if listener_id == id { - break; + return Ok(address.to_string()); } } } - - Ok(None) } fn dial(&mut self, address: &str) -> Result<()> { @@ -68,9 +68,9 @@ impl PingSwarm for OrphanRuleWorkaround { while received_pings.len() < number { if let Some(SwarmEvent::Behaviour(ping::Event { - peer, - result: Ok(ping::Success::Ping { .. }), - })) = self.0.next().await + peer, + result: Ok(ping::Success::Ping { .. }), + })) = self.0.next().await { received_pings.insert(peer); } diff --git a/ping/rust/src/bin/testplan_0500.rs b/ping/rust/src/bin/testplan_0500.rs index 9debcfe62..38528957c 100644 --- a/ping/rust/src/bin/testplan_0500.rs +++ b/ping/rust/src/bin/testplan_0500.rs @@ -6,7 +6,7 @@ use libp2pv0500::core::muxing::*; use libp2pv0500::swarm::{keep_alive, NetworkBehaviour, SwarmEvent}; use libp2pv0500::*; use libp2pv0500::{tokio_development_transport, webrtc}; -use log::{debug,info}; +use log::{debug, info}; use rand::thread_rng; use std::{collections::HashSet, time::Duration}; use testplan::*; @@ -15,15 +15,17 @@ use testplan::*; async fn main() -> Result<()> { let local_key = identity::Keypair::generate_ed25519(); let local_peer_id = PeerId::from(local_key.public()); - let client = testground::client::Client::new_and_init().await.expect("Unable to init testground cient."); + let client = testground::client::Client::new_and_init() + .await + .expect("Unable to init testground cient."); let transport = match transport_param(&client).as_str() { "tcp" => tokio_development_transport(local_key)?, "webrtc" => webrtc::tokio::Transport::new( local_key, webrtc::tokio::Certificate::generate(&mut thread_rng())?, ) - .map(|(peer_id, conn), _| (peer_id, StreamMuxerBox::new(conn))) - .boxed(), + .map(|(peer_id, conn), _| (peer_id, StreamMuxerBox::new(conn))) + .boxed(), unhandled => unimplemented!("Transport unhandled in test: '{}'", unhandled), }; let swarm = OrphanRuleWorkaround(Swarm::with_tokio_executor( @@ -51,20 +53,20 @@ struct OrphanRuleWorkaround(Swarm); #[async_trait] impl PingSwarm for OrphanRuleWorkaround { - async fn listen_on(&mut self, address: &str) -> Result> { + async fn listen_on(&mut self, address: &str) -> Result { let id = self.0.listen_on(address.parse()?)?; loop { if let Some(SwarmEvent::NewListenAddr { - listener_id, - address, - }) = self.0.next().await + listener_id, + address, + }) = self.0.next().await { if listener_id == id { debug!( "NewListenAddr event: listener_id={:?}, address={:?}", &listener_id, &address ); - return Ok(Some(address.to_string())); + return Ok(address.to_string()); } } } @@ -82,9 +84,13 @@ impl PingSwarm for OrphanRuleWorkaround { while connected.len() < number { match self.0.next().await { Some(SwarmEvent::ConnectionEstablished { - peer_id, endpoint, .. - }) => { - info!("Connection established! {}={}", &peer_id, &endpoint.get_remote_address()); + peer_id, endpoint, .. + }) => { + info!( + "Connection established! {}={}", + &peer_id, + &endpoint.get_remote_address() + ); connected.insert(peer_id); } Some(event) => debug!("Received event {:?}", &event), //This is useful, because it sometimes logs error messages @@ -98,9 +104,9 @@ impl PingSwarm for OrphanRuleWorkaround { while received_pings.len() < number { if let Some(SwarmEvent::Behaviour(BehaviourEvent::Ping(ping::Event { - peer, - result: Ok(ping::Success::Ping { .. }), - }))) = self.0.next().await + peer, + result: Ok(ping::Success::Ping { .. }), + }))) = self.0.next().await { received_pings.insert(peer); } diff --git a/ping/rust/src/bin/testplan_0510.rs b/ping/rust/src/bin/testplan_0510.rs index 732931994..5814cefd7 100644 --- a/ping/rust/src/bin/testplan_0510.rs +++ b/ping/rust/src/bin/testplan_0510.rs @@ -7,7 +7,7 @@ use libp2pv0510::{ swarm::{keep_alive, NetworkBehaviour, SwarmEvent}, tokio_development_transport, webrtc, Multiaddr, PeerId, Swarm, Transport, }; -use log::{debug,info}; +use log::{debug, info}; use rand::thread_rng; use std::collections::HashSet; use std::time::Duration; @@ -17,15 +17,17 @@ use testplan::{run_ping, transport_param, PingSwarm}; async fn main() -> Result<()> { let local_key = identity::Keypair::generate_ed25519(); let local_peer_id = PeerId::from(local_key.public()); - let client = testground::client::Client::new_and_init().await.expect("Unable to init testground cient."); + let client = testground::client::Client::new_and_init() + .await + .expect("Unable to init testground cient."); let transport = match transport_param(&client).as_str() { "tcp" => tokio_development_transport(local_key)?, "webrtc" => webrtc::tokio::Transport::new( local_key, webrtc::tokio::Certificate::generate(&mut thread_rng())?, ) - .map(|(peer_id, conn), _| (peer_id, StreamMuxerBox::new(conn))) - .boxed(), + .map(|(peer_id, conn), _| (peer_id, StreamMuxerBox::new(conn))) + .boxed(), unhandled => unimplemented!("Transport unhandled in test: '{}'", unhandled), }; let swarm = OrphanRuleWorkaround(Swarm::with_tokio_executor( @@ -53,17 +55,17 @@ struct OrphanRuleWorkaround(Swarm); #[async_trait] impl PingSwarm for OrphanRuleWorkaround { - async fn listen_on(&mut self, address: &str) -> Result> { + async fn listen_on(&mut self, address: &str) -> Result { let id = self.0.listen_on(address.parse()?)?; loop { if let Some(SwarmEvent::NewListenAddr { - listener_id, - address, - }) = self.0.next().await + listener_id, + address, + }) = self.0.next().await { if listener_id == id { - return Ok(Some(address.to_string())); + return Ok(address.to_string()); } } } @@ -81,9 +83,13 @@ impl PingSwarm for OrphanRuleWorkaround { while connected.len() < number { match self.0.next().await { Some(SwarmEvent::ConnectionEstablished { - peer_id, endpoint, .. - }) => { - info!("Connection established! {}={}", &peer_id, &endpoint.get_remote_address()); + peer_id, endpoint, .. + }) => { + info!( + "Connection established! {}={}", + &peer_id, + &endpoint.get_remote_address() + ); connected.insert(peer_id); } Some(event) => debug!("Received event {:?}", &event), //This is useful, because it sometimes logs error messages @@ -97,9 +103,9 @@ impl PingSwarm for OrphanRuleWorkaround { while received_pings.len() < number { if let Some(SwarmEvent::Behaviour(BehaviourEvent::Ping(ping::Event { - peer, - result: Ok(ping::Success::Ping { .. }), - }))) = self.0.next().await + peer, + result: Ok(ping::Success::Ping { .. }), + }))) = self.0.next().await { received_pings.insert(peer); } diff --git a/ping/rust/src/lib.rs b/ping/rust/src/lib.rs index 0099eac5e..91f105e26 100644 --- a/ping/rust/src/lib.rs +++ b/ping/rust/src/lib.rs @@ -1,4 +1,4 @@ -use anyhow::{Result}; +use anyhow::Result; use env_logger::Env; use futures::future::ready; use futures::{FutureExt, StreamExt}; @@ -15,7 +15,7 @@ const LISTENING_PORT: u16 = 1234; #[async_trait::async_trait] pub trait PingSwarm: Sized { - async fn listen_on(&mut self, address: &str) -> Result>; + async fn listen_on(&mut self, address: &str) -> Result; fn dial(&mut self, address: &str) -> Result<()>; @@ -29,8 +29,8 @@ pub trait PingSwarm: Sized { } pub async fn run_ping(mut swarm: S, client: testground::client::Client) -> Result<()> -where - S: PingSwarm, + where + S: PingSwarm, { env_logger::Builder::from_env(Env::default().default_filter_or("info")).init(); @@ -39,7 +39,8 @@ where let transport = transport_param(&client); let local_ip_addr = match if_addrs::get_if_addrs()? .into_iter() - .find(|iface| iface.name == "eth1").ok_or_else(||io::Error::new(io::ErrorKind::Other,"Can't find iface eth1"))? + .find(|iface| iface.name == "eth1") + .ok_or_else(|| io::Error::new(io::ErrorKind::Other, "Can't find iface eth1"))? .addr .ip() { @@ -56,10 +57,7 @@ where local_addr ); - let dialable_multiaddr = match swarm.listen_on(&local_addr).await? { - Some(reported) => reported, - None => local_addr.clone(), - }; + let dialable_multiaddr = swarm.listen_on(&local_addr).await?; let test_instance_count = client.run_parameters().test_instance_count as usize; let mut address_stream = client @@ -163,8 +161,8 @@ where } async fn ping(client: &testground::client::Client, swarm: &mut S, tag: String) -> Result<()> -where - S: PingSwarm, + where + S: PingSwarm, { info!("Wait to receive ping from each peer."); @@ -180,8 +178,8 @@ async fn signal_wait_and_drive_swarm( swarm: &mut S, tag: String, ) -> Result<()> -where - S: PingSwarm, + where + S: PingSwarm, { info!( "Signal and wait for all peers to signal being done with \"{}\".", @@ -195,7 +193,7 @@ where .signal_and_wait(tag, client.run_parameters().test_instance_count) .boxed_local(), ) - .await; + .await; Ok(()) } From a8fefc2eaab55c637abb5118369da8b0296945cb Mon Sep 17 00:00:00 2001 From: John Turpish Date: Mon, 12 Dec 2022 09:47:02 -0500 Subject: [PATCH 19/24] updates --- ping/rust/src/bin/testplan_0440.rs | 6 +-- ping/rust/src/bin/testplan_0451.rs | 6 +-- ping/rust/src/bin/testplan_0461.rs | 6 +-- ping/rust/src/bin/testplan_0470.rs | 6 +-- ping/rust/src/bin/testplan_0480.rs | 6 +-- ping/rust/src/bin/testplan_0490.rs | 6 +-- ping/rust/src/bin/testplan_0500.rs | 57 ++++++++++++++++++++-------- ping/rust/src/bin/testplan_0510.rs | 60 +++++++++++++++++++++--------- ping/rust/src/lib.rs | 4 +- 9 files changed, 103 insertions(+), 54 deletions(-) diff --git a/ping/rust/src/bin/testplan_0440.rs b/ping/rust/src/bin/testplan_0440.rs index 3a9be0951..fe549253b 100644 --- a/ping/rust/src/bin/testplan_0440.rs +++ b/ping/rust/src/bin/testplan_0440.rs @@ -66,9 +66,9 @@ impl PingSwarm for OrphanRuleWorkaround { while received_pings.len() < number { if let Some(SwarmEvent::Behaviour(ping::Event { - peer, - result: Ok(ping::Success::Ping { .. }), - })) = self.0.next().await + peer, + result: Ok(ping::Success::Ping { .. }), + })) = self.0.next().await { received_pings.insert(peer); } diff --git a/ping/rust/src/bin/testplan_0451.rs b/ping/rust/src/bin/testplan_0451.rs index a3159c3d1..221b9752c 100644 --- a/ping/rust/src/bin/testplan_0451.rs +++ b/ping/rust/src/bin/testplan_0451.rs @@ -66,9 +66,9 @@ impl PingSwarm for OrphanRuleWorkaround { while received_pings.len() < number { if let Some(SwarmEvent::Behaviour(ping::Event { - peer, - result: Ok(ping::Success::Ping { .. }), - })) = self.0.next().await + peer, + result: Ok(ping::Success::Ping { .. }), + })) = self.0.next().await { received_pings.insert(peer); } diff --git a/ping/rust/src/bin/testplan_0461.rs b/ping/rust/src/bin/testplan_0461.rs index 7aaabf566..f882bb9f7 100644 --- a/ping/rust/src/bin/testplan_0461.rs +++ b/ping/rust/src/bin/testplan_0461.rs @@ -66,9 +66,9 @@ impl PingSwarm for OrphanRuleWorkaround { while received_pings.len() < number { if let Some(SwarmEvent::Behaviour(ping::Event { - peer, - result: Ok(ping::Success::Ping { .. }), - })) = self.0.next().await + peer, + result: Ok(ping::Success::Ping { .. }), + })) = self.0.next().await { received_pings.insert(peer); } diff --git a/ping/rust/src/bin/testplan_0470.rs b/ping/rust/src/bin/testplan_0470.rs index 49c274be2..1157d7b3e 100644 --- a/ping/rust/src/bin/testplan_0470.rs +++ b/ping/rust/src/bin/testplan_0470.rs @@ -66,9 +66,9 @@ impl PingSwarm for OrphanRuleWorkaround { while received_pings.len() < number { if let Some(SwarmEvent::Behaviour(ping::Event { - peer, - result: Ok(ping::Success::Ping { .. }), - })) = self.0.next().await + peer, + result: Ok(ping::Success::Ping { .. }), + })) = self.0.next().await { received_pings.insert(peer); } diff --git a/ping/rust/src/bin/testplan_0480.rs b/ping/rust/src/bin/testplan_0480.rs index 51ef95b4f..4e9f2e0e2 100644 --- a/ping/rust/src/bin/testplan_0480.rs +++ b/ping/rust/src/bin/testplan_0480.rs @@ -66,9 +66,9 @@ impl PingSwarm for OrphanRuleWorkaround { while received_pings.len() < number { if let Some(SwarmEvent::Behaviour(ping::Event { - peer, - result: Ok(ping::Success::Ping { .. }), - })) = self.0.next().await + peer, + result: Ok(ping::Success::Ping { .. }), + })) = self.0.next().await { received_pings.insert(peer); } diff --git a/ping/rust/src/bin/testplan_0490.rs b/ping/rust/src/bin/testplan_0490.rs index e45b02b40..19ebd5dbc 100644 --- a/ping/rust/src/bin/testplan_0490.rs +++ b/ping/rust/src/bin/testplan_0490.rs @@ -68,9 +68,9 @@ impl PingSwarm for OrphanRuleWorkaround { while received_pings.len() < number { if let Some(SwarmEvent::Behaviour(ping::Event { - peer, - result: Ok(ping::Success::Ping { .. }), - })) = self.0.next().await + peer, + result: Ok(ping::Success::Ping { .. }), + })) = self.0.next().await { received_pings.insert(peer); } diff --git a/ping/rust/src/bin/testplan_0500.rs b/ping/rust/src/bin/testplan_0500.rs index 38528957c..15fcbf091 100644 --- a/ping/rust/src/bin/testplan_0500.rs +++ b/ping/rust/src/bin/testplan_0500.rs @@ -1,11 +1,29 @@ use anyhow::Result; use async_trait::async_trait; use futures::StreamExt; -use libp2pv0500::core::multiaddr::*; -use libp2pv0500::core::muxing::*; -use libp2pv0500::swarm::{keep_alive, NetworkBehaviour, SwarmEvent}; -use libp2pv0500::*; -use libp2pv0500::{tokio_development_transport, webrtc}; +use libp2pv0500::{ + core::{ + either::EitherOutput, + muxing::StreamMuxerBox, + upgrade::{SelectUpgrade,Version}, + }, + identity, + mplex, + noise, + ping, + swarm::{ + keep_alive, + NetworkBehaviour, + SwarmEvent + }, + tcp, + webrtc, + yamux, + Multiaddr, + PeerId, + Swarm, + Transport, +}; use log::{debug, info}; use rand::thread_rng; use std::{collections::HashSet, time::Duration}; @@ -18,16 +36,23 @@ async fn main() -> Result<()> { let client = testground::client::Client::new_and_init() .await .expect("Unable to init testground cient."); - let transport = match transport_param(&client).as_str() { - "tcp" => tokio_development_transport(local_key)?, - "webrtc" => webrtc::tokio::Transport::new( + let transport = tcp::tokio::Transport::default() + .upgrade(Version::V1) + .authenticate(noise::NoiseAuthenticated::xx(&local_key).unwrap()) + .multiplex(SelectUpgrade::new( + yamux::YamuxConfig::default(), + mplex::MplexConfig::default(), + )) + .timeout(Duration::from_secs(20)) + .or_transport(webrtc::tokio::Transport::new( local_key, webrtc::tokio::Certificate::generate(&mut thread_rng())?, - ) - .map(|(peer_id, conn), _| (peer_id, StreamMuxerBox::new(conn))) - .boxed(), - unhandled => unimplemented!("Transport unhandled in test: '{}'", unhandled), - }; + )) + .map(|either, _| match either { + EitherOutput::First((p, conn)) => (p, StreamMuxerBox::new(conn)), + EitherOutput::Second((p, conn)) => (p, StreamMuxerBox::new(conn)), + }) + .boxed(); let swarm = OrphanRuleWorkaround(Swarm::with_tokio_executor( transport, Behaviour { @@ -104,9 +129,9 @@ impl PingSwarm for OrphanRuleWorkaround { while received_pings.len() < number { if let Some(SwarmEvent::Behaviour(BehaviourEvent::Ping(ping::Event { - peer, - result: Ok(ping::Success::Ping { .. }), - }))) = self.0.next().await + peer, + result: Ok(ping::Success::Ping { .. }), + }))) = self.0.next().await { received_pings.insert(peer); } diff --git a/ping/rust/src/bin/testplan_0510.rs b/ping/rust/src/bin/testplan_0510.rs index 5814cefd7..0c633e4fb 100644 --- a/ping/rust/src/bin/testplan_0510.rs +++ b/ping/rust/src/bin/testplan_0510.rs @@ -2,16 +2,33 @@ use anyhow::Result; use async_trait::async_trait; use futures::StreamExt; use libp2pv0510::{ - core::muxing::StreamMuxerBox, - identity, ping, - swarm::{keep_alive, NetworkBehaviour, SwarmEvent}, - tokio_development_transport, webrtc, Multiaddr, PeerId, Swarm, Transport, + core::{ + either::EitherOutput, + muxing::StreamMuxerBox, + upgrade::{SelectUpgrade,Version}, + }, + identity, + mplex, + noise, + ping, + swarm::{ + keep_alive, + NetworkBehaviour, + SwarmEvent + }, + tcp, + webrtc, + yamux, + Multiaddr, + PeerId, + Swarm, + Transport, }; use log::{debug, info}; use rand::thread_rng; use std::collections::HashSet; use std::time::Duration; -use testplan::{run_ping, transport_param, PingSwarm}; +use testplan::{run_ping, PingSwarm}; #[tokio::main] async fn main() -> Result<()> { @@ -20,16 +37,23 @@ async fn main() -> Result<()> { let client = testground::client::Client::new_and_init() .await .expect("Unable to init testground cient."); - let transport = match transport_param(&client).as_str() { - "tcp" => tokio_development_transport(local_key)?, - "webrtc" => webrtc::tokio::Transport::new( - local_key, - webrtc::tokio::Certificate::generate(&mut thread_rng())?, - ) - .map(|(peer_id, conn), _| (peer_id, StreamMuxerBox::new(conn))) - .boxed(), - unhandled => unimplemented!("Transport unhandled in test: '{}'", unhandled), - }; + let transport = tcp::tokio::Transport::default() + .upgrade(Version::V1) + .authenticate(noise::NoiseAuthenticated::xx(&local_key).unwrap()) + .multiplex(SelectUpgrade::new( + yamux::YamuxConfig::default(), + mplex::MplexConfig::default(), + )) + .timeout(Duration::from_secs(20)) + .or_transport(webrtc::tokio::Transport::new( + local_key, + webrtc::tokio::Certificate::generate(&mut thread_rng())?, + )) + .map(|either, _| match either { + EitherOutput::First((p, conn)) => (p, StreamMuxerBox::new(conn)), + EitherOutput::Second((p, conn)) => (p, StreamMuxerBox::new(conn)), + }) + .boxed(); let swarm = OrphanRuleWorkaround(Swarm::with_tokio_executor( transport, Behaviour { @@ -103,9 +127,9 @@ impl PingSwarm for OrphanRuleWorkaround { while received_pings.len() < number { if let Some(SwarmEvent::Behaviour(BehaviourEvent::Ping(ping::Event { - peer, - result: Ok(ping::Success::Ping { .. }), - }))) = self.0.next().await + peer, + result: Ok(ping::Success::Ping { .. }), + }))) = self.0.next().await { received_pings.insert(peer); } diff --git a/ping/rust/src/lib.rs b/ping/rust/src/lib.rs index 91f105e26..cc6acdac6 100644 --- a/ping/rust/src/lib.rs +++ b/ping/rust/src/lib.rs @@ -50,7 +50,7 @@ pub async fn run_ping(mut swarm: S, client: testground::client::Client) -> Re let local_addr = match transport.as_str() { "tcp" => format!("/ip4/{local_ip_addr}/tcp/{LISTENING_PORT}"), "webrtc" => format!("/ip4/{local_ip_addr}/udp/{LISTENING_PORT}/webrtc"), - unhandled => unimplemented!("Transport unhandled in test: '{}'", unhandled), + unhandled => anyhow::bail!("Transport unhandled in test: '{}'", unhandled), }; info!( "Test instance, listening for incoming connections on: {:?}.", @@ -73,7 +73,7 @@ pub async fn run_ping(mut swarm: S, client: testground::client::Client) -> Re // two peers dialling each other at the same time). // // We can do this because sync service pubsub is ordered. - .take_while(|a| ready(a != &local_addr && a != &dialable_multiaddr)); + .take_while(|a| ready(a != &dialable_multiaddr)); let payload = serde_json::json!({ "ID": swarm.local_peer_id(), From c3207d2aee51710c0253af178aad6a244f657ee4 Mon Sep 17 00:00:00 2001 From: John Turpish Date: Tue, 13 Dec 2022 10:10:26 -0500 Subject: [PATCH 20/24] Positive consequences of previous shifts. --- ping/rust/src/bin/testplan_0440.rs | 5 +---- ping/rust/src/bin/testplan_0451.rs | 6 +----- ping/rust/src/bin/testplan_0461.rs | 5 +---- ping/rust/src/bin/testplan_0470.rs | 5 +---- ping/rust/src/bin/testplan_0480.rs | 5 +---- ping/rust/src/bin/testplan_0490.rs | 5 +---- ping/rust/src/bin/testplan_0500.rs | 9 +-------- ping/rust/src/bin/testplan_0510.rs | 5 +---- ping/rust/src/lib.rs | 8 ++++++-- 9 files changed, 14 insertions(+), 39 deletions(-) diff --git a/ping/rust/src/bin/testplan_0440.rs b/ping/rust/src/bin/testplan_0440.rs index fe549253b..d344fcb36 100644 --- a/ping/rust/src/bin/testplan_0440.rs +++ b/ping/rust/src/bin/testplan_0440.rs @@ -21,10 +21,7 @@ async fn main() -> Result<()> { ), local_peer_id, )); - let client = testground::client::Client::new_and_init() - .await - .expect("Unable to init testground cient."); - run_ping(swarm, client).await?; + run_ping(swarm).await?; Ok(()) } diff --git a/ping/rust/src/bin/testplan_0451.rs b/ping/rust/src/bin/testplan_0451.rs index 221b9752c..a30490a21 100644 --- a/ping/rust/src/bin/testplan_0451.rs +++ b/ping/rust/src/bin/testplan_0451.rs @@ -21,11 +21,7 @@ async fn main() -> Result<()> { ), local_peer_id, )); - let client = testground::client::Client::new_and_init() - .await - .expect("Unable to init testground cient."); - run_ping(swarm, client).await?; - + run_ping(swarm).await?; Ok(()) } diff --git a/ping/rust/src/bin/testplan_0461.rs b/ping/rust/src/bin/testplan_0461.rs index f882bb9f7..40b29958d 100644 --- a/ping/rust/src/bin/testplan_0461.rs +++ b/ping/rust/src/bin/testplan_0461.rs @@ -21,10 +21,7 @@ async fn main() -> Result<()> { ), local_peer_id, )); - let client = testground::client::Client::new_and_init() - .await - .expect("Unable to init testground cient."); - run_ping(swarm, client).await?; + run_ping(swarm).await?; Ok(()) } diff --git a/ping/rust/src/bin/testplan_0470.rs b/ping/rust/src/bin/testplan_0470.rs index 1157d7b3e..e67dd55f1 100644 --- a/ping/rust/src/bin/testplan_0470.rs +++ b/ping/rust/src/bin/testplan_0470.rs @@ -21,10 +21,7 @@ async fn main() -> Result<()> { ), local_peer_id, )); - let client = testground::client::Client::new_and_init() - .await - .expect("Unable to init testground cient."); - run_ping(swarm, client).await?; + run_ping(swarm).await?; Ok(()) } diff --git a/ping/rust/src/bin/testplan_0480.rs b/ping/rust/src/bin/testplan_0480.rs index 4e9f2e0e2..d996bad4e 100644 --- a/ping/rust/src/bin/testplan_0480.rs +++ b/ping/rust/src/bin/testplan_0480.rs @@ -21,10 +21,7 @@ async fn main() -> Result<()> { ), local_peer_id, )); - let client = testground::client::Client::new_and_init() - .await - .expect("Unable to init testground cient."); - run_ping(swarm, client).await?; + run_ping(swarm).await?; Ok(()) } diff --git a/ping/rust/src/bin/testplan_0490.rs b/ping/rust/src/bin/testplan_0490.rs index 19ebd5dbc..0b0766237 100644 --- a/ping/rust/src/bin/testplan_0490.rs +++ b/ping/rust/src/bin/testplan_0490.rs @@ -23,10 +23,7 @@ async fn main() -> Result<()> { ), local_peer_id, )); - let client = testground::client::Client::new_and_init() - .await - .expect("Unable to init testground cient."); - run_ping(swarm, client).await?; + run_ping(swarm).await?; Ok(()) } diff --git a/ping/rust/src/bin/testplan_0500.rs b/ping/rust/src/bin/testplan_0500.rs index 15fcbf091..a7ad36c9a 100644 --- a/ping/rust/src/bin/testplan_0500.rs +++ b/ping/rust/src/bin/testplan_0500.rs @@ -33,9 +33,6 @@ use testplan::*; async fn main() -> Result<()> { let local_key = identity::Keypair::generate_ed25519(); let local_peer_id = PeerId::from(local_key.public()); - let client = testground::client::Client::new_and_init() - .await - .expect("Unable to init testground cient."); let transport = tcp::tokio::Transport::default() .upgrade(Version::V1) .authenticate(noise::NoiseAuthenticated::xx(&local_key).unwrap()) @@ -62,7 +59,7 @@ async fn main() -> Result<()> { local_peer_id, )); - run_ping(swarm, client).await?; + run_ping(swarm).await?; Ok(()) } @@ -87,10 +84,6 @@ impl PingSwarm for OrphanRuleWorkaround { }) = self.0.next().await { if listener_id == id { - debug!( - "NewListenAddr event: listener_id={:?}, address={:?}", - &listener_id, &address - ); return Ok(address.to_string()); } } diff --git a/ping/rust/src/bin/testplan_0510.rs b/ping/rust/src/bin/testplan_0510.rs index 0c633e4fb..7e379e9d5 100644 --- a/ping/rust/src/bin/testplan_0510.rs +++ b/ping/rust/src/bin/testplan_0510.rs @@ -34,9 +34,6 @@ use testplan::{run_ping, PingSwarm}; async fn main() -> Result<()> { let local_key = identity::Keypair::generate_ed25519(); let local_peer_id = PeerId::from(local_key.public()); - let client = testground::client::Client::new_and_init() - .await - .expect("Unable to init testground cient."); let transport = tcp::tokio::Transport::default() .upgrade(Version::V1) .authenticate(noise::NoiseAuthenticated::xx(&local_key).unwrap()) @@ -63,7 +60,7 @@ async fn main() -> Result<()> { local_peer_id, )); - run_ping(swarm, client).await?; + run_ping(swarm).await?; Ok(()) } diff --git a/ping/rust/src/lib.rs b/ping/rust/src/lib.rs index cc6acdac6..1ec40a72e 100644 --- a/ping/rust/src/lib.rs +++ b/ping/rust/src/lib.rs @@ -2,7 +2,7 @@ use anyhow::Result; use env_logger::Env; use futures::future::ready; use futures::{FutureExt, StreamExt}; -use log::info; +use log::{debug,info}; use rand::Rng; use std::borrow::Cow; use std::io; @@ -28,7 +28,7 @@ pub trait PingSwarm: Sized { fn local_peer_id(&self) -> String; } -pub async fn run_ping(mut swarm: S, client: testground::client::Client) -> Result<()> +pub async fn run_ping(mut swarm: S) -> Result<()> where S: PingSwarm, { @@ -36,6 +36,9 @@ pub async fn run_ping(mut swarm: S, client: testground::client::Client) -> Re info!("Running ping test: {}", swarm.local_peer_id()); + let client = testground::client::Client::new_and_init() + .await + .expect("Unable to init testground cient."); let transport = transport_param(&client); let local_ip_addr = match if_addrs::get_if_addrs()? .into_iter() @@ -58,6 +61,7 @@ pub async fn run_ping(mut swarm: S, client: testground::client::Client) -> Re ); let dialable_multiaddr = swarm.listen_on(&local_addr).await?; + debug!("Can be dialed at {}", &dialable_multiaddr); let test_instance_count = client.run_parameters().test_instance_count as usize; let mut address_stream = client From 8696244062de9ef1cf18aa97e35d837c8a38194f Mon Sep 17 00:00:00 2001 From: David DiMaria Date: Wed, 14 Dec 2022 09:19:21 -0700 Subject: [PATCH 21/24] cargo fmt --- ping/rust/src/bin/testplan_0490.rs | 4 +- ping/rust/src/bin/testplan_0500.rs | 31 +++++---------- ping/rust/src/bin/testplan_0510.rs | 63 ++++++++++++------------------ ping/rust/src/lib.rs | 16 ++++---- 4 files changed, 44 insertions(+), 70 deletions(-) diff --git a/ping/rust/src/bin/testplan_0490.rs b/ping/rust/src/bin/testplan_0490.rs index 0b0766237..0d71320b0 100644 --- a/ping/rust/src/bin/testplan_0490.rs +++ b/ping/rust/src/bin/testplan_0490.rs @@ -16,8 +16,8 @@ async fn main() -> Result<()> { development_transport(local_key).await?, ping::Behaviour::new( #[allow(deprecated)] - // TODO: Fixing this deprecation requires https://github.com/libp2p/rust-libp2p/pull/3055. - ping::Config::new() + // TODO: Fixing this deprecation requires https://github.com/libp2p/rust-libp2p/pull/3055. + ping::Config::new() .with_interval(Duration::from_secs(1)) .with_keep_alive(true), ), diff --git a/ping/rust/src/bin/testplan_0500.rs b/ping/rust/src/bin/testplan_0500.rs index a7ad36c9a..4d3bc7668 100644 --- a/ping/rust/src/bin/testplan_0500.rs +++ b/ping/rust/src/bin/testplan_0500.rs @@ -5,24 +5,11 @@ use libp2pv0500::{ core::{ either::EitherOutput, muxing::StreamMuxerBox, - upgrade::{SelectUpgrade,Version}, + upgrade::{SelectUpgrade, Version}, }, - identity, - mplex, - noise, - ping, - swarm::{ - keep_alive, - NetworkBehaviour, - SwarmEvent - }, - tcp, - webrtc, - yamux, - Multiaddr, - PeerId, - Swarm, - Transport, + identity, mplex, noise, ping, + swarm::{keep_alive, NetworkBehaviour, SwarmEvent}, + tcp, webrtc, yamux, Multiaddr, PeerId, Swarm, Transport, }; use log::{debug, info}; use rand::thread_rng; @@ -79,9 +66,9 @@ impl PingSwarm for OrphanRuleWorkaround { let id = self.0.listen_on(address.parse()?)?; loop { if let Some(SwarmEvent::NewListenAddr { - listener_id, - address, - }) = self.0.next().await + listener_id, + address, + }) = self.0.next().await { if listener_id == id { return Ok(address.to_string()); @@ -102,8 +89,8 @@ impl PingSwarm for OrphanRuleWorkaround { while connected.len() < number { match self.0.next().await { Some(SwarmEvent::ConnectionEstablished { - peer_id, endpoint, .. - }) => { + peer_id, endpoint, .. + }) => { info!( "Connection established! {}={}", &peer_id, diff --git a/ping/rust/src/bin/testplan_0510.rs b/ping/rust/src/bin/testplan_0510.rs index 7e379e9d5..900907fad 100644 --- a/ping/rust/src/bin/testplan_0510.rs +++ b/ping/rust/src/bin/testplan_0510.rs @@ -5,24 +5,11 @@ use libp2pv0510::{ core::{ either::EitherOutput, muxing::StreamMuxerBox, - upgrade::{SelectUpgrade,Version}, + upgrade::{SelectUpgrade, Version}, }, - identity, - mplex, - noise, - ping, - swarm::{ - keep_alive, - NetworkBehaviour, - SwarmEvent - }, - tcp, - webrtc, - yamux, - Multiaddr, - PeerId, - Swarm, - Transport, + identity, mplex, noise, ping, + swarm::{keep_alive, NetworkBehaviour, SwarmEvent}, + tcp, webrtc, yamux, Multiaddr, PeerId, Swarm, Transport, }; use log::{debug, info}; use rand::thread_rng; @@ -35,22 +22,22 @@ async fn main() -> Result<()> { let local_key = identity::Keypair::generate_ed25519(); let local_peer_id = PeerId::from(local_key.public()); let transport = tcp::tokio::Transport::default() - .upgrade(Version::V1) - .authenticate(noise::NoiseAuthenticated::xx(&local_key).unwrap()) - .multiplex(SelectUpgrade::new( - yamux::YamuxConfig::default(), - mplex::MplexConfig::default(), - )) - .timeout(Duration::from_secs(20)) - .or_transport(webrtc::tokio::Transport::new( - local_key, - webrtc::tokio::Certificate::generate(&mut thread_rng())?, - )) - .map(|either, _| match either { - EitherOutput::First((p, conn)) => (p, StreamMuxerBox::new(conn)), - EitherOutput::Second((p, conn)) => (p, StreamMuxerBox::new(conn)), - }) - .boxed(); + .upgrade(Version::V1) + .authenticate(noise::NoiseAuthenticated::xx(&local_key).unwrap()) + .multiplex(SelectUpgrade::new( + yamux::YamuxConfig::default(), + mplex::MplexConfig::default(), + )) + .timeout(Duration::from_secs(20)) + .or_transport(webrtc::tokio::Transport::new( + local_key, + webrtc::tokio::Certificate::generate(&mut thread_rng())?, + )) + .map(|either, _| match either { + EitherOutput::First((p, conn)) => (p, StreamMuxerBox::new(conn)), + EitherOutput::Second((p, conn)) => (p, StreamMuxerBox::new(conn)), + }) + .boxed(); let swarm = OrphanRuleWorkaround(Swarm::with_tokio_executor( transport, Behaviour { @@ -81,9 +68,9 @@ impl PingSwarm for OrphanRuleWorkaround { loop { if let Some(SwarmEvent::NewListenAddr { - listener_id, - address, - }) = self.0.next().await + listener_id, + address, + }) = self.0.next().await { if listener_id == id { return Ok(address.to_string()); @@ -104,8 +91,8 @@ impl PingSwarm for OrphanRuleWorkaround { while connected.len() < number { match self.0.next().await { Some(SwarmEvent::ConnectionEstablished { - peer_id, endpoint, .. - }) => { + peer_id, endpoint, .. + }) => { info!( "Connection established! {}={}", &peer_id, diff --git a/ping/rust/src/lib.rs b/ping/rust/src/lib.rs index 1ec40a72e..20df3a244 100644 --- a/ping/rust/src/lib.rs +++ b/ping/rust/src/lib.rs @@ -2,7 +2,7 @@ use anyhow::Result; use env_logger::Env; use futures::future::ready; use futures::{FutureExt, StreamExt}; -use log::{debug,info}; +use log::{debug, info}; use rand::Rng; use std::borrow::Cow; use std::io; @@ -29,8 +29,8 @@ pub trait PingSwarm: Sized { } pub async fn run_ping(mut swarm: S) -> Result<()> - where - S: PingSwarm, +where + S: PingSwarm, { env_logger::Builder::from_env(Env::default().default_filter_or("info")).init(); @@ -165,8 +165,8 @@ pub async fn run_ping(mut swarm: S) -> Result<()> } async fn ping(client: &testground::client::Client, swarm: &mut S, tag: String) -> Result<()> - where - S: PingSwarm, +where + S: PingSwarm, { info!("Wait to receive ping from each peer."); @@ -182,8 +182,8 @@ async fn signal_wait_and_drive_swarm( swarm: &mut S, tag: String, ) -> Result<()> - where - S: PingSwarm, +where + S: PingSwarm, { info!( "Signal and wait for all peers to signal being done with \"{}\".", @@ -197,7 +197,7 @@ async fn signal_wait_and_drive_swarm( .signal_and_wait(tag, client.run_parameters().test_instance_count) .boxed_local(), ) - .await; + .await; Ok(()) } From c916d4b247d40d20fee995ea070779365426814a Mon Sep 17 00:00:00 2001 From: David DiMaria Date: Wed, 14 Dec 2022 14:08:03 -0700 Subject: [PATCH 22/24] fix clippy lints --- ping/rust/src/lib.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ping/rust/src/lib.rs b/ping/rust/src/lib.rs index 20df3a244..f1b3e5097 100644 --- a/ping/rust/src/lib.rs +++ b/ping/rust/src/lib.rs @@ -206,7 +206,6 @@ pub fn transport_param(client: &testground::client::Client) -> String { client .run_parameters() .test_instance_params - .get("transport") - .map(|s| s.clone()) + .get("transport").cloned() .unwrap_or_else(|| "tcp".to_owned()) } From 3dab17b054cf6306ae27fe09a34840850a174366 Mon Sep 17 00:00:00 2001 From: David DiMaria Date: Wed, 14 Dec 2022 14:52:33 -0700 Subject: [PATCH 23/24] prefer Anyhow's context --- ping/rust/src/bin/testplan_0510.rs | 2 +- ping/rust/src/lib.rs | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ping/rust/src/bin/testplan_0510.rs b/ping/rust/src/bin/testplan_0510.rs index 900907fad..5b4f8b975 100644 --- a/ping/rust/src/bin/testplan_0510.rs +++ b/ping/rust/src/bin/testplan_0510.rs @@ -94,7 +94,7 @@ impl PingSwarm for OrphanRuleWorkaround { peer_id, endpoint, .. }) => { info!( - "Connection established! {}={}", + "Connection established! {}={:?}", &peer_id, &endpoint.get_remote_address() ); diff --git a/ping/rust/src/lib.rs b/ping/rust/src/lib.rs index f1b3e5097..ab7400962 100644 --- a/ping/rust/src/lib.rs +++ b/ping/rust/src/lib.rs @@ -1,11 +1,10 @@ -use anyhow::Result; +use anyhow::{Context, Result}; use env_logger::Env; use futures::future::ready; use futures::{FutureExt, StreamExt}; use log::{debug, info}; use rand::Rng; use std::borrow::Cow; -use std::io; use std::time::Duration; use testground::network_conf::{ FilterAction, LinkShape, NetworkConfiguration, RoutingPolicyType, DEFAULT_DATA_NETWORK, @@ -38,12 +37,13 @@ where let client = testground::client::Client::new_and_init() .await - .expect("Unable to init testground cient."); + .map_err(|e| anyhow::anyhow!(e.to_string())) + .context("Unable to init testground cient.")?; let transport = transport_param(&client); let local_ip_addr = match if_addrs::get_if_addrs()? .into_iter() .find(|iface| iface.name == "eth1") - .ok_or_else(|| io::Error::new(io::ErrorKind::Other, "Can't find iface eth1"))? + .context("Can't find iface eth1")? .addr .ip() { @@ -206,6 +206,7 @@ pub fn transport_param(client: &testground::client::Client) -> String { client .run_parameters() .test_instance_params - .get("transport").cloned() + .get("transport") + .cloned() .unwrap_or_else(|| "tcp".to_owned()) } From 26f311a9bb4cb95236ce7805841a92c9009e6724 Mon Sep 17 00:00:00 2001 From: David DiMaria Date: Wed, 14 Dec 2022 21:19:20 -0700 Subject: [PATCH 24/24] Improve logging, fix typo --- ping/rust/src/lib.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/ping/rust/src/lib.rs b/ping/rust/src/lib.rs index ab7400962..a38b11aea 100644 --- a/ping/rust/src/lib.rs +++ b/ping/rust/src/lib.rs @@ -38,8 +38,7 @@ where let client = testground::client::Client::new_and_init() .await .map_err(|e| anyhow::anyhow!(e.to_string())) - .context("Unable to init testground cient.")?; - let transport = transport_param(&client); + .context("Unable to init testground client.")?; let local_ip_addr = match if_addrs::get_if_addrs()? .into_iter() .find(|iface| iface.name == "eth1") @@ -50,7 +49,7 @@ where std::net::IpAddr::V4(addr) => addr.to_string(), std::net::IpAddr::V6(_) => unimplemented!(), }; - let local_addr = match transport.as_str() { + let local_addr = match transport_param(&client).as_ref() { "tcp" => format!("/ip4/{local_ip_addr}/tcp/{LISTENING_PORT}"), "webrtc" => format!("/ip4/{local_ip_addr}/udp/{LISTENING_PORT}/webrtc"), unhandled => anyhow::bail!("Transport unhandled in test: '{}'", unhandled), @@ -102,7 +101,12 @@ where swarm .await_connections(client.run_parameters().test_instance_count as usize - 1) .await; - info!("Connections awaited."); + + info!( + "Connected to {} peers", + client.run_parameters().test_instance_count - 1 + ); + signal_wait_and_drive_swarm(&client, &mut swarm, "connected".to_string()).await?; ping(&client, &mut swarm, "initial".to_string()).await?; @@ -208,5 +212,5 @@ pub fn transport_param(client: &testground::client::Client) -> String { .test_instance_params .get("transport") .cloned() - .unwrap_or_else(|| "tcp".to_owned()) + .unwrap_or_else(|| "tcp".into()) }