diff --git a/Cargo.lock b/Cargo.lock index d9e1837..9368318 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,6 +17,53 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common", + "generic-array", +] + +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "aes-gcm" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" +dependencies = [ + "aead", + "aes", + "cipher", + "ctr", + "ghash", + "subtle", +] + +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -26,6 +73,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" + [[package]] name = "anstream" version = "0.6.14" @@ -87,12 +140,6 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" -[[package]] -name = "arrayvec" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" - [[package]] name = "asn1-rs" version = "0.6.1" @@ -118,7 +165,7 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.60", - "synstructure 0.13.1", + "synstructure", ] [[package]] @@ -132,6 +179,36 @@ dependencies = [ "syn 2.0.60", ] +[[package]] +name = "async-io" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d6baa8f0178795da0e71bc42c9e5d13261aac7ee549853162e66a241ba17964" +dependencies = [ + "async-lock", + "cfg-if", + "concurrent-queue", + "futures-io", + "futures-lite", + "parking", + "polling", + "rustix", + "slab", + "tracing", + "windows-sys 0.52.0", +] + +[[package]] +name = "async-lock" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18" +dependencies = [ + "event-listener", + "event-listener-strategy", + "pin-project-lite", +] + [[package]] name = "async-stream" version = "0.3.5" @@ -156,21 +233,45 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.80" +version = "0.1.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" +checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" dependencies = [ "proc-macro2", "quote", "syn 2.0.60", ] +[[package]] +name = "asynchronous-codec" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a860072022177f903e59730004fb5dc13db9275b79bb2aef7ba8ce831956c233" +dependencies = [ + "bytes", + "futures-sink", + "futures-util", + "memchr", + "pin-project-lite", +] + [[package]] name = "atomic-waker" version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" +[[package]] +name = "attohttpc" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d9a9bf8b79a749ee0b911b91b671cc2b6c670bdbc7e3dfd537576ddc94bb2a2" +dependencies = [ + "http 0.2.12", + "log", + "url", +] + [[package]] name = "autocfg" version = "1.3.0" @@ -188,7 +289,7 @@ dependencies = [ "bytes", "futures-util", "http 1.1.0", - "http-body", + "http-body 1.0.1", "http-body-util", "itoa", "matchit", @@ -214,7 +315,7 @@ dependencies = [ "bytes", "futures-util", "http 1.1.0", - "http-body", + "http-body 1.0.1", "http-body-util", "mime", "pin-project-lite", @@ -245,18 +346,6 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - [[package]] name = "base64" version = "0.22.1" @@ -271,43 +360,23 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "bitflags" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" - -[[package]] -name = "blake2b_simd" -version = "1.0.2" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23285ad32269793932e830392f2fe2f83e26488fd3ec778883a93c8323735780" -dependencies = [ - "arrayref", - "arrayvec", - "constant_time_eq", -] +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] -name = "blake2s_simd" -version = "1.0.2" +name = "bitflags" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94230421e395b9920d23df13ea5d77a20e1725331f90fbbf6df6040b33f756ae" -dependencies = [ - "arrayref", - "arrayvec", - "constant_time_eq", -] +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] -name = "blake3" -version = "1.5.1" +name = "blake2" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30cca6d3674597c30ddf2c587bf8d9d65c9a84d2326d941cc79c9842dfe0ef52" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ - "arrayref", - "arrayvec", - "cc", - "cfg-if", - "constant_time_eq", + "digest", ] [[package]] @@ -321,9 +390,12 @@ dependencies = [ [[package]] name = "bs58" -version = "0.4.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" +dependencies = [ + "tinyvec", +] [[package]] name = "bumpalo" @@ -356,16 +428,38 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] -name = "cid" +name = "chacha20" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "chacha20poly1305" version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd94671561e36e4e7de75f753f577edafb0e7c05d6e4547229fdf7938fbcd2c3" +checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" dependencies = [ - "core2", - "multibase", - "multihash 0.18.1", - "serde", - "unsigned-varint 0.7.2", + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", + "zeroize", ] [[package]] @@ -402,13 +496,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" [[package]] -name = "combine" -version = "4.6.7" +name = "concurrent-queue" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" dependencies = [ - "bytes", - "memchr", + "crossbeam-utils", ] [[package]] @@ -417,12 +510,6 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" -[[package]] -name = "constant_time_eq" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" - [[package]] name = "core-foundation" version = "0.9.4" @@ -458,25 +545,10 @@ dependencies = [ ] [[package]] -name = "crc" -version = "3.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" -dependencies = [ - "crc-catalog", -] - -[[package]] -name = "crc-catalog" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" - -[[package]] -name = "crunchy" -version = "0.2.2" +name = "crossbeam-utils" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" [[package]] name = "crypto-common" @@ -485,9 +557,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", + "rand_core", "typenum", ] +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + [[package]] name = "curve25519-dalek" version = "4.1.2" @@ -544,16 +626,15 @@ dependencies = [ [[package]] name = "dephy-pproxy" -version = "0.1.1" +version = "0.2.1" dependencies = [ - "base64 0.22.1", + "async-trait", "clap", "futures", - "futures-util", + "futures_ringbuf", "hex", - "litep2p", - "multiaddr", - "prost 0.13.1", + "libp2p", + "prost", "thiserror", "tokio", "tokio-util", @@ -619,12 +700,6 @@ dependencies = [ "syn 2.0.60", ] -[[package]] -name = "downcast" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" - [[package]] name = "ed25519" version = "2.2.3" @@ -662,7 +737,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ffccbb6966c05b32ef8fbac435df276c4ae4d3dc55a8cd0eb9745e6c12f546a" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "syn 2.0.60", @@ -684,6 +759,27 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "event-listener" +version = "5.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6032be9bd27023a771701cc49f9f053c751055f71efb2e0ae5c15809093675ba" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f214dc438f977e6d4e3500aaa277f5ad94ca83fbbd9b1a15713ce2344ccc5a1" +dependencies = [ + "event-listener", + "pin-project-lite", +] + [[package]] name = "fastrand" version = "2.1.0" @@ -708,21 +804,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "form_urlencoded" version = "1.2.1" @@ -732,12 +813,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "fragile" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" - [[package]] name = "futures" version = "0.3.30" @@ -753,6 +828,16 @@ dependencies = [ "futures-util", ] +[[package]] +name = "futures-bounded" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91f328e7fb845fc832912fb6a34f40cf6d1888c92f974d1893a54e97b5ff542e" +dependencies = [ + "futures-timer", + "futures-util", +] + [[package]] name = "futures-channel" version = "0.3.30" @@ -778,6 +863,7 @@ dependencies = [ "futures-core", "futures-task", "futures-util", + "num_cpus", ] [[package]] @@ -786,6 +872,16 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +[[package]] +name = "futures-lite" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" +dependencies = [ + "futures-core", + "pin-project-lite", +] + [[package]] name = "futures-macro" version = "0.3.30" @@ -797,6 +893,17 @@ dependencies = [ "syn 2.0.60", ] +[[package]] +name = "futures-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f2f12607f92c69b12ed746fabf9ca4f5c482cba46679c1a75b874ed7c26adb" +dependencies = [ + "futures-io", + "rustls", + "rustls-pki-types", +] + [[package]] name = "futures-sink" version = "0.3.30" @@ -834,12 +941,15 @@ dependencies = [ ] [[package]] -name = "fxhash" -version = "0.2.1" +name = "futures_ringbuf" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +checksum = "6628abb6eb1fc74beaeb20cd0670c43d158b0150f7689b38c3eaf663f99bdec7" dependencies = [ - "byteorder", + "futures", + "log", + "ringbuf", + "rustc_version", ] [[package]] @@ -863,12 +973,41 @@ dependencies = [ "wasi", ] +[[package]] +name = "ghash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1" +dependencies = [ + "opaque-debug", + "polyval", +] + [[package]] name = "gimli" version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +[[package]] +name = "h2" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 0.2.12", + "indexmap 2.2.6", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "h2" version = "0.4.5" @@ -899,6 +1038,10 @@ name = "hashbrown" version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", + "allocator-api2", +] [[package]] name = "heck" @@ -906,6 +1049,12 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hermit-abi" version = "0.3.9" @@ -913,33 +1062,79 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] -name = "hex" -version = "0.4.3" +name = "hermit-abi" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" [[package]] -name = "hex-literal" -version = "0.4.1" +name = "hex" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] -name = "hmac" -version = "0.12.1" +name = "hickory-proto" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +checksum = "07698b8420e2f0d6447a436ba999ec85d8fbf2a398bbd737b82cac4a2e96e512" dependencies = [ - "digest", + "async-trait", + "cfg-if", + "data-encoding", + "enum-as-inner", + "futures-channel", + "futures-io", + "futures-util", + "idna 0.4.0", + "ipnet", + "once_cell", + "rand", + "socket2", + "thiserror", + "tinyvec", + "tokio", + "tracing", + "url", ] [[package]] -name = "home" -version = "0.5.9" +name = "hickory-resolver" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +checksum = "28757f23aa75c98f254cf0405e6d8c25b831b32921b050a66692427679b1f243" dependencies = [ - "windows-sys 0.52.0", + "cfg-if", + "futures-util", + "hickory-proto", + "ipconfig", + "lru-cache", + "once_cell", + "parking_lot", + "rand", + "resolv-conf", + "smallvec", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", ] [[package]] @@ -975,6 +1170,17 @@ dependencies = [ "itoa", ] +[[package]] +name = "http-body" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +dependencies = [ + "bytes", + "http 0.2.12", + "pin-project-lite", +] + [[package]] name = "http-body" version = "1.0.1" @@ -994,7 +1200,7 @@ dependencies = [ "bytes", "futures-util", "http 1.1.0", - "http-body", + "http-body 1.0.1", "pin-project-lite", ] @@ -1010,6 +1216,30 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" +[[package]] +name = "hyper" +version = "0.14.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + [[package]] name = "hyper" version = "1.4.1" @@ -1019,9 +1249,9 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "h2", + "h2 0.4.5", "http 1.1.0", - "http-body", + "http-body 1.0.1", "httparse", "httpdate", "itoa", @@ -1037,7 +1267,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3203a961e5c83b6f5498933e78b6b263e208c197b63e9c6c53cc82ffd3f63793" dependencies = [ - "hyper", + "hyper 1.4.1", "hyper-util", "pin-project-lite", "tokio", @@ -1054,10 +1284,10 @@ dependencies = [ "futures-channel", "futures-util", "http 1.1.0", - "http-body", - "hyper", + "http-body 1.0.1", + "hyper 1.4.1", "pin-project-lite", - "socket2 0.5.7", + "socket2", "tokio", "tower", "tower-service", @@ -1084,6 +1314,54 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "if-addrs" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cabb0019d51a643781ff15c9c8a3e5dedc365c47211270f4e8f82812fedd8f0a" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "if-watch" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6b0422c86d7ce0e97169cc42e04ae643caf278874a7a3c87b8150a220dc7e1e" +dependencies = [ + "async-io", + "core-foundation", + "fnv", + "futures", + "if-addrs", + "ipnet", + "log", + "rtnetlink", + "system-configuration", + "tokio", + "windows", +] + +[[package]] +name = "igd-next" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "064d90fec10d541084e7b39ead8875a5a80d9114a2b18791565253bae25f49e4" +dependencies = [ + "async-trait", + "attohttpc", + "bytes", + "futures", + "http 0.2.12", + "hyper 0.14.30", + "log", + "rand", + "tokio", + "url", + "xmltree", +] + [[package]] name = "indexmap" version = "1.9.3" @@ -1104,13 +1382,31 @@ dependencies = [ "hashbrown 0.14.5", ] +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array", +] + +[[package]] +name = "instant" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" +dependencies = [ + "cfg-if", +] + [[package]] name = "ipconfig" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" dependencies = [ - "socket2 0.5.7", + "socket2", "widestring", "windows-sys 0.48.0", "winreg", @@ -1152,15 +1448,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "keccak" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" -dependencies = [ - "cpufeatures", -] - [[package]] name = "lazy_static" version = "1.4.0" @@ -1174,71 +1461,328 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" [[package]] -name = "linked-hash-map" -version = "0.5.6" +name = "libp2p" +version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" +checksum = "681fb3f183edfbedd7a57d32ebe5dcdc0b9f94061185acf3c30249349cc6fc99" +dependencies = [ + "bytes", + "either", + "futures", + "futures-timer", + "getrandom", + "instant", + "libp2p-allow-block-list", + "libp2p-connection-limits", + "libp2p-core", + "libp2p-dns", + "libp2p-identity", + "libp2p-mdns", + "libp2p-noise", + "libp2p-quic", + "libp2p-request-response", + "libp2p-swarm", + "libp2p-tcp", + "libp2p-upnp", + "libp2p-yamux", + "multiaddr", + "pin-project", + "rw-stream-sink", + "thiserror", +] [[package]] -name = "linux-raw-sys" -version = "0.4.13" +name = "libp2p-allow-block-list" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" +checksum = "107b238b794cb83ab53b74ad5dcf7cca3200899b72fe662840cfb52f5b0a32e6" +dependencies = [ + "libp2p-core", + "libp2p-identity", + "libp2p-swarm", + "void", +] [[package]] -name = "litep2p" -version = "0.6.2" -source = "git+https://github.com/Ma233/litep2p.git?rev=144d81c#144d81c160748b99e88ef53e0561349deda8dad6" +name = "libp2p-connection-limits" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7cd50a78ccfada14de94cbacd3ce4b0138157f376870f13d3a8422cd075b4fd" dependencies = [ - "async-trait", - "bs58", - "bytes", - "cid", - "ed25519-dalek", + "libp2p-core", + "libp2p-identity", + "libp2p-swarm", + "void", +] + +[[package]] +name = "libp2p-core" +version = "0.41.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5a8920cbd8540059a01950c1e5c96ea8d89eb50c51cd366fc18bdf540a6e48f" +dependencies = [ + "either", + "fnv", "futures", "futures-timer", - "hex-literal", - "indexmap 2.2.6", - "libc", - "mockall", + "libp2p-identity", "multiaddr", - "multihash 0.17.0", - "network-interface", - "nohash-hasher", + "multihash", + "multistream-select", + "once_cell", "parking_lot", "pin-project", - "prost 0.12.6", - "prost-build 0.11.9", - "quinn", + "quick-protobuf", + "rand", + "rw-stream-sink", + "smallvec", + "thiserror", + "tracing", + "unsigned-varint 0.8.0", + "void", + "web-time", +] + +[[package]] +name = "libp2p-dns" +version = "0.41.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d17cbcf7160ff35c3e8e560de4a068fe9d6cb777ea72840e48eb76ff9576c4b6" +dependencies = [ + "async-trait", + "futures", + "hickory-resolver", + "libp2p-core", + "libp2p-identity", + "parking_lot", + "smallvec", + "tracing", +] + +[[package]] +name = "libp2p-identity" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55cca1eb2bc1fd29f099f3daaab7effd01e1a54b7c577d0ed082521034d912e8" +dependencies = [ + "bs58", + "ed25519-dalek", + "hkdf", + "multihash", + "quick-protobuf", "rand", - "rcgen", - "ring 0.16.20", - "rustls 0.20.9", - "serde", "sha2", - "simple-dns", + "thiserror", + "tracing", + "zeroize", +] + +[[package]] +name = "libp2p-mdns" +version = "0.45.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49007d9a339b3e1d7eeebc4d67c05dbf23d300b7d091193ec2d3f26802d7faf2" +dependencies = [ + "data-encoding", + "futures", + "hickory-proto", + "if-watch", + "libp2p-core", + "libp2p-identity", + "libp2p-swarm", + "rand", "smallvec", + "socket2", + "tokio", + "tracing", + "void", +] + +[[package]] +name = "libp2p-noise" +version = "0.44.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecd0545ce077f6ea5434bcb76e8d0fe942693b4380aaad0d34a358c2bd05793" +dependencies = [ + "asynchronous-codec", + "bytes", + "curve25519-dalek", + "futures", + "libp2p-core", + "libp2p-identity", + "multiaddr", + "multihash", + "once_cell", + "quick-protobuf", + "rand", + "sha2", "snow", - "socket2 0.5.7", "static_assertions", - "str0m", "thiserror", - "tokio", - "tokio-stream", - "tokio-tungstenite", - "tokio-util", "tracing", - "trust-dns-resolver", - "uint", - "unsigned-varint 0.8.0", - "url", - "webpki", "x25519-dalek", + "zeroize", +] + +[[package]] +name = "libp2p-quic" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c67296ad4e092e23f92aea3d2bdb6f24eab79c0929ed816dfb460ea2f4567d2b" +dependencies = [ + "bytes", + "futures", + "futures-timer", + "if-watch", + "libp2p-core", + "libp2p-identity", + "libp2p-tls", + "parking_lot", + "quinn", + "rand", + "ring 0.17.8", + "rustls", + "socket2", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "libp2p-request-response" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c314fe28368da5e3a262553fb0ad575c1c8934c461e10de10265551478163836" +dependencies = [ + "async-trait", + "futures", + "futures-bounded", + "futures-timer", + "instant", + "libp2p-core", + "libp2p-identity", + "libp2p-swarm", + "rand", + "smallvec", + "tracing", + "void", +] + +[[package]] +name = "libp2p-swarm" +version = "0.44.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80cae6cb75f89dbca53862f9ebe0b9f463aa7b302762fcfaafb9e51dcc9b0f7e" +dependencies = [ + "either", + "fnv", + "futures", + "futures-timer", + "instant", + "libp2p-core", + "libp2p-identity", + "libp2p-swarm-derive", + "lru", + "multistream-select", + "once_cell", + "rand", + "smallvec", + "tokio", + "tracing", + "void", +] + +[[package]] +name = "libp2p-swarm-derive" +version = "0.34.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5daceb9dd908417b6dfcfe8e94098bc4aac54500c282e78120b885dadc09b999" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.60", +] + +[[package]] +name = "libp2p-tcp" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b2460fc2748919adff99ecbc1aab296e4579e41f374fb164149bd2c9e529d4c" +dependencies = [ + "futures", + "futures-timer", + "if-watch", + "libc", + "libp2p-core", + "libp2p-identity", + "socket2", + "tokio", + "tracing", +] + +[[package]] +name = "libp2p-tls" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "251b17aebdd29df7e8f80e4d94b782fae42e934c49086e1a81ba23b60a8314f2" +dependencies = [ + "futures", + "futures-rustls", + "libp2p-core", + "libp2p-identity", + "rcgen", + "ring 0.17.8", + "rustls", + "rustls-webpki 0.101.7", + "thiserror", "x509-parser", "yasna", - "zeroize", ] +[[package]] +name = "libp2p-upnp" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccf04b0e3ff3de52d07d5fd6c3b061d0e7f908ffc683c32d9638caedce86fc8" +dependencies = [ + "futures", + "futures-timer", + "igd-next", + "libp2p-core", + "libp2p-swarm", + "tokio", + "tracing", + "void", +] + +[[package]] +name = "libp2p-yamux" +version = "0.45.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "200cbe50349a44760927d50b431d77bed79b9c0a3959de1af8d24a63434b71e5" +dependencies = [ + "either", + "futures", + "libp2p-core", + "thiserror", + "tracing", + "yamux 0.12.1", + "yamux 0.13.3", +] + +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + +[[package]] +name = "linux-raw-sys" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" + [[package]] name = "lock_api" version = "0.4.12" @@ -1255,6 +1799,15 @@ version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +[[package]] +name = "lru" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc" +dependencies = [ + "hashbrown 0.14.5", +] + [[package]] name = "lru-cache" version = "0.1.2" @@ -1323,45 +1876,18 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "mockall" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43766c2b5203b10de348ffe19f7e54564b64f3d6018ff7648d1e2d6d3a0f0a48" -dependencies = [ - "cfg-if", - "downcast", - "fragile", - "lazy_static", - "mockall_derive", - "predicates", - "predicates-tree", -] - -[[package]] -name = "mockall_derive" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af7cbce79ec385a1d4f54baa90a76401eb15d9cab93685f62e7e9f942aa00ae2" -dependencies = [ - "cfg-if", - "proc-macro2", - "quote", - "syn 2.0.60", -] - [[package]] name = "multiaddr" -version = "0.17.1" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b36f567c7099511fa8612bbbb52dda2419ce0bdbacf31714e3a5ffdb766d3bd" +checksum = "8b852bc02a2da5feed68cd14fa50d0774b92790a5bdbfa932a813926c8472070" dependencies = [ "arrayref", "byteorder", "data-encoding", - "log", + "libp2p-identity", "multibase", - "multihash 0.17.0", + "multihash", "percent-encoding", "serde", "static_assertions", @@ -1382,64 +1908,109 @@ dependencies = [ [[package]] name = "multihash" -version = "0.17.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "835d6ff01d610179fbce3de1694d007e500bf33a7f29689838941d6bf783ae40" +checksum = "076d548d76a0e2a0d4ab471d0b1c36c577786dfc4471242035d97a12a735c492" dependencies = [ "core2", - "digest", - "multihash-derive", - "sha2", "unsigned-varint 0.7.2", ] [[package]] -name = "multihash" -version = "0.18.1" +name = "multimap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" + +[[package]] +name = "multistream-select" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfd8a792c1694c6da4f68db0a9d707c72bd260994da179e6030a5dcee00bb815" +checksum = "ea0df8e5eec2298a62b326ee4f0d7fe1a6b90a09dfcf9df37b38f947a8c42f19" dependencies = [ - "blake2b_simd", - "blake2s_simd", - "blake3", - "core2", - "digest", - "multihash-derive", - "sha2", - "sha3", + "bytes", + "futures", + "log", + "pin-project", + "smallvec", "unsigned-varint 0.7.2", ] [[package]] -name = "multihash-derive" -version = "0.8.1" +name = "netlink-packet-core" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6d4752e6230d8ef7adf7bd5d8c4b1f6561c1014c5ba9a37445ccefe18aa1db" +checksum = "345b8ab5bd4e71a2986663e88c56856699d060e78e152e6e9d7966fcd5491297" dependencies = [ - "proc-macro-crate", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", - "synstructure 0.12.6", + "anyhow", + "byteorder", + "libc", + "netlink-packet-utils", ] [[package]] -name = "multimap" -version = "0.8.3" +name = "netlink-packet-route" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" +checksum = "d9ea4302b9759a7a88242299225ea3688e63c85ea136371bb6cf94fd674efaab" +dependencies = [ + "anyhow", + "bitflags 1.3.2", + "byteorder", + "libc", + "netlink-packet-core", + "netlink-packet-utils", +] [[package]] -name = "network-interface" -version = "1.1.4" +name = "netlink-packet-utils" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a43439bf756eed340bdf8feba761e2d50c7d47175d87545cd5cbe4a137c4d1" +checksum = "0ede8a08c71ad5a95cdd0e4e52facd37190977039a4704eb82a283f713747d34" dependencies = [ - "cc", - "libc", + "anyhow", + "byteorder", + "paste", "thiserror", - "winapi", +] + +[[package]] +name = "netlink-proto" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65b4b14489ab424703c092062176d52ba55485a89c076b4f9db05092b7223aa6" +dependencies = [ + "bytes", + "futures", + "log", + "netlink-packet-core", + "netlink-sys", + "thiserror", + "tokio", +] + +[[package]] +name = "netlink-sys" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "416060d346fbaf1f23f9512963e3e878f1a78e707cb699ba9215761754244307" +dependencies = [ + "bytes", + "futures", + "libc", + "log", + "tokio", +] + +[[package]] +name = "nix" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" +dependencies = [ + "bitflags 1.3.2", + "cfg-if", + "libc", ] [[package]] @@ -1508,7 +2079,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi", + "hermit-abi 0.3.9", "libc", ] @@ -1537,64 +2108,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] -name = "openssl" -version = "0.10.64" +name = "opaque-debug" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" -dependencies = [ - "bitflags", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] -name = "openssl-macros" +name = "overload" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.60", -] - -[[package]] -name = "openssl-probe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" - -[[package]] -name = "openssl-src" -version = "300.2.3+3.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cff92b6f71555b61bb9315f7c64da3ca43d87531622120fea0195fc761b4843" -dependencies = [ - "cc", -] - -[[package]] -name = "openssl-sys" -version = "0.9.102" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" -dependencies = [ - "cc", - "libc", - "openssl-src", - "pkg-config", - "vcpkg", -] +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] -name = "overload" -version = "0.1.1" +name = "parking" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" +checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" [[package]] name = "parking_lot" @@ -1619,13 +2148,20 @@ dependencies = [ "windows-targets 0.52.5", ] +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + [[package]] name = "pem" -version = "1.1.1" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" +checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae" dependencies = [ - "base64 0.13.1", + "base64", + "serde", ] [[package]] @@ -1686,12 +2222,6 @@ dependencies = [ "spki", ] -[[package]] -name = "pkg-config" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" - [[package]] name = "platforms" version = "3.4.0" @@ -1699,95 +2229,63 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db23d408679286588f4d4644f965003d056e3dd5abcaaa938116871d7ce2fee7" [[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - -[[package]] -name = "ppv-lite86" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" - -[[package]] -name = "predicates" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b87bfd4605926cdfefc1c3b5f8fe560e3feca9d5552cf68c466d3d8236c7e8" -dependencies = [ - "anstyle", - "predicates-core", -] - -[[package]] -name = "predicates-core" -version = "1.0.6" +name = "polling" +version = "3.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b794032607612e7abeb4db69adb4e33590fa6cf1149e95fd7cb00e634b92f174" - -[[package]] -name = "predicates-tree" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368ba315fb8c5052ab692e68a0eefec6ec57b23a36959c14496f0b0df2c0cecf" +checksum = "a3ed00ed3fbf728b5816498ecd316d1716eecaced9c0c8d2c5a6740ca214985b" dependencies = [ - "predicates-core", - "termtree", + "cfg-if", + "concurrent-queue", + "hermit-abi 0.4.0", + "pin-project-lite", + "rustix", + "tracing", + "windows-sys 0.52.0", ] [[package]] -name = "prettyplease" -version = "0.1.25" +name = "poly1305" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" dependencies = [ - "proc-macro2", - "syn 1.0.109", + "cpufeatures", + "opaque-debug", + "universal-hash", ] [[package]] -name = "prettyplease" -version = "0.2.20" +name = "polyval" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" +checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" dependencies = [ - "proc-macro2", - "syn 2.0.60", + "cfg-if", + "cpufeatures", + "opaque-debug", + "universal-hash", ] [[package]] -name = "proc-macro-crate" -version = "1.1.3" +name = "powerfmt" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e17d47ce914bf4de440332250b0edd23ce48c005f59fab39d3335866b114f11a" -dependencies = [ - "thiserror", - "toml", -] +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] -name = "proc-macro-error" -version = "1.0.4" +name = "ppv-lite86" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] -name = "proc-macro-error-attr" -version = "1.0.4" +name = "prettyplease" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" dependencies = [ "proc-macro2", - "quote", - "version_check", + "syn 2.0.60", ] [[package]] @@ -1799,26 +2297,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "prost" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" -dependencies = [ - "bytes", - "prost-derive 0.11.9", -] - -[[package]] -name = "prost" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29" -dependencies = [ - "bytes", - "prost-derive 0.12.6", -] - [[package]] name = "prost" version = "0.13.1" @@ -1826,29 +2304,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e13db3d3fde688c61e2446b4d843bc27a7e8af269a69440c0308021dc92333cc" dependencies = [ "bytes", - "prost-derive 0.13.1", -] - -[[package]] -name = "prost-build" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" -dependencies = [ - "bytes", - "heck", - "itertools", - "lazy_static", - "log", - "multimap", - "petgraph", - "prettyplease 0.1.25", - "prost 0.11.9", - "prost-types 0.11.9", - "regex", - "syn 1.0.109", - "tempfile", - "which", + "prost-derive", ] [[package]] @@ -1858,46 +2314,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5bb182580f71dd070f88d01ce3de9f4da5021db7115d2e1c3605a754153b77c1" dependencies = [ "bytes", - "heck", + "heck 0.5.0", "itertools", "log", "multimap", "once_cell", "petgraph", - "prettyplease 0.2.20", - "prost 0.13.1", - "prost-types 0.13.1", + "prettyplease", + "prost", + "prost-types", "regex", "syn 2.0.60", "tempfile", ] -[[package]] -name = "prost-derive" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" -dependencies = [ - "anyhow", - "itertools", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "prost-derive" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" -dependencies = [ - "anyhow", - "itertools", - "proc-macro2", - "quote", - "syn 2.0.60", -] - [[package]] name = "prost-derive" version = "0.13.1" @@ -1911,22 +2341,13 @@ dependencies = [ "syn 2.0.60", ] -[[package]] -name = "prost-types" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" -dependencies = [ - "prost 0.11.9", -] - [[package]] name = "prost-types" version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cee5168b05f49d4b0ca581206eb14a7b22fafd963efe729ac48eb03266e25cc2" dependencies = [ - "prost 0.13.1", + "prost", ] [[package]] @@ -1935,53 +2356,60 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" +[[package]] +name = "quick-protobuf" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d6da84cc204722a989e01ba2f6e1e276e190f22263d0cb6ce8526fcdb0d2e1f" +dependencies = [ + "byteorder", +] + [[package]] name = "quinn" -version = "0.9.4" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e8b432585672228923edbbf64b8b12c14e1112f62e88737655b4a083dbcd78e" +checksum = "e4ceeeeabace7857413798eb1ffa1e9c905a9946a57d81fb69b4b71c4d8eb3ad" dependencies = [ "bytes", + "futures-io", "pin-project-lite", "quinn-proto", "quinn-udp", "rustc-hash", - "rustls 0.20.9", + "rustls", "thiserror", "tokio", "tracing", - "webpki", ] [[package]] name = "quinn-proto" -version = "0.9.6" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94b0b33c13a79f669c85defaf4c275dc86a0c0372807d0ca3d78e0bb87274863" +checksum = "ddf517c03a109db8100448a4be38d498df8a210a99fe0e1b9eaf39e78c640efe" dependencies = [ "bytes", "rand", - "ring 0.16.20", + "ring 0.17.8", "rustc-hash", - "rustls 0.20.9", + "rustls", "slab", "thiserror", "tinyvec", "tracing", - "webpki", ] [[package]] name = "quinn-udp" -version = "0.3.2" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "641538578b21f5e5c8ea733b736895576d0fe329bb883b937db6f4d163dbaaf4" +checksum = "8bffec3605b73c6f1754535084a85229fa8a30f86014e6c81aeec4abb68b0285" dependencies = [ "libc", - "quinn-proto", - "socket2 0.4.10", - "tracing", - "windows-sys 0.42.0", + "once_cell", + "socket2", + "windows-sys 0.52.0", ] [[package]] @@ -2025,9 +2453,9 @@ dependencies = [ [[package]] name = "rcgen" -version = "0.10.0" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffbe84efe2f38dea12e9bfc1f65377fdf03e53a18cb3b995faedf7934c7e785b" +checksum = "52c4f3084aa3bc7dfbba4eff4fab2a54db4324965d8872ab933565e6fbd83bc6" dependencies = [ "pem", "ring 0.16.20", @@ -2041,7 +2469,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" dependencies = [ - "bitflags", + "bitflags 2.5.0", ] [[package]] @@ -2128,6 +2556,30 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "ringbuf" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79abed428d1fd2a128201cec72c5f6938e2da607c6f3745f769fabea399d950a" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "rtnetlink" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "322c53fd76a18698f1c27381d58091de3a043d356aa5bd0d510608b565f469a0" +dependencies = [ + "futures", + "log", + "netlink-packet-route", + "netlink-proto", + "nix", + "thiserror", + "tokio", +] + [[package]] name = "rustc-demangle" version = "0.1.23" @@ -2164,7 +2616,7 @@ version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags", + "bitflags 2.5.0", "errno", "libc", "linux-raw-sys", @@ -2173,55 +2625,42 @@ dependencies = [ [[package]] name = "rustls" -version = "0.20.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b80e3dec595989ea8510028f30c408a4630db12c9cbb8de34203b89d6577e99" -dependencies = [ - "ring 0.16.20", - "sct", - "webpki", -] - -[[package]] -name = "rustls" -version = "0.21.12" +version = "0.23.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" +checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" dependencies = [ - "log", + "once_cell", "ring 0.17.8", - "rustls-webpki", - "sct", + "rustls-pki-types", + "rustls-webpki 0.102.6", + "subtle", + "zeroize", ] [[package]] -name = "rustls-native-certs" -version = "0.6.3" +name = "rustls-pki-types" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" -dependencies = [ - "openssl-probe", - "rustls-pemfile", - "schannel", - "security-framework", -] +checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" [[package]] -name = "rustls-pemfile" -version = "1.0.4" +name = "rustls-webpki" +version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "base64 0.21.7", + "ring 0.17.8", + "untrusted 0.9.0", ] [[package]] name = "rustls-webpki" -version = "0.101.7" +version = "0.102.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e" dependencies = [ "ring 0.17.8", + "rustls-pki-types", "untrusted 0.9.0", ] @@ -2232,12 +2671,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "092474d1a01ea8278f69e6a358998405fae5b8b963ddaeb2b0b04a128bf1dfb0" [[package]] -name = "schannel" -version = "0.1.23" +name = "rw-stream-sink" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +checksum = "d8c9026ff5d2f23da5e45bbc283f156383001bfb09c4e44256d02c1a685fe9a1" dependencies = [ - "windows-sys 0.52.0", + "futures", + "pin-project", + "static_assertions", ] [[package]] @@ -2246,54 +2687,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "sct" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" -dependencies = [ - "ring 0.17.8", - "untrusted 0.9.0", -] - -[[package]] -name = "sctp-proto" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6220f78bb44c15f326b0596113305f6101097a18755d53727a575c97e09fb24" -dependencies = [ - "bytes", - "crc", - "fxhash", - "log", - "rand", - "slab", - "thiserror", -] - -[[package]] -name = "security-framework" -version = "2.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" -dependencies = [ - "bitflags", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "semver" version = "1.0.22" @@ -2320,57 +2713,15 @@ dependencies = [ "syn 2.0.60", ] -[[package]] -name = "sha-1" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", - "sha1-asm", -] - -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "sha1-asm" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ba6947745e7f86be3b8af00b7355857085dbdf8901393c89514510eb61f4e21" -dependencies = [ - "cc", -] - [[package]] name = "sha2" version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "sha3" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ + "cfg-if", + "cpufeatures", "digest", - "keccak", ] [[package]] @@ -2391,15 +2742,6 @@ dependencies = [ "rand_core", ] -[[package]] -name = "simple-dns" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cae9a3fcdadafb6d97f4c0e007e4247b114ee0f119f650c3cbf3a8b3a1479694" -dependencies = [ - "bitflags", -] - [[package]] name = "slab" version = "0.4.9" @@ -2421,22 +2763,17 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "850948bee068e713b8ab860fe1adc4d109676ab4c3b621fd8147f06b261f2f85" dependencies = [ + "aes-gcm", + "blake2", + "chacha20poly1305", + "curve25519-dalek", "rand_core", "ring 0.17.8", "rustc_version", + "sha2", "subtle", ] -[[package]] -name = "socket2" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "socket2" version = "0.5.7" @@ -2475,26 +2812,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "str0m" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6706347e49b13373f7ddfafad47df7583ed52083d6fc8a594eb2c80497ef959d" -dependencies = [ - "combine", - "crc", - "fastrand", - "hmac", - "once_cell", - "openssl", - "openssl-sys", - "sctp-proto", - "serde", - "sha-1", - "thiserror", - "tracing", -] - [[package]] name = "strsim" version = "0.11.1" @@ -2543,25 +2860,34 @@ checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" [[package]] name = "synstructure" -version = "0.12.6" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", - "unicode-xid", + "syn 2.0.60", ] [[package]] -name = "synstructure" -version = "0.13.1" +name = "system-configuration" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.60", + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", ] [[package]] @@ -2576,12 +2902,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "termtree" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" - [[package]] name = "thiserror" version = "1.0.61" @@ -2669,9 +2989,8 @@ dependencies = [ "libc", "mio", "num_cpus", - "parking_lot", "pin-project-lite", - "socket2 0.5.7", + "socket2", "tokio-macros", "windows-sys 0.48.0", ] @@ -2687,16 +3006,6 @@ dependencies = [ "syn 2.0.60", ] -[[package]] -name = "tokio-rustls" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" -dependencies = [ - "rustls 0.21.12", - "tokio", -] - [[package]] name = "tokio-stream" version = "0.1.15" @@ -2708,21 +3017,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-tungstenite" -version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c" -dependencies = [ - "futures-util", - "log", - "rustls 0.21.12", - "rustls-native-certs", - "tokio", - "tokio-rustls", - "tungstenite", -] - [[package]] name = "tokio-util" version = "0.7.11" @@ -2731,21 +3025,11 @@ checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" dependencies = [ "bytes", "futures-core", - "futures-io", "futures-sink", "pin-project-lite", "tokio", ] -[[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "serde", -] - [[package]] name = "tonic" version = "0.12.1" @@ -2755,19 +3039,19 @@ dependencies = [ "async-stream", "async-trait", "axum", - "base64 0.22.1", + "base64", "bytes", - "h2", + "h2 0.4.5", "http 1.1.0", - "http-body", + "http-body 1.0.1", "http-body-util", - "hyper", + "hyper 1.4.1", "hyper-timeout", "hyper-util", "percent-encoding", "pin-project", - "prost 0.13.1", - "socket2 0.5.7", + "prost", + "socket2", "tokio", "tokio-stream", "tower", @@ -2782,9 +3066,9 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "568392c5a2bd0020723e3f387891176aabafe36fd9fcd074ad309dfa0c8eb964" dependencies = [ - "prettyplease 0.2.20", + "prettyplease", "proc-macro2", - "prost-build 0.13.1", + "prost-build", "quote", "syn 2.0.60", ] @@ -2795,10 +3079,10 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8dc0e36ac436560b9a8c9edad4521cf5dd5deb1af591936db9660191b6ecf619" dependencies = [ - "base64 0.22.1", + "base64", "bytes", "http 1.1.0", - "http-body", + "http-body 1.0.1", "http-body-util", "pin-project", "tokio-stream", @@ -2835,10 +3119,10 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5" dependencies = [ - "bitflags", + "bitflags 2.5.0", "bytes", "http 1.1.0", - "http-body", + "http-body 1.0.1", "http-body-util", "pin-project-lite", "tower-layer", @@ -2863,7 +3147,6 @@ version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -2919,96 +3202,18 @@ dependencies = [ "tracing-log", ] -[[package]] -name = "trust-dns-proto" -version = "0.23.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3119112651c157f4488931a01e586aa459736e9d6046d3bd9105ffb69352d374" -dependencies = [ - "async-trait", - "cfg-if", - "data-encoding", - "enum-as-inner", - "futures-channel", - "futures-io", - "futures-util", - "idna 0.4.0", - "ipnet", - "once_cell", - "rand", - "smallvec", - "thiserror", - "tinyvec", - "tokio", - "tracing", - "url", -] - -[[package]] -name = "trust-dns-resolver" -version = "0.23.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a3e6c3aff1718b3c73e395d1f35202ba2ffa847c6a62eea0db8fb4cfe30be6" -dependencies = [ - "cfg-if", - "futures-util", - "ipconfig", - "lru-cache", - "once_cell", - "parking_lot", - "rand", - "resolv-conf", - "smallvec", - "thiserror", - "tokio", - "tracing", - "trust-dns-proto", -] - [[package]] name = "try-lock" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" -[[package]] -name = "tungstenite" -version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e3dac10fd62eaf6617d3a904ae222845979aec67c615d1c842b4002c7666fb9" -dependencies = [ - "byteorder", - "bytes", - "data-encoding", - "http 0.2.12", - "httparse", - "log", - "rand", - "rustls 0.21.12", - "sha1", - "thiserror", - "url", - "utf-8", -] - [[package]] name = "typenum" version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" -[[package]] -name = "uint" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" -dependencies = [ - "byteorder", - "crunchy", - "hex", - "static_assertions", -] - [[package]] name = "unicode-bidi" version = "0.3.15" @@ -3031,10 +3236,14 @@ dependencies = [ ] [[package]] -name = "unicode-xid" -version = "0.2.4" +name = "universal-hash" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] [[package]] name = "unsigned-varint" @@ -3047,10 +3256,6 @@ name = "unsigned-varint" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eb066959b24b5196ae73cb057f45598450d2c5f71460e98c49b738086eff9c06" -dependencies = [ - "bytes", - "tokio-util", -] [[package]] name = "untrusted" @@ -3075,12 +3280,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "utf-8" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" - [[package]] name = "utf8parse" version = "0.2.1" @@ -3093,18 +3292,18 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + [[package]] name = "want" version = "0.3.1" @@ -3185,25 +3384,13 @@ dependencies = [ ] [[package]] -name = "webpki" -version = "0.22.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53" -dependencies = [ - "ring 0.17.8", - "untrusted 0.9.0", -] - -[[package]] -name = "which" -version = "4.4.2" +name = "web-time" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" dependencies = [ - "either", - "home", - "once_cell", - "rustix", + "js-sys", + "wasm-bindgen", ] [[package]] @@ -3235,18 +3422,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "windows-sys" -version = "0.42.0" +name = "windows" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca229916c5ee38c2f2bc1e9d8f04df975b4bd93f9955dc69fabb5d91270045c9" +dependencies = [ + "windows-core", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-core" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", + "windows-targets 0.48.5", ] [[package]] @@ -3298,12 +3489,6 @@ dependencies = [ "windows_x86_64_msvc 0.52.5", ] -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" @@ -3316,12 +3501,6 @@ version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" - [[package]] name = "windows_aarch64_msvc" version = "0.48.5" @@ -3334,12 +3513,6 @@ version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" -[[package]] -name = "windows_i686_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" - [[package]] name = "windows_i686_gnu" version = "0.48.5" @@ -3358,12 +3531,6 @@ version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" -[[package]] -name = "windows_i686_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" - [[package]] name = "windows_i686_msvc" version = "0.48.5" @@ -3376,12 +3543,6 @@ version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -3394,12 +3555,6 @@ version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" - [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" @@ -3412,12 +3567,6 @@ version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" - [[package]] name = "windows_x86_64_msvc" version = "0.48.5" @@ -3469,6 +3618,52 @@ dependencies = [ "time", ] +[[package]] +name = "xml-rs" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791978798f0597cfc70478424c2b4fdc2b7a8024aaff78497ef00f24ef674193" + +[[package]] +name = "xmltree" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7d8a75eaf6557bb84a65ace8609883db44a29951042ada9b393151532e41fcb" +dependencies = [ + "xml-rs", +] + +[[package]] +name = "yamux" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed0164ae619f2dc144909a9f082187ebb5893693d8c0196e8085283ccd4b776" +dependencies = [ + "futures", + "log", + "nohash-hasher", + "parking_lot", + "pin-project", + "rand", + "static_assertions", +] + +[[package]] +name = "yamux" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31b5e376a8b012bee9c423acdbb835fc34d45001cfa3106236a624e4b738028" +dependencies = [ + "futures", + "log", + "nohash-hasher", + "parking_lot", + "pin-project", + "rand", + "static_assertions", + "web-time", +] + [[package]] name = "yasna" version = "0.5.2" @@ -3478,6 +3673,26 @@ dependencies = [ "time", ] +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.60", +] + [[package]] name = "zeroize" version = "1.8.1" diff --git a/Cargo.toml b/Cargo.toml index 2ab5601..2ffeff9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,17 +1,14 @@ [package] name = "dephy-pproxy" -version = "0.1.1" +version = "0.2.1" edition = "2021" [dependencies] -base64 = "0.22.1" +async-trait = "0.1.81" clap = "4.5.4" futures = "0.3.30" -futures-util = "0.3.30" hex = "0.4.3" -litep2p = { git = "https://github.com/Ma233/litep2p.git", rev = "144d81c" } -# Do not upgrade multiaddr, see: https://github.com/paritytech/litep2p/pull/91 -multiaddr = "0.17.1" +libp2p = { version = "0.53.2", features = ["tokio", "macros", "yamux", "noise", "tcp", "request-response"] } prost = "0.13.1" thiserror = "1.0.60" tokio = { version = "1.37.0", features = ["rt-multi-thread"] } @@ -27,3 +24,6 @@ tonic-build = "0.12.1" [[bin]] name = "pproxy" path = "src/main.rs" + +[dev-dependencies] +futures_ringbuf = "0.4.0" diff --git a/src/error.rs b/src/error.rs index b18b291..fdd8480 100644 --- a/src/error.rs +++ b/src/error.rs @@ -15,10 +15,8 @@ pub enum Error { TunnelIdParseError(String), #[error("Essential task closed")] EssentialTaskClosed, - #[error("Litep2p error: {0}")] - Litep2p(#[from] litep2p::Error), - #[error("Litep2p request response error: {0:?}")] - Litep2pRequestResponseError(litep2p::protocol::request_response::RequestResponseError), + #[error("Libp2p swarm create error: {0}")] + Libp2pSwarmCreateError(String), #[error("Protocol not support: {0}")] ProtocolNotSupport(String), #[error("Unexpected response type")] @@ -73,12 +71,6 @@ impl From for Error { } } -impl From for Error { - fn from(err: litep2p::protocol::request_response::RequestResponseError) -> Self { - Error::Litep2pRequestResponseError(err) - } -} - impl From for Error { fn from(error: TunnelError) -> Self { Error::Tunnel(error) diff --git a/src/lib.rs b/src/lib.rs index 7755986..d192e24 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,21 +5,22 @@ use std::sync::Arc; use std::sync::Mutex; use futures::channel::oneshot; -use litep2p::crypto::ed25519::SecretKey; -use litep2p::protocol::request_response::DialOptions; -use litep2p::protocol::request_response::RequestResponseEvent; -use litep2p::types::RequestId; -use litep2p::PeerId; -use multiaddr::Multiaddr; -use multiaddr::Protocol; -use prost::Message; +use futures::StreamExt; +use libp2p::identity::Keypair; +use libp2p::multiaddr; +use libp2p::request_response; +use libp2p::swarm::SwarmEvent; +use libp2p::Multiaddr; +use libp2p::PeerId; +use libp2p::Swarm; use tokio::sync::mpsc; use crate::command::proto::AddPeerRequest; use crate::command::proto::AddPeerResponse; use crate::command::proto::CreateTunnelServerRequest; use crate::command::proto::CreateTunnelServerResponse; -use crate::server::*; +use crate::p2p::PProxyNetworkBehaviour; +use crate::p2p::PProxyNetworkBehaviourEvent; use crate::tunnel::proto; use crate::tunnel::tcp_connect_with_timeout; use crate::tunnel::Tunnel; @@ -29,7 +30,7 @@ use crate::types::*; pub mod auth; pub mod command; pub mod error; -mod server; +mod p2p; mod tunnel; pub mod types; @@ -45,7 +46,7 @@ pub const LOCAL_TCP_TIMEOUT: u64 = 5; /// Timeout for remote TCP server. pub const REMOTE_TCP_TIMEOUT: u64 = 30; -/// Public result type error type used by the crate. +/// Public result type and error type used by the crate. pub use crate::error::Error; pub type Result = std::result::Result; @@ -79,9 +80,9 @@ pub enum PProxyCommandResponse { pub struct PProxy { command_tx: mpsc::Sender<(PProxyCommand, CommandNotifier)>, command_rx: mpsc::Receiver<(PProxyCommand, CommandNotifier)>, - p2p_server: P2pServer, + swarm: Swarm, proxy_addr: Option, - outbound_ready_notifiers: HashMap, + outbound_ready_notifiers: HashMap, inbound_tunnels: HashMap<(PeerId, TunnelId), Tunnel>, tunnel_txs: HashMap<(PeerId, TunnelId), mpsc::Sender>>, } @@ -92,36 +93,21 @@ pub struct PProxyHandle { tunnel_servers: Mutex>, } -pub enum FullLength { - NotParsed, - NotSet, - Chunked, - Parsed(usize), -} - -impl FullLength { - pub fn not_parsed(&self) -> bool { - matches!(self, FullLength::NotParsed) - } - - pub fn chunked(&self) -> bool { - matches!(self, FullLength::Chunked) - } -} - impl PProxy { pub fn new( - secret_key: SecretKey, - server_addr: SocketAddr, + keypair: Keypair, + listen_addr: SocketAddr, proxy_addr: Option, - ) -> (Self, PProxyHandle) { + ) -> Result<(Self, PProxyHandle)> { let (command_tx, command_rx) = mpsc::channel(DEFAULT_CHANNEL_SIZE); + let swarm = crate::p2p::new_swarm(keypair, listen_addr) + .map_err(|e| Error::Libp2pSwarmCreateError(e.to_string()))?; - ( + Ok(( Self { command_tx: command_tx.clone(), command_rx, - p2p_server: P2pServer::new(secret_key, server_addr), + swarm, proxy_addr, outbound_ready_notifiers: HashMap::new(), inbound_tunnels: HashMap::new(), @@ -132,7 +118,7 @@ impl PProxy { next_tunnel_id: Default::default(), tunnel_servers: Default::default(), }, - ) + )) } pub async fn run(mut self) { @@ -141,9 +127,8 @@ impl PProxy { // Events coming from the network have higher priority than user commands biased; - event = self.p2p_server.next_event() => match event { - None => return, - Some(event) => if let Err(error) = self.handle_p2p_server_event(event).await { + event = self.swarm.select_next_some() => { + if let Err(error) = self.handle_p2p_server_event(event).await { tracing::warn!("failed to handle event: {:?}", error); } }, @@ -176,122 +161,125 @@ impl PProxy { Ok(()) } - async fn handle_p2p_server_event(&mut self, event: P2pServerEvent) -> Result<()> { - tracing::debug!("received P2pServerEvent: {:?}", event); + async fn handle_p2p_server_event( + &mut self, + event: SwarmEvent, + ) -> Result<()> { + tracing::debug!("received SwarmEvent: {:?}", event); + #[allow(clippy::single_match)] match event { - P2pServerEvent::Litep2p(ev) => { - tracing::debug!("received Litep2p event: {:?}", ev); - } - P2pServerEvent::TunnelEvent(RequestResponseEvent::RequestReceived { - peer, - request_id, - request, - .. - }) => { - let msg = proto::Tunnel::decode(request.as_slice())?; - tracing::debug!("received Tunnel request msg: {:?}", msg); - - match msg.command() { - proto::TunnelCommand::Connect => { - tracing::info!("received connect command from peer: {:?}", peer); - let Some(proxy_addr) = self.proxy_addr else { - return Err(Error::ProtocolNotSupport("No proxy_addr".to_string())); - }; - - let tunnel_id = msg - .tunnel_id - .parse() - .map_err(|_| Error::TunnelIdParseError(msg.tunnel_id))?; - - let data = match self.dial_tunnel(proxy_addr, peer, tunnel_id).await { - Ok(_) => None, - Err(e) => { - tracing::warn!("failed to dial tunnel: {:?}", e); - Some(e.to_string().into_bytes()) - } - }; - - let response = proto::Tunnel { - tunnel_id: tunnel_id.to_string(), - command: proto::TunnelCommand::ConnectResp.into(), - data, - }; - - self.p2p_server - .tunnel_handle - .send_response(request_id, response.encode_to_vec()); - } + SwarmEvent::Behaviour(PProxyNetworkBehaviourEvent::RequestResponse( + request_response::Event::Message { peer, message }, + )) => match message { + request_response::Message::Request { + request, channel, .. + } => { + match request.command() { + proto::TunnelCommand::Connect => { + tracing::info!("received connect command from peer: {:?}", peer); + let Some(proxy_addr) = self.proxy_addr else { + return Err(Error::ProtocolNotSupport("No proxy_addr".to_string())); + }; + + let tunnel_id = request + .tunnel_id + .parse() + .map_err(|_| Error::TunnelIdParseError(request.tunnel_id))?; + + let data = match self.dial_tunnel(proxy_addr, peer, tunnel_id).await { + Ok(_) => None, + Err(e) => { + tracing::warn!("failed to dial tunnel: {:?}", e); + Some(e.to_string().into_bytes()) + } + }; + + let response = proto::Tunnel { + tunnel_id: tunnel_id.to_string(), + command: proto::TunnelCommand::ConnectResp.into(), + data, + }; + + self.swarm + .behaviour_mut() + .request_response + .send_response(channel, Some(response)) + .map_err(|_| Error::EssentialTaskClosed)?; + } - proto::TunnelCommand::Package => { - let tunnel_id = msg - .tunnel_id - .parse() - .map_err(|_| Error::TunnelIdParseError(msg.tunnel_id))?; + proto::TunnelCommand::Package => { + let tunnel_id = request + .tunnel_id + .parse() + .map_err(|_| Error::TunnelIdParseError(request.tunnel_id))?; + + let Some(tx) = self.tunnel_txs.get(&(peer, tunnel_id)) else { + return Err(Error::ProtocolNotSupport( + "No tunnel for Package".to_string(), + )); + }; + + tx.send(request.data.unwrap_or_default()).await?; + + // Have to do this to close the response waiter in remote. + self.swarm + .behaviour_mut() + .request_response + .send_response(channel, None) + .map_err(|_| Error::EssentialTaskClosed)?; + } - let Some(tx) = self.tunnel_txs.get(&(peer, tunnel_id)) else { + _ => { return Err(Error::ProtocolNotSupport( - "No tunnel for Package".to_string(), + "Wrong tunnel request command".to_string(), )); - }; - - tx.send(msg.data.unwrap_or_default()).await?; - - // Have to do this to close the response waiter in remote. - self.p2p_server - .tunnel_handle - .send_response(request_id, vec![]); - } - - _ => { - return Err(Error::ProtocolNotSupport( - "Wrong tunnel request command".to_string(), - )); + } } } - } - P2pServerEvent::TunnelEvent(RequestResponseEvent::ResponseReceived { - peer, - request_id, - response, - .. - }) => { - // This is response of TunnelCommand::Package - if response.is_empty() { - return Ok(()); - } - - let msg = proto::Tunnel::decode(response.as_slice())?; - tracing::debug!("received Tunnel response msg: {:?}", msg); - - match msg.command() { - proto::TunnelCommand::ConnectResp => { - let tx = self - .outbound_ready_notifiers - .remove(&request_id) - .ok_or_else(|| { - Error::TunnelNotWaiting(format!( - "peer {}, tunnel {}", - peer, msg.tunnel_id - )) - })?; - - match msg.data { - None => tx.send(Ok(PProxyCommandResponse::SendConnectCommand {})), - Some(data) => tx.send(Err(Error::TunnelDialFailed( - String::from_utf8(data) - .unwrap_or("Unknown (decode failed)".to_string()), - ))), + request_response::Message::Response { + request_id, + response, + } => { + // This is response of TunnelCommand::Package + let Some(response) = response else { + return Ok(()); + }; + + match response.command() { + proto::TunnelCommand::ConnectResp => { + let tx = self + .outbound_ready_notifiers + .remove(&request_id) + .ok_or_else(|| { + Error::TunnelNotWaiting(format!( + "peer {}, tunnel {}", + peer, response.tunnel_id + )) + })?; + + match response.data { + None => tx.send(Ok(PProxyCommandResponse::SendConnectCommand {})), + Some(data) => tx.send(Err(Error::TunnelDialFailed( + String::from_utf8(data) + .unwrap_or("Unknown (decode failed)".to_string()), + ))), + } + .map_err(|_| Error::EssentialTaskClosed)?; } - .map_err(|_| Error::EssentialTaskClosed)?; - } - _ => { - return Err(Error::ProtocolNotSupport( - "Wrong tunnel response command".to_string(), - )); + _ => { + return Err(Error::ProtocolNotSupport( + "Wrong tunnel response command".to_string(), + )); + } } } + }, + + SwarmEvent::NewListenAddr { mut address, .. } => { + address.push(multiaddr::Protocol::P2p(*self.swarm.local_peer_id())); + println!("Local node is listening on {address}"); } _ => {} @@ -330,9 +318,7 @@ impl PProxy { peer_id: PeerId, tx: CommandNotifier, ) -> Result<()> { - self.p2p_server - .litep2p - .add_known_address(peer_id, vec![addr].into_iter()); + self.swarm.add_peer_address(peer_id, addr); tx.send(Ok(PProxyCommandResponse::AddPeer { peer_id })) .map_err(|_| Error::EssentialTaskClosed) @@ -351,15 +337,14 @@ impl PProxy { tunnel_id: tunnel_id.to_string(), command: proto::TunnelCommand::Connect.into(), data: None, - } - .encode_to_vec(); + }; tracing::info!("send connect command to peer_id: {:?}", peer_id); let request_id = self - .p2p_server - .tunnel_handle - .send_request(peer_id, request, DialOptions::Dial) - .await?; + .swarm + .behaviour_mut() + .request_response + .send_request(&peer_id, request); self.outbound_ready_notifiers.insert(request_id, tx); @@ -377,13 +362,12 @@ impl PProxy { tunnel_id: tunnel_id.to_string(), command: proto::TunnelCommand::Package.into(), data: Some(data), - } - .encode_to_vec(); + }; - self.p2p_server - .tunnel_handle - .send_request(peer_id, request, DialOptions::Dial) - .await?; + self.swarm + .behaviour_mut() + .request_response + .send_request(&peer_id, request); tx.send(Ok(PProxyCommandResponse::SendOutboundPackageCommand {})) .map_err(|_| Error::EssentialTaskClosed) @@ -458,12 +442,11 @@ impl PProxyHandle { fn extract_peer_id_from_multiaddr(multiaddr: &Multiaddr) -> Result { let protocol = multiaddr.iter().last(); - let Some(Protocol::P2p(multihash)) = protocol else { + let Some(multiaddr::Protocol::P2p(peer_id)) = protocol else { return Err(Error::FailedToExtractPeerIdFromMultiaddr( multiaddr.to_string(), )); }; - PeerId::from_multihash(multihash) - .map_err(|_| Error::FailedToExtractPeerIdFromMultiaddr(multiaddr.to_string())) + Ok(peer_id) } diff --git a/src/main.rs b/src/main.rs index da9d758..be8e686 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,8 +9,8 @@ use dephy_pproxy::command::proto::AddPeerRequest; use dephy_pproxy::command::proto::CreateTunnelServerRequest; use dephy_pproxy::command::PProxyCommander; use dephy_pproxy::PProxy; -use litep2p::crypto::ed25519::SecretKey; -use multiaddr::Multiaddr; +use libp2p::identity; +use libp2p::Multiaddr; use tonic::transport::Server; fn parse_args() -> Command { @@ -89,10 +89,11 @@ async fn serve(args: &ArgMatches) { let key = args .get_one::("KEY") .map(|key| { - SecretKey::try_from_bytes(hex::decode(key).expect("Invalid key")).expect("Invalid key") + identity::ed25519::SecretKey::try_from_bytes(hex::decode(key).expect("Invalid key")) + .expect("Invalid key") }) .unwrap_or_else(|| { - let key = SecretKey::generate(); + let key = identity::ed25519::SecretKey::generate(); println!("Generated key: {}", hex::encode(&key)); key }); @@ -113,7 +114,12 @@ async fn serve(args: &ArgMatches) { println!("server_addr: {}", server_addr); println!("commander_server_addr: {}", commander_server_addr); - let (pproxy, pproxy_handle) = PProxy::new(key, server_addr, proxy_addr); + let (pproxy, pproxy_handle) = PProxy::new( + identity::ed25519::Keypair::from(key).into(), + server_addr, + proxy_addr, + ) + .expect("Create pproxy failed"); let commander = PProxyCommander::new(pproxy_handle); let commander_server = diff --git a/src/p2p/behaviour.rs b/src/p2p/behaviour.rs new file mode 100644 index 0000000..ecc3661 --- /dev/null +++ b/src/p2p/behaviour.rs @@ -0,0 +1,24 @@ +use libp2p::identity::Keypair; +use libp2p::request_response; +use libp2p::swarm::NetworkBehaviour; +use libp2p::StreamProtocol; + +use crate::p2p::codec::Codec; + +#[derive(NetworkBehaviour)] +pub(crate) struct PProxyNetworkBehaviour { + pub(crate) request_response: request_response::Behaviour, +} + +impl PProxyNetworkBehaviour { + pub fn new(_key: &Keypair) -> Self { + let request_response = request_response::Behaviour::new( + [( + StreamProtocol::new("/pproxy/1"), + request_response::ProtocolSupport::Full, + )], + request_response::Config::default(), + ); + Self { request_response } + } +} diff --git a/src/p2p/codec.rs b/src/p2p/codec.rs new file mode 100644 index 0000000..5fcc2ca --- /dev/null +++ b/src/p2p/codec.rs @@ -0,0 +1,153 @@ +use std::io; + +use async_trait::async_trait; +use futures::prelude::*; +use libp2p::swarm::StreamProtocol; +use prost::Message; + +use crate::tunnel::proto; + +/// Max request size in bytes +const REQUEST_SIZE_MAXIMUM: u64 = 1024 * 1024; +/// Max response size in bytes +const RESPONSE_SIZE_MAXIMUM: u64 = 10 * 1024 * 1024; + +#[derive(Clone, Default)] +pub struct Codec; + +#[async_trait] +impl libp2p::request_response::Codec for Codec { + type Protocol = StreamProtocol; + type Request = proto::Tunnel; + type Response = Option; + + async fn read_request( + &mut self, + _: &Self::Protocol, + io: &mut T, + ) -> io::Result + where + T: AsyncRead + Unpin + Send, + { + let mut vec = Vec::new(); + + io.take(REQUEST_SIZE_MAXIMUM).read_to_end(&mut vec).await?; + + proto::Tunnel::decode(vec.as_slice()).map_err(decode_into_io_error) + } + + async fn read_response( + &mut self, + _: &Self::Protocol, + io: &mut T, + ) -> io::Result + where + T: AsyncRead + Unpin + Send, + { + let mut vec = Vec::new(); + + io.take(RESPONSE_SIZE_MAXIMUM).read_to_end(&mut vec).await?; + + if vec.is_empty() { + return Ok(None); + } + + proto::Tunnel::decode(vec.as_slice()) + .map(Some) + .map_err(decode_into_io_error) + } + + async fn write_request( + &mut self, + _: &Self::Protocol, + io: &mut T, + req: Self::Request, + ) -> io::Result<()> + where + T: AsyncWrite + Unpin + Send, + { + let data = req.encode_to_vec(); + io.write_all(data.as_ref()).await?; + Ok(()) + } + + async fn write_response( + &mut self, + _: &Self::Protocol, + io: &mut T, + resp: Self::Response, + ) -> io::Result<()> + where + T: AsyncWrite + Unpin + Send, + { + let mut data = vec![]; + + if let Some(resp) = resp { + data.extend_from_slice(resp.encode_to_vec().as_slice()); + }; + + io.write_all(data.as_ref()).await?; + + Ok(()) + } +} + +fn decode_into_io_error(err: prost::DecodeError) -> io::Error { + io::Error::new(io::ErrorKind::InvalidData, err) +} + +#[cfg(test)] +mod tests { + use futures::AsyncWriteExt; + use futures_ringbuf::Endpoint; + use libp2p::request_response::Codec as _; + use libp2p::swarm::StreamProtocol; + + use super::*; + use crate::proto; + + #[tokio::test] + async fn test_codec() { + let expected_request = proto::Tunnel { + tunnel_id: "1".to_string(), + command: proto::TunnelCommand::Connect.into(), + data: None, + }; + let expected_response = proto::Tunnel { + tunnel_id: "1".to_string(), + command: proto::TunnelCommand::ConnectResp.into(), + data: None, + }; + let protocol = StreamProtocol::new("/test_pproxy/1"); + + let (mut a, mut b) = Endpoint::pair(124, 124); + Codec + .write_request(&protocol, &mut a, expected_request.clone()) + .await + .expect("Should write request"); + a.close().await.unwrap(); + + let actual_request = Codec + .read_request(&protocol, &mut b) + .await + .expect("Should read request"); + b.close().await.unwrap(); + + assert_eq!(actual_request, expected_request); + + let (mut a, mut b) = Endpoint::pair(124, 124); + Codec + .write_response(&protocol, &mut a, Some(expected_response.clone())) + .await + .expect("Should write response"); + a.close().await.unwrap(); + + let actual_response = Codec + .read_response(&protocol, &mut b) + .await + .expect("Should read response"); + b.close().await.unwrap(); + + assert_eq!(actual_response, Some(expected_response)); + } +} diff --git a/src/p2p/mod.rs b/src/p2p/mod.rs new file mode 100644 index 0000000..80bd9a1 --- /dev/null +++ b/src/p2p/mod.rs @@ -0,0 +1,41 @@ +use std::net::IpAddr; +use std::net::SocketAddr; + +use libp2p::identity::Keypair; +use libp2p::noise; +use libp2p::swarm::Swarm; +use libp2p::tcp; +use libp2p::yamux; + +pub(crate) use crate::p2p::behaviour::PProxyNetworkBehaviour; +pub(crate) use crate::p2p::behaviour::PProxyNetworkBehaviourEvent; + +mod behaviour; +mod codec; + +pub(crate) fn new_swarm( + keypair: Keypair, + listen_addr: SocketAddr, +) -> std::result::Result, Box> { + let (ip_type, ip, port) = match listen_addr.ip() { + IpAddr::V4(ip) => ("ip4", ip.to_string(), listen_addr.port()), + IpAddr::V6(ip) => ("ip6", ip.to_string(), listen_addr.port()), + }; + + let listen_multiaddr = format!("/{ip_type}/{ip}/tcp/{port}").parse()?; + + let mut swarm = libp2p::SwarmBuilder::with_existing_identity(keypair) + .with_tokio() + .with_tcp( + tcp::Config::default(), + noise::Config::new, + yamux::Config::default, + )? + .with_behaviour(PProxyNetworkBehaviour::new)? + .with_swarm_config(|c| c.with_idle_connection_timeout(std::time::Duration::from_secs(60))) + .build(); + + swarm.listen_on(listen_multiaddr)?; + + Ok(swarm) +} diff --git a/src/server.rs b/src/server.rs deleted file mode 100644 index 9bc8600..0000000 --- a/src/server.rs +++ /dev/null @@ -1,77 +0,0 @@ -use std::net::IpAddr; -use std::net::SocketAddr; - -use futures::StreamExt; -use litep2p::config::ConfigBuilder; -use litep2p::crypto::ed25519::SecretKey; -use litep2p::protocol::request_response::Config as RequestResponseConfig; -use litep2p::protocol::request_response::ConfigBuilder as RequestResponseConfigBuilder; -use litep2p::protocol::request_response::RequestResponseEvent; -use litep2p::protocol::request_response::RequestResponseHandle; -use litep2p::transport::tcp::config::Config as TcpConfig; -use litep2p::types::protocol::ProtocolName; -use litep2p::Litep2p; -use litep2p::Litep2pEvent; - -#[derive(Debug)] -pub enum P2pServerEvent { - Litep2p(Litep2pEvent), - TunnelEvent(RequestResponseEvent), -} - -pub struct P2pServer { - pub(crate) litep2p: Litep2p, - pub(crate) tunnel_handle: RequestResponseHandle, -} - -impl P2pServer { - pub fn new(secret_key: SecretKey, server_addr: SocketAddr) -> Self { - let (tunnel_config, tunnel_handle) = Self::init_tunnel(); - - let (ip_type, ip, port) = match server_addr.ip() { - IpAddr::V4(ip) => ("ip4", ip.to_string(), server_addr.port()), - IpAddr::V6(ip) => ("ip6", ip.to_string(), server_addr.port()), - }; - - let litep2p_config = ConfigBuilder::new() - .with_keypair(secret_key.into()) - .with_tcp(TcpConfig { - listen_addresses: vec![format!("/{ip_type}/{ip}/tcp/{port}").parse().unwrap()], - ..Default::default() - }) - .with_request_response_protocol(tunnel_config) - .build(); - - let litep2p = Litep2p::new(litep2p_config).expect("failed to create litep2p"); - let address = litep2p - .listen_addresses() - .next() - .unwrap_or_else(|| panic!("litep2p listen {} failed", server_addr)); - - println!("Litep2p listening on {:?}", address); - - Self { - litep2p, - tunnel_handle, - } - } - - fn init_tunnel() -> (RequestResponseConfig, RequestResponseHandle) { - RequestResponseConfigBuilder::new(ProtocolName::from("/pproxy/tunnel/1")) - .with_max_size(1024 * 1024) - .with_timeout(std::time::Duration::from_secs(120)) - .build() - } - - pub async fn next_event(&mut self) -> Option { - tokio::select! { - // TODO: next_event may not be cancel safe - ev = self.litep2p.next_event() => { - ev.map(P2pServerEvent::Litep2p) - } - ev = self.tunnel_handle.next() => { - ev.map(P2pServerEvent::TunnelEvent) - } - } - } -} diff --git a/src/tunnel.rs b/src/tunnel.rs index 44f676c..e4048cf 100644 --- a/src/tunnel.rs +++ b/src/tunnel.rs @@ -6,7 +6,7 @@ use std::sync::Arc; use std::time::Duration; use futures::channel::oneshot; -use litep2p::PeerId; +use libp2p::PeerId; use tokio::io::AsyncReadExt; use tokio::io::AsyncWriteExt; use tokio::net::TcpListener;