diff --git a/Cargo.lock b/Cargo.lock index 010d92135a..16bbd7c111 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27,6 +27,16 @@ 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.3" @@ -38,6 +48,20 @@ dependencies = [ "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.7.7" @@ -328,6 +352,45 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71938f30533e4d95a6d17aa530939da3842c2ab6f4f84b9dae68447e4129f74a" +[[package]] +name = "asn1-rs" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6fd5ddaf0351dff5b8da21b2fb4ff8e08ddd02857f0bf69c47639106c0fff0" +dependencies = [ + "asn1-rs-derive", + "asn1-rs-impl", + "displaydoc", + "nom", + "num-traits 0.2.17", + "rusticata-macros", + "thiserror", + "time", +] + +[[package]] +name = "asn1-rs-derive" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "726535892e8eae7e70657b4c8ea93d26b8553afb1ce617caee529ef96d7dee6c" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", + "synstructure", +] + +[[package]] +name = "asn1-rs-impl" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2777730b2039ac0f95f093556e61b6d26cebed5393ca6f152717777cec3a42ed" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "assert_fs" version = "1.0.13" @@ -631,9 +694,9 @@ checksum = "b4eb2cdb97421e01129ccb49169d8279ed21e829929144f4a22a6e54ac549ca1" [[package]] name = "async-trait" -version = "0.1.74" +version = "0.1.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", @@ -651,6 +714,19 @@ dependencies = [ "rustc_version", ] +[[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 = "atoi" version = "2.0.0" @@ -672,10 +748,21 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edcdbedc2236483ab103a53415653d6b4442ea6141baf1ffa85df29635e88436" dependencies = [ - "nix", + "nix 0.27.1", "rand", ] +[[package]] +name = "attohttpc" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d9a9bf8b79a749ee0b911b91b671cc2b6c670bdbc7e3dfd537576ddc94bb2a2" +dependencies = [ + "http", + "log", + "url", +] + [[package]] name = "auto_impl" version = "1.1.0" @@ -774,9 +861,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.5" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64ct" @@ -827,6 +914,15 @@ dependencies = [ "serde", ] +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + [[package]] name = "bincode" version = "2.0.0-rc.3" @@ -897,6 +993,15 @@ dependencies = [ "wyz", ] +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest 0.10.7", +] + [[package]] name = "block-buffer" version = "0.9.0" @@ -915,6 +1020,15 @@ dependencies = [ "generic-array", ] +[[package]] +name = "block-padding" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93" +dependencies = [ + "generic-array", +] + [[package]] name = "blockifier" version = "0.4.0-rc9.2" @@ -1005,7 +1119,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "542f33a8835a0884b006a0c3df3dadd99c0c3f296ed26c2fdc8028e01ad6230c" dependencies = [ "memchr", - "regex-automata 0.4.3", + "regex-automata 0.4.4", "serde", ] @@ -1779,7 +1893,7 @@ version = "0.8.2" source = "git+https://github.com/dojoengine/cairo-rs.git?rev=262b7eb4b11ab165a2a936a5f914e78aa732d4a2#262b7eb4b11ab165a2a936a5f914e78aa732d4a2" dependencies = [ "anyhow", - "bincode", + "bincode 2.0.0-rc.3", "bitvec", "cairo-felt", "generic-array", @@ -1840,6 +1954,15 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" +[[package]] +name = "cbc" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" +dependencies = [ + "cipher", +] + [[package]] name = "cc" version = "1.0.83" @@ -1850,6 +1973,18 @@ dependencies = [ "libc", ] +[[package]] +name = "ccm" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ae3c82e4355234767756212c570e29833699ab63e6ffd161887314cc5b43847" +dependencies = [ + "aead", + "cipher", + "ctr", + "subtle", +] + [[package]] name = "cexpr" version = "0.6.0" @@ -1865,6 +2000,30 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +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 = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +dependencies = [ + "aead", + "chacha20", + "cipher", + "poly1305", + "zeroize", +] + [[package]] name = "chrono" version = "0.4.31" @@ -1915,6 +2074,7 @@ checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" dependencies = [ "crypto-common", "inout", + "zeroize", ] [[package]] @@ -2037,7 +2197,7 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5286a0843c21f8367f7be734f89df9b822e0321d8bcce8d6e735aadff7d74979" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "bech32", "bs58", "digest 0.10.7", @@ -2105,6 +2265,16 @@ dependencies = [ "windows-sys 0.45.0", ] +[[package]] +name = "console_error_panic_hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" +dependencies = [ + "cfg-if", + "wasm-bindgen", +] + [[package]] name = "const-fnv1a-hash" version = "1.1.0" @@ -2320,7 +2490,7 @@ dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", - "memoffset", + "memoffset 0.9.0", ] [[package]] @@ -2368,6 +2538,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", + "rand_core", "typenum", ] @@ -2396,10 +2567,38 @@ version = "3.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82e95fbd621905b854affdc67943b043a0fbb6ed7385fd5a25650d19a8a6cfdf" dependencies = [ - "nix", + "nix 0.27.1", "windows-sys 0.48.0", ] +[[package]] +name = "curve25519-dalek" +version = "4.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest 0.10.7", + "fiat-crypto", + "platforms", + "rustc_version", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.47", +] + [[package]] name = "darling" version = "0.14.4" @@ -2536,6 +2735,20 @@ dependencies = [ "zeroize", ] +[[package]] +name = "der-parser" +version = "8.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbd676fbbab537128ef0278adb5576cf363cff6aa22a7b24effe97347cfab61e" +dependencies = [ + "asn1-rs", + "displaydoc", + "nom", + "num-bigint", + "num-traits 0.2.17", + "rusticata-macros", +] + [[package]] name = "deranged" version = "0.3.10" @@ -2714,6 +2927,17 @@ dependencies = [ "winapi", ] +[[package]] +name = "displaydoc" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.47", +] + [[package]] name = "doc-comment" version = "0.3.3" @@ -2911,6 +3135,12 @@ version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" +[[package]] +name = "dtoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" + [[package]] name = "dunce" version = "1.0.4" @@ -2937,6 +3167,31 @@ dependencies = [ "spki", ] +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f628eaec48bfd21b865dc2950cfa014450c01d2fa2b69a86c2fd5844ec523c0" +dependencies = [ + "curve25519-dalek", + "ed25519", + "rand_core", + "serde", + "sha2", + "subtle", + "zeroize", +] + [[package]] name = "either" version = "1.9.0" @@ -2958,6 +3213,8 @@ dependencies = [ "ff", "generic-array", "group", + "hkdf", + "pem-rfc7468", "pkcs8", "rand_core", "sec1", @@ -3007,7 +3264,7 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe81b5c06ecfdbc71dd845216f225f53b62a10cb8a16c946836a3467f701d05b" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "bytes", "hex", "k256", @@ -3019,6 +3276,18 @@ dependencies = [ "zeroize", ] +[[package]] +name = "enum-as-inner" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ffccbb6966c05b32ef8fbac435df276c4ae4d3dc55a8cd0eb9745e6c12f546a" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "syn 2.0.47", +] + [[package]] name = "env_logger" version = "0.10.1" @@ -3306,7 +3575,7 @@ checksum = "25d6c0c9455d93d4990c06e049abf9b30daf148cf461ee939c11d88907c60816" dependencies = [ "async-trait", "auto_impl", - "base64 0.21.5", + "base64 0.21.7", "bytes", "const-hex", "enr", @@ -3475,6 +3744,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "fiat-crypto" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27573eac26f4dd11e2b1916c3fe1baa56407c83c71a773a8ba17ec0bca03b6b7" + [[package]] name = "filetime" version = "0.2.23" @@ -3607,9 +3882,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -3620,11 +3895,20 @@ dependencies = [ "futures-util", ] +[[package]] +name = "futures-bounded" +version = "0.2.3" +source = "git+https://github.com/libp2p/rust-libp2p#ddb554440267c5d441e47827c2aa83e11b171e1d" +dependencies = [ + "futures-timer", + "futures-util", +] + [[package]] name = "futures-channel" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -3632,19 +3916,20 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", "futures-util", + "num_cpus", ] [[package]] @@ -3660,9 +3945,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-lite" @@ -3704,26 +3989,47 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", "syn 2.0.47", ] +[[package]] +name = "futures-rustls" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35bd3cf68c183738046838e300353e4716c674dc5e56890de4826801a6622a28" +dependencies = [ + "futures-io", + "rustls 0.21.10", +] + [[package]] name = "futures-sink" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.29" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" + +[[package]] +name = "futures-ticker" +version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" +checksum = "9763058047f713632a52e916cc7f6a4b3fc6e9fc1ff8c5b1dc49e5a89041682e" +dependencies = [ + "futures", + "futures-timer", + "instant", +] [[package]] name = "futures-timer" @@ -3737,9 +4043,9 @@ dependencies = [ [[package]] name = "futures-util" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -3797,9 +4103,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", "js-sys", @@ -3808,6 +4114,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "ghash" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d930750de5717d2dd0b8c0d42c076c0e884c81a73e6cab859bbd2339c71e3e40" +dependencies = [ + "opaque-debug", + "polyval", +] + [[package]] name = "gimli" version = "0.28.1" @@ -4609,7 +4925,7 @@ dependencies = [ "aho-corasick", "bstr", "log", - "regex-automata 0.4.3", + "regex-automata 0.4.4", "regex-syntax 0.8.2", ] @@ -4792,7 +5108,7 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "bytes", "headers-core", "http", @@ -4841,17 +5157,69 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] -name = "hkdf" -version = "0.12.4" +name = "hex_fmt" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" -dependencies = [ - "hmac", -] +checksum = "b07f60793ff0a4d9cef0f18e63b5357e06209987153a64648c972c1e5aff336f" [[package]] -name = "hmac" -version = "0.12.1" +name = "hickory-proto" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "091a6fbccf4860009355e3efc52ff4acf37a63489aad7435372d44ceeb6fbbcf" +dependencies = [ + "async-trait", + "cfg-if", + "data-encoding", + "enum-as-inner", + "futures-channel", + "futures-io", + "futures-util", + "idna 0.4.0", + "ipnet", + "once_cell", + "rand", + "socket2 0.5.5", + "thiserror", + "tinyvec", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "hickory-resolver" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35b8f021164e6a984c9030023544c57789c51760065cd510572fedcfb04164e8" +dependencies = [ + "cfg-if", + "futures-util", + "hickory-proto", + "ipconfig", + "lru-cache", + "once_cell", + "parking_lot 0.12.1", + "rand", + "resolv-conf", + "smallvec", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "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 = [ @@ -4867,6 +5235,17 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "hostname" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" +dependencies = [ + "libc", + "match_cfg", + "winapi", +] + [[package]] name = "http" version = "0.2.11" @@ -5059,6 +5438,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" +[[package]] +name = "idna" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "idna" version = "0.5.0" @@ -5069,6 +5458,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 2.2.2", + "core-foundation", + "fnv", + "futures", + "if-addrs", + "ipnet", + "log", + "rtnetlink", + "system-configuration", + "tokio", + "windows 0.51.1", +] + +[[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", + "hyper", + "log", + "rand", + "tokio", + "url", + "xmltree", +] + [[package]] name = "ignore" version = "0.4.21" @@ -5079,7 +5516,7 @@ dependencies = [ "globset", "log", "memchr", - "regex-automata 0.4.3", + "regex-automata 0.4.4", "same-file", "walkdir", "winapi-util", @@ -5237,6 +5674,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" dependencies = [ + "block-padding", "generic-array", ] @@ -5247,6 +5685,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "interceptor" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5927883184e6a819b22d5e4f5f7bc7ca134fde9b2026fbddd8d95249746ba21e" +dependencies = [ + "async-trait", + "bytes", + "log", + "rand", + "rtcp", + "rtp", + "thiserror", + "tokio", + "waitgroup", + "webrtc-srtp", + "webrtc-util", ] [[package]] @@ -5270,6 +5730,18 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "ipconfig" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" +dependencies = [ + "socket2 0.5.5", + "widestring", + "windows-sys 0.48.0", + "winreg", +] + [[package]] name = "ipfs-api-backend-hyper" version = "0.6.0" @@ -5299,7 +5771,7 @@ dependencies = [ "dirs 4.0.0", "futures", "http", - "multiaddr", + "multiaddr 0.17.1", "multibase", "serde", "serde_json", @@ -5413,9 +5885,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.66" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" dependencies = [ "wasm-bindgen", ] @@ -5588,8 +6060,8 @@ version = "8.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" dependencies = [ - "base64 0.21.5", - "pem", + "base64 0.21.7", + "pem 1.1.1", "ring 0.16.20", "serde", "serde_json", @@ -5971,9 +6443,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.151" +version = "0.2.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" +checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" [[package]] name = "libloading" @@ -6002,102 +6474,676 @@ dependencies = [ ] [[package]] -name = "libproc" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229004ebba9d1d5caf41623f1523b6d52abb47d9f6ab87f7e6fc992e3b854aef" +name = "libp2p" +version = "0.53.2" +source = "git+https://github.com/libp2p/rust-libp2p#ddb554440267c5d441e47827c2aa83e11b171e1d" dependencies = [ - "bindgen", - "errno", - "libc", + "bytes", + "either", + "futures", + "futures-timer", + "getrandom", + "instant", + "libp2p-allow-block-list", + "libp2p-connection-limits", + "libp2p-core 0.41.2 (git+https://github.com/libp2p/rust-libp2p)", + "libp2p-dns", + "libp2p-gossipsub 0.46.1 (git+https://github.com/libp2p/rust-libp2p)", + "libp2p-identify", + "libp2p-identity", + "libp2p-mdns", + "libp2p-metrics", + "libp2p-noise", + "libp2p-ping", + "libp2p-quic", + "libp2p-relay", + "libp2p-swarm 0.44.1 (git+https://github.com/libp2p/rust-libp2p)", + "libp2p-tcp", + "libp2p-upnp", + "libp2p-yamux", + "multiaddr 0.18.1", + "pin-project", + "rw-stream-sink 0.4.0 (git+https://github.com/libp2p/rust-libp2p)", + "thiserror", ] [[package]] -name = "libredox" -version = "0.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" +name = "libp2p-allow-block-list" +version = "0.3.0" +source = "git+https://github.com/libp2p/rust-libp2p#ddb554440267c5d441e47827c2aa83e11b171e1d" dependencies = [ - "bitflags 2.4.1", - "libc", - "redox_syscall 0.4.1", + "libp2p-core 0.41.2 (git+https://github.com/libp2p/rust-libp2p)", + "libp2p-identity", + "libp2p-swarm 0.44.1 (git+https://github.com/libp2p/rust-libp2p)", + "void", ] [[package]] -name = "libsqlite3-sys" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716" +name = "libp2p-connection-limits" +version = "0.3.1" +source = "git+https://github.com/libp2p/rust-libp2p#ddb554440267c5d441e47827c2aa83e11b171e1d" dependencies = [ - "cc", - "pkg-config", - "vcpkg", + "libp2p-core 0.41.2 (git+https://github.com/libp2p/rust-libp2p)", + "libp2p-identity", + "libp2p-swarm 0.44.1 (git+https://github.com/libp2p/rust-libp2p)", + "void", ] [[package]] -name = "linux-raw-sys" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" - -[[package]] -name = "linux-raw-sys" -version = "0.4.12" +name = "libp2p-core" +version = "0.41.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +checksum = "8130a8269e65a2554d55131c770bdf4bcd94d2b8d4efb24ca23699be65066c05" +dependencies = [ + "either", + "fnv", + "futures", + "futures-timer", + "instant", + "libp2p-identity", + "multiaddr 0.18.1", + "multihash 0.19.1", + "multistream-select 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "once_cell", + "parking_lot 0.12.1", + "pin-project", + "quick-protobuf", + "rand", + "rw-stream-sink 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec", + "thiserror", + "tracing", + "unsigned-varint 0.8.0", + "void", +] [[package]] -name = "lock_api" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +name = "libp2p-core" +version = "0.41.2" +source = "git+https://github.com/libp2p/rust-libp2p#ddb554440267c5d441e47827c2aa83e11b171e1d" dependencies = [ - "autocfg", - "scopeguard", + "either", + "fnv", + "futures", + "futures-timer", + "instant", + "libp2p-identity", + "multiaddr 0.18.1", + "multihash 0.19.1", + "multistream-select 0.13.0 (git+https://github.com/libp2p/rust-libp2p)", + "once_cell", + "parking_lot 0.12.1", + "pin-project", + "quick-protobuf", + "rand", + "rw-stream-sink 0.4.0 (git+https://github.com/libp2p/rust-libp2p)", + "smallvec", + "thiserror", + "tracing", + "unsigned-varint 0.8.0", + "void", ] [[package]] -name = "log" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +name = "libp2p-dns" +version = "0.41.1" +source = "git+https://github.com/libp2p/rust-libp2p#ddb554440267c5d441e47827c2aa83e11b171e1d" dependencies = [ - "value-bag", + "async-trait", + "futures", + "hickory-resolver", + "libp2p-core 0.41.2 (git+https://github.com/libp2p/rust-libp2p)", + "libp2p-identity", + "parking_lot 0.12.1", + "smallvec", + "tracing", ] [[package]] -name = "lru" -version = "0.7.8" +name = "libp2p-gossipsub" +version = "0.46.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a" +checksum = "d665144a616dadebdc5fff186b1233488cdcd8bfb1223218ff084b6d052c94f7" dependencies = [ - "hashbrown 0.12.3", + "asynchronous-codec", + "base64 0.21.7", + "byteorder", + "bytes", + "either", + "fnv", + "futures", + "futures-ticker", + "getrandom", + "hex_fmt", + "instant", + "libp2p-core 0.41.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-identity", + "libp2p-swarm 0.44.1 (registry+https://github.com/rust-lang/crates.io-index)", + "prometheus-client", + "quick-protobuf", + "quick-protobuf-codec 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand", + "regex", + "sha2", + "smallvec", + "tracing", + "void", ] [[package]] -name = "lsp-types" -version = "0.94.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c66bfd44a06ae10647fe3f8214762e9369fd4248df1350924b4ef9e770a85ea1" +name = "libp2p-gossipsub" +version = "0.46.1" +source = "git+https://github.com/libp2p/rust-libp2p#ddb554440267c5d441e47827c2aa83e11b171e1d" dependencies = [ - "bitflags 1.3.2", - "serde", - "serde_json", - "serde_repr", - "url", + "asynchronous-codec", + "base64 0.21.7", + "byteorder", + "bytes", + "either", + "fnv", + "futures", + "futures-ticker", + "getrandom", + "hex_fmt", + "instant", + "libp2p-core 0.41.2 (git+https://github.com/libp2p/rust-libp2p)", + "libp2p-identity", + "libp2p-swarm 0.44.1 (git+https://github.com/libp2p/rust-libp2p)", + "prometheus-client", + "quick-protobuf", + "quick-protobuf-codec 0.3.1 (git+https://github.com/libp2p/rust-libp2p)", + "rand", + "regex", + "sha2", + "smallvec", + "tracing", + "void", ] [[package]] -name = "mach2" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d0d1830bcd151a6fc4aea1369af235b36c1528fe976b8ff678683c9995eade8" +name = "libp2p-identify" +version = "0.44.1" +source = "git+https://github.com/libp2p/rust-libp2p#ddb554440267c5d441e47827c2aa83e11b171e1d" dependencies = [ - "libc", + "asynchronous-codec", + "either", + "futures", + "futures-bounded", + "futures-timer", + "libp2p-core 0.41.2 (git+https://github.com/libp2p/rust-libp2p)", + "libp2p-identity", + "libp2p-swarm 0.44.1 (git+https://github.com/libp2p/rust-libp2p)", + "lru 0.12.1", + "quick-protobuf", + "quick-protobuf-codec 0.3.1 (git+https://github.com/libp2p/rust-libp2p)", + "smallvec", + "thiserror", + "tracing", + "void", ] [[package]] -name = "matchers" +name = "libp2p-identity" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "999ec70441b2fb35355076726a6bc466c932e9bdc66f6a11c6c0aa17c7ab9be0" +dependencies = [ + "bs58", + "ed25519-dalek", + "hkdf", + "multihash 0.19.1", + "quick-protobuf", + "rand", + "sha2", + "thiserror", + "tracing", + "zeroize", +] + +[[package]] +name = "libp2p-mdns" +version = "0.45.1" +source = "git+https://github.com/libp2p/rust-libp2p#ddb554440267c5d441e47827c2aa83e11b171e1d" +dependencies = [ + "data-encoding", + "futures", + "hickory-proto", + "if-watch", + "libp2p-core 0.41.2 (git+https://github.com/libp2p/rust-libp2p)", + "libp2p-identity", + "libp2p-swarm 0.44.1 (git+https://github.com/libp2p/rust-libp2p)", + "rand", + "smallvec", + "socket2 0.5.5", + "tokio", + "tracing", + "void", +] + +[[package]] +name = "libp2p-metrics" +version = "0.14.1" +source = "git+https://github.com/libp2p/rust-libp2p#ddb554440267c5d441e47827c2aa83e11b171e1d" +dependencies = [ + "futures", + "instant", + "libp2p-core 0.41.2 (git+https://github.com/libp2p/rust-libp2p)", + "libp2p-gossipsub 0.46.1 (git+https://github.com/libp2p/rust-libp2p)", + "libp2p-identify", + "libp2p-identity", + "libp2p-ping", + "libp2p-relay", + "libp2p-swarm 0.44.1 (git+https://github.com/libp2p/rust-libp2p)", + "pin-project", + "prometheus-client", +] + +[[package]] +name = "libp2p-noise" +version = "0.44.0" +source = "git+https://github.com/libp2p/rust-libp2p#ddb554440267c5d441e47827c2aa83e11b171e1d" +dependencies = [ + "asynchronous-codec", + "bytes", + "curve25519-dalek", + "futures", + "libp2p-core 0.41.2 (git+https://github.com/libp2p/rust-libp2p)", + "libp2p-identity", + "multiaddr 0.18.1", + "multihash 0.19.1", + "once_cell", + "quick-protobuf", + "rand", + "sha2", + "snow", + "static_assertions", + "thiserror", + "tracing", + "x25519-dalek", + "zeroize", +] + +[[package]] +name = "libp2p-ping" +version = "0.44.0" +source = "git+https://github.com/libp2p/rust-libp2p#ddb554440267c5d441e47827c2aa83e11b171e1d" +dependencies = [ + "either", + "futures", + "futures-timer", + "instant", + "libp2p-core 0.41.2 (git+https://github.com/libp2p/rust-libp2p)", + "libp2p-identity", + "libp2p-swarm 0.44.1 (git+https://github.com/libp2p/rust-libp2p)", + "rand", + "tracing", + "void", +] + +[[package]] +name = "libp2p-quic" +version = "0.10.2" +source = "git+https://github.com/libp2p/rust-libp2p#ddb554440267c5d441e47827c2aa83e11b171e1d" +dependencies = [ + "bytes", + "futures", + "futures-timer", + "if-watch", + "libp2p-core 0.41.2 (git+https://github.com/libp2p/rust-libp2p)", + "libp2p-identity", + "libp2p-tls", + "parking_lot 0.12.1", + "quinn", + "rand", + "ring 0.16.20", + "rustls 0.21.10", + "socket2 0.5.5", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "libp2p-relay" +version = "0.17.1" +source = "git+https://github.com/libp2p/rust-libp2p#ddb554440267c5d441e47827c2aa83e11b171e1d" +dependencies = [ + "asynchronous-codec", + "bytes", + "either", + "futures", + "futures-bounded", + "futures-timer", + "instant", + "libp2p-core 0.41.2 (git+https://github.com/libp2p/rust-libp2p)", + "libp2p-identity", + "libp2p-swarm 0.44.1 (git+https://github.com/libp2p/rust-libp2p)", + "quick-protobuf", + "quick-protobuf-codec 0.3.1 (git+https://github.com/libp2p/rust-libp2p)", + "rand", + "static_assertions", + "thiserror", + "tracing", + "void", +] + +[[package]] +name = "libp2p-swarm" +version = "0.44.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e92532fc3c4fb292ae30c371815c9b10103718777726ea5497abc268a4761866" +dependencies = [ + "either", + "fnv", + "futures", + "futures-timer", + "instant", + "libp2p-core 0.41.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libp2p-identity", + "multistream-select 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "once_cell", + "rand", + "smallvec", + "tracing", + "void", +] + +[[package]] +name = "libp2p-swarm" +version = "0.44.1" +source = "git+https://github.com/libp2p/rust-libp2p#ddb554440267c5d441e47827c2aa83e11b171e1d" +dependencies = [ + "either", + "fnv", + "futures", + "futures-timer", + "getrandom", + "instant", + "libp2p-core 0.41.2 (git+https://github.com/libp2p/rust-libp2p)", + "libp2p-identity", + "libp2p-swarm-derive", + "multistream-select 0.13.0 (git+https://github.com/libp2p/rust-libp2p)", + "once_cell", + "rand", + "smallvec", + "tokio", + "tracing", + "void", + "wasm-bindgen-futures", +] + +[[package]] +name = "libp2p-swarm-derive" +version = "0.34.2" +source = "git+https://github.com/libp2p/rust-libp2p#ddb554440267c5d441e47827c2aa83e11b171e1d" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "syn 2.0.47", +] + +[[package]] +name = "libp2p-tcp" +version = "0.41.0" +source = "git+https://github.com/libp2p/rust-libp2p#ddb554440267c5d441e47827c2aa83e11b171e1d" +dependencies = [ + "futures", + "futures-timer", + "if-watch", + "libc", + "libp2p-core 0.41.2 (git+https://github.com/libp2p/rust-libp2p)", + "libp2p-identity", + "socket2 0.5.5", + "tokio", + "tracing", +] + +[[package]] +name = "libp2p-tls" +version = "0.3.0" +source = "git+https://github.com/libp2p/rust-libp2p#ddb554440267c5d441e47827c2aa83e11b171e1d" +dependencies = [ + "futures", + "futures-rustls", + "libp2p-core 0.41.2 (git+https://github.com/libp2p/rust-libp2p)", + "libp2p-identity", + "rcgen", + "ring 0.16.20", + "rustls 0.21.10", + "rustls-webpki", + "thiserror", + "x509-parser", + "yasna", +] + +[[package]] +name = "libp2p-upnp" +version = "0.2.1" +source = "git+https://github.com/libp2p/rust-libp2p#ddb554440267c5d441e47827c2aa83e11b171e1d" +dependencies = [ + "futures", + "futures-timer", + "igd-next", + "libp2p-core 0.41.2 (git+https://github.com/libp2p/rust-libp2p)", + "libp2p-swarm 0.44.1 (git+https://github.com/libp2p/rust-libp2p)", + "tokio", + "tracing", + "void", +] + +[[package]] +name = "libp2p-webrtc" +version = "0.7.0-alpha" +source = "git+https://github.com/libp2p/rust-libp2p#ddb554440267c5d441e47827c2aa83e11b171e1d" +dependencies = [ + "async-trait", + "bytes", + "futures", + "futures-timer", + "hex", + "if-watch", + "libp2p-core 0.41.2 (git+https://github.com/libp2p/rust-libp2p)", + "libp2p-identity", + "libp2p-noise", + "libp2p-webrtc-utils", + "multihash 0.19.1", + "rand", + "rcgen", + "serde", + "stun", + "thiserror", + "tinytemplate", + "tokio", + "tokio-util", + "tracing", + "webrtc", +] + +[[package]] +name = "libp2p-webrtc-utils" +version = "0.2.0" +source = "git+https://github.com/libp2p/rust-libp2p#ddb554440267c5d441e47827c2aa83e11b171e1d" +dependencies = [ + "asynchronous-codec", + "bytes", + "futures", + "hex", + "libp2p-core 0.41.2 (git+https://github.com/libp2p/rust-libp2p)", + "libp2p-identity", + "libp2p-noise", + "quick-protobuf", + "quick-protobuf-codec 0.3.1 (git+https://github.com/libp2p/rust-libp2p)", + "rand", + "serde", + "sha2", + "thiserror", + "tinytemplate", + "tracing", +] + +[[package]] +name = "libp2p-webrtc-websys" +version = "0.3.0-alpha" +source = "git+https://github.com/libp2p/rust-libp2p#ddb554440267c5d441e47827c2aa83e11b171e1d" +dependencies = [ + "bytes", + "futures", + "getrandom", + "hex", + "js-sys", + "libp2p-core 0.41.2 (git+https://github.com/libp2p/rust-libp2p)", + "libp2p-identity", + "libp2p-webrtc-utils", + "send_wrapper 0.6.0", + "thiserror", + "tracing", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "libp2p-yamux" +version = "0.45.1" +source = "git+https://github.com/libp2p/rust-libp2p#ddb554440267c5d441e47827c2aa83e11b171e1d" +dependencies = [ + "either", + "futures", + "libp2p-core 0.41.2 (git+https://github.com/libp2p/rust-libp2p)", + "thiserror", + "tracing", + "yamux 0.12.1", + "yamux 0.13.1", +] + +[[package]] +name = "libproc" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "229004ebba9d1d5caf41623f1523b6d52abb47d9f6ab87f7e6fc992e3b854aef" +dependencies = [ + "bindgen", + "errno", + "libc", +] + +[[package]] +name = "libredox" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" +dependencies = [ + "bitflags 2.4.1", + "libc", + "redox_syscall 0.4.1", +] + +[[package]] +name = "libsqlite3-sys" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + +[[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.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" + +[[package]] +name = "linux-raw-sys" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" + +[[package]] +name = "lock_api" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +dependencies = [ + "value-bag", +] + +[[package]] +name = "lru" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a" +dependencies = [ + "hashbrown 0.12.3", +] + +[[package]] +name = "lru" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2994eeba8ed550fd9b47a0b38f0242bc3344e496483c6180b69139cc2fa5d1d7" +dependencies = [ + "hashbrown 0.14.3", +] + +[[package]] +name = "lru-cache" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" +dependencies = [ + "linked-hash-map", +] + +[[package]] +name = "lsp-types" +version = "0.94.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c66bfd44a06ae10647fe3f8214762e9369fd4248df1350924b4ef9e770a85ea1" +dependencies = [ + "bitflags 1.3.2", + "serde", + "serde_json", + "serde_repr", + "url", +] + +[[package]] +name = "mach2" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d0d1830bcd151a6fc4aea1369af235b36c1528fe976b8ff678683c9995eade8" +dependencies = [ + "libc", +] + +[[package]] +name = "match_cfg" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" + +[[package]] +name = "matchers" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" @@ -6145,6 +7191,15 @@ dependencies = [ "libc", ] +[[package]] +name = "memoffset" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +dependencies = [ + "autocfg", +] + [[package]] name = "memoffset" version = "0.9.0" @@ -6188,7 +7243,7 @@ version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d4fa7ce7c4862db464a37b0b31d89bca874562f034bd7993895572783d02950" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "hyper", "indexmap 1.9.3", "ipnet", @@ -6342,11 +7397,30 @@ dependencies = [ "data-encoding", "log", "multibase", - "multihash", + "multihash 0.17.0", + "percent-encoding", + "serde", + "static_assertions", + "unsigned-varint 0.7.2", + "url", +] + +[[package]] +name = "multiaddr" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b852bc02a2da5feed68cd14fa50d0774b92790a5bdbfa932a813926c8472070" +dependencies = [ + "arrayref", + "byteorder", + "data-encoding", + "libp2p-identity", + "multibase", + "multihash 0.19.1", "percent-encoding", "serde", "static_assertions", - "unsigned-varint", + "unsigned-varint 0.7.2", "url", ] @@ -6369,7 +7443,17 @@ checksum = "835d6ff01d610179fbce3de1694d007e500bf33a7f29689838941d6bf783ae40" dependencies = [ "core2", "multihash-derive", - "unsigned-varint", + "unsigned-varint 0.7.2", +] + +[[package]] +name = "multihash" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "076d548d76a0e2a0d4ab471d0b1c36c577786dfc4471242035d97a12a735c492" +dependencies = [ + "core2", + "unsigned-varint 0.7.2", ] [[package]] @@ -6392,6 +7476,33 @@ 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 = "ea0df8e5eec2298a62b326ee4f0d7fe1a6b90a09dfcf9df37b38f947a8c42f19" +dependencies = [ + "bytes", + "futures", + "log", + "pin-project", + "smallvec", + "unsigned-varint 0.7.2", +] + +[[package]] +name = "multistream-select" +version = "0.13.0" +source = "git+https://github.com/libp2p/rust-libp2p#ddb554440267c5d441e47827c2aa83e11b171e1d" +dependencies = [ + "bytes", + "futures", + "pin-project", + "smallvec", + "tracing", + "unsigned-varint 0.8.0", +] + [[package]] name = "native-tls" version = "0.2.11" @@ -6423,6 +7534,72 @@ dependencies = [ "rawpointer", ] +[[package]] +name = "netlink-packet-core" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "345b8ab5bd4e71a2986663e88c56856699d060e78e152e6e9d7966fcd5491297" +dependencies = [ + "anyhow", + "byteorder", + "libc", + "netlink-packet-utils", +] + +[[package]] +name = "netlink-packet-route" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9ea4302b9759a7a88242299225ea3688e63c85ea136371bb6cf94fd674efaab" +dependencies = [ + "anyhow", + "bitflags 1.3.2", + "byteorder", + "libc", + "netlink-packet-core", + "netlink-packet-utils", +] + +[[package]] +name = "netlink-packet-utils" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ede8a08c71ad5a95cdd0e4e52facd37190977039a4704eb82a283f713747d34" +dependencies = [ + "anyhow", + "byteorder", + "paste", + "thiserror", +] + +[[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.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6471bf08e7ac0135876a9581bf3217ef0333c191c128d34878079f42ee150411" +dependencies = [ + "bytes", + "futures", + "libc", + "log", + "tokio", +] + [[package]] name = "new_debug_unreachable" version = "1.0.4" @@ -6438,6 +7615,30 @@ dependencies = [ "smallvec", ] +[[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]] +name = "nix" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" +dependencies = [ + "bitflags 1.3.2", + "cfg-if", + "libc", + "memoffset 0.7.1", + "pin-utils", +] + [[package]] name = "nix" version = "0.27.1" @@ -6449,6 +7650,12 @@ dependencies = [ "libc", ] +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + [[package]] name = "nom" version = "7.1.3" @@ -6584,7 +7791,7 @@ checksum = "5f4e3bc495f6e95bc15a6c0c55ac00421504a5a43d09e3cc455d1fea7015581d" dependencies = [ "bitvec", "either", - "lru", + "lru 0.7.8", "num-bigint", "num-integer", "num-modular", @@ -6666,6 +7873,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "oid-registry" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bedf36ffb6ba96c2eb7144ef6270557b52e54b20c0a8e1eb2ff99a6c6959bff" +dependencies = [ + "asn1-rs", +] + [[package]] name = "once_cell" version = "1.19.0" @@ -6793,6 +8009,30 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] + +[[package]] +name = "p384" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70786f51bcc69f6a4c0360e063a4cac5419ef7c5cd5b3c99ad70f3be5ba79209" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] + [[package]] name = "page_size" version = "0.6.0" @@ -6967,6 +8207,16 @@ dependencies = [ "base64 0.13.1", ] +[[package]] +name = "pem" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b8fcc794035347fb64beda2d3b462595dd2753e3f268d89c5aae77e8cf2c310" +dependencies = [ + "base64 0.21.7", + "serde", +] + [[package]] name = "pem-rfc7468" version = "0.7.0" @@ -7174,6 +8424,12 @@ version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +[[package]] +name = "platforms" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "626dec3cac7cc0e1577a2ec3fc496277ec2baa084bebad95bb6fdbfae235f84c" + [[package]] name = "plotters" version = "0.3.5" @@ -7222,14 +8478,37 @@ dependencies = [ name = "polling" version = "3.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf63fa624ab313c11656b4cda960bfc46c410187ad493c41f6ba2d8c1e991c9e" +checksum = "cf63fa624ab313c11656b4cda960bfc46c410187ad493c41f6ba2d8c1e991c9e" +dependencies = [ + "cfg-if", + "concurrent-queue", + "pin-project-lite", + "rustix 0.38.28", + "tracing", + "windows-sys 0.52.0", +] + +[[package]] +name = "poly1305" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +dependencies = [ + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "polyval" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52cff9d1d4dee5fe6d03729099f4a310a41179e0a10dbf542039873f2e826fb" dependencies = [ "cfg-if", - "concurrent-queue", - "pin-project-lite", - "rustix 0.38.28", - "tracing", - "windows-sys 0.52.0", + "cpufeatures", + "opaque-debug", + "universal-hash", ] [[package]] @@ -7325,6 +8604,15 @@ dependencies = [ "syn 2.0.47", ] +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "primitive-types" version = "0.12.2" @@ -7424,6 +8712,29 @@ dependencies = [ "human_format", ] +[[package]] +name = "prometheus-client" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "510c4f1c9d81d556458f94c98f857748130ea9737bbd6053da497503b26ea63c" +dependencies = [ + "dtoa", + "itoa", + "parking_lot 0.12.1", + "prometheus-client-derive-encode", +] + +[[package]] +name = "prometheus-client-derive-encode" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.47", +] + [[package]] name = "proptest" version = "1.4.0" @@ -7574,6 +8885,88 @@ 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 = "quick-protobuf-codec" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15a0580ab32b169745d7a39db2ba969226ca16738931be152a3209b409de2474" +dependencies = [ + "asynchronous-codec", + "bytes", + "quick-protobuf", + "thiserror", + "unsigned-varint 0.8.0", +] + +[[package]] +name = "quick-protobuf-codec" +version = "0.3.1" +source = "git+https://github.com/libp2p/rust-libp2p#ddb554440267c5d441e47827c2aa83e11b171e1d" +dependencies = [ + "asynchronous-codec", + "bytes", + "quick-protobuf", + "thiserror", + "unsigned-varint 0.8.0", +] + +[[package]] +name = "quinn" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cc2c5017e4b43d5995dcea317bc46c1e09404c0a9664d2908f7f02dfe943d75" +dependencies = [ + "bytes", + "futures-io", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls 0.21.10", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "quinn-proto" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "141bf7dfde2fbc246bfd3fe12f2455aa24b0fbd9af535d8c86c7bd1381ff2b1a" +dependencies = [ + "bytes", + "rand", + "ring 0.16.20", + "rustc-hash", + "rustls 0.21.10", + "slab", + "thiserror", + "tinyvec", + "tracing", +] + +[[package]] +name = "quinn-udp" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "055b4e778e8feb9f93c4e439f71dc2156ef13360b432b799e179a8c4cdf0b1d7" +dependencies = [ + "bytes", + "libc", + "socket2 0.5.5", + "tracing", + "windows-sys 0.48.0", +] + [[package]] name = "quote" version = "1.0.35" @@ -7673,6 +9066,19 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "rcgen" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52c4f3084aa3bc7dfbba4eff4fab2a54db4324965d8872ab933565e6fbd83bc6" +dependencies = [ + "pem 3.0.3", + "ring 0.16.20", + "time", + "x509-parser", + "yasna", +] + [[package]] name = "redb" version = "1.4.0" @@ -7713,13 +9119,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.2" +version = "1.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.3", + "regex-automata 0.4.4", "regex-syntax 0.8.2", ] @@ -7734,9 +9140,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "3b7fa1134405e2ec9353fd416b17f8dacd46c473d7d3fd1cf202706a14eb792a" dependencies = [ "aho-corasick", "memchr", @@ -7774,7 +9180,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" dependencies = [ "async-compression", - "base64 0.21.5", + "base64 0.21.7", "bytes", "encoding_rs", "futures-core", @@ -7814,6 +9220,16 @@ dependencies = [ "winreg", ] +[[package]] +name = "resolv-conf" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" +dependencies = [ + "hostname", + "quick-error", +] + [[package]] name = "reth-libmdbx" version = "0.1.0-alpha.13" @@ -7979,6 +9395,45 @@ dependencies = [ "syn 2.0.47", ] +[[package]] +name = "rtcp" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3677908cadfbecb4cc1da9a56a32524fae4ebdfa7c2ea93886e1b1e846488cb9" +dependencies = [ + "bytes", + "thiserror", + "webrtc-util", +] + +[[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 0.24.3", + "thiserror", + "tokio", +] + +[[package]] +name = "rtp" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e60482acbe8afb31edf6b1413103b7bca7a65004c423b3c3993749a083994fbe" +dependencies = [ + "bytes", + "rand", + "serde", + "thiserror", + "webrtc-util", +] + [[package]] name = "rustc-demangle" version = "0.1.23" @@ -8006,6 +9461,15 @@ dependencies = [ "semver", ] +[[package]] +name = "rusticata-macros" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faf0c4a6ece9950b9abdb62b1cfcf2a68b3b67a10ba445b3bb85be2a293d0632" +dependencies = [ + "nom", +] + [[package]] name = "rustix" version = "0.37.27" @@ -8075,7 +9539,7 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", ] [[package]] @@ -8106,6 +9570,27 @@ dependencies = [ "wait-timeout", ] +[[package]] +name = "rw-stream-sink" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8c9026ff5d2f23da5e45bbc283f156383001bfb09c4e44256d02c1a685fe9a1" +dependencies = [ + "futures", + "pin-project", + "static_assertions", +] + +[[package]] +name = "rw-stream-sink" +version = "0.4.0" +source = "git+https://github.com/libp2p/rust-libp2p#ddb554440267c5d441e47827c2aa83e11b171e1d" +dependencies = [ + "futures", + "pin-project", + "static_assertions", +] + [[package]] name = "ryu" version = "1.0.16" @@ -8370,6 +9855,18 @@ dependencies = [ "untrusted 0.9.0", ] +[[package]] +name = "sdp" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4653054c30ebce63658762eb0d64e27673868a95564474811ae6c220cf767640" +dependencies = [ + "rand", + "substring", + "thiserror", + "url", +] + [[package]] name = "sec1" version = "0.7.3" @@ -8427,6 +9924,9 @@ name = "send_wrapper" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" +dependencies = [ + "futures-core", +] [[package]] name = "serde" @@ -8738,9 +10238,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.2" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "smol_str" @@ -8773,6 +10273,23 @@ dependencies = [ "anstream", ] +[[package]] +name = "snow" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58021967fd0a5eeeb23b08df6cc244a4d4a5b4aec1d27c9e02fad1a58b4cd74e" +dependencies = [ + "aes-gcm", + "blake2", + "chacha20poly1305", + "curve25519-dalek", + "rand_core", + "ring 0.17.7", + "rustc_version", + "sha2", + "subtle", +] + [[package]] name = "socket2" version = "0.4.10" @@ -9030,7 +10547,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e37195395df71fd068f6e2082247891bc11e3289624bbc776a0cdfa1ca7f1ea4" dependencies = [ "atoi", - "base64 0.21.5", + "base64 0.21.7", "bitflags 2.4.1", "byteorder", "bytes", @@ -9074,7 +10591,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6ac0ac3b7ccd10cc96c7ab29791a7dd236bd94021f31eec7ba3d46a74aa1c24" dependencies = [ "atoi", - "base64 0.21.5", + "base64 0.21.7", "bitflags 2.4.1", "byteorder", "chrono", @@ -9185,7 +10702,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff50e281d4fdb97988a3d5c7b7cae22b9d67bb2ef9be2cfafc17a1e35542cb53" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "flate2", "hex", "serde", @@ -9424,6 +10941,34 @@ dependencies = [ "syn 2.0.47", ] +[[package]] +name = "stun" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7beb1624a3ea34778d58d30e2b8606b4d29fe65e87c4d50b87ed30afd5c3830c" +dependencies = [ + "base64 0.21.7", + "crc", + "lazy_static", + "md-5", + "rand", + "ring 0.16.20", + "subtle", + "thiserror", + "tokio", + "url", + "webrtc-util", +] + +[[package]] +name = "substring" +version = "1.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ee6433ecef213b2e72f587ef64a2f5943e7cd16fbd82dbe8bc07486c534c86" +dependencies = [ + "autocfg", +] + [[package]] name = "subtle" version = "2.5.0" @@ -9530,15 +11075,15 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.8.1" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" +checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" dependencies = [ "cfg-if", "fastrand 2.0.1", "redox_syscall 0.4.1", "rustix 0.38.28", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -9590,18 +11135,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.50" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.50" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ "proc-macro2", "quote", @@ -9705,9 +11250,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.35.0" +version = "1.35.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841d45b238a16291a4e1584e61820b8ae57d696cc5015c459c229ccc6990cc1c" +checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" dependencies = [ "backtrace", "bytes", @@ -9901,7 +11446,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3082666a3a6433f7f511c7192923fa1fe07c69332d3c6a2e6bb040b569199d5a" dependencies = [ "async-trait", - "base64 0.21.5", + "base64 0.21.7", "bytes", "flate2", "futures-core", @@ -9926,7 +11471,7 @@ dependencies = [ "async-stream", "async-trait", "axum", - "base64 0.21.5", + "base64 0.21.7", "bytes", "h2", "http", @@ -9989,7 +11534,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fddb2a37b247e6adcb9f239f4e5cefdcc5ed526141a416b943929f13aea2cce" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "bytes", "http", "http-body", @@ -10009,7 +11554,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac5987e92915a51a4b05e69a0ef903a7b76f16674f7ee66534f87fd3323e2d3a" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "byteorder", "bytes", "futures-util", @@ -10033,7 +11578,7 @@ version = "0.5.1-alpha.0" dependencies = [ "anyhow", "async-trait", - "base64 0.21.5", + "base64 0.21.7", "camino", "chrono", "clap", @@ -10062,6 +11607,7 @@ dependencies = [ "torii-core", "torii-graphql", "torii-grpc", + "torii-relay", "torii-server", "tower", "tower-http", @@ -10081,6 +11627,7 @@ dependencies = [ "dojo-world", "futures", "futures-util", + "libp2p-gossipsub 0.46.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.12.1", "prost 0.11.9", "prost 0.12.3", @@ -10093,6 +11640,7 @@ dependencies = [ "tonic 0.10.2", "tonic 0.9.2", "torii-grpc", + "torii-relay", "url", ] @@ -10102,7 +11650,7 @@ version = "0.5.1-alpha.0" dependencies = [ "anyhow", "async-trait", - "base64 0.21.5", + "base64 0.21.7", "camino", "chrono", "crypto-bigint", @@ -10141,7 +11689,7 @@ dependencies = [ "async-graphql-warp", "async-recursion", "async-trait", - "base64 0.21.5", + "base64 0.21.7", "camino", "chrono", "convert_case 0.6.0", @@ -10210,13 +11758,38 @@ dependencies = [ "url", ] +[[package]] +name = "torii-relay" +version = "0.5.1-alpha.0" +dependencies = [ + "anyhow", + "async-trait", + "futures", + "libp2p", + "libp2p-webrtc", + "libp2p-webrtc-websys", + "rand", + "regex", + "serde", + "serde_json", + "tempfile", + "thiserror", + "tokio", + "tracing", + "tracing-subscriber", + "tracing-wasm", + "wasm-bindgen-futures", + "wasm-bindgen-test", + "wasm-timer", +] + [[package]] name = "torii-server" version = "0.5.1-alpha.0" dependencies = [ "anyhow", "async-trait", - "base64 0.21.5", + "base64 0.21.7", "camino", "chrono", "clap", @@ -10280,7 +11853,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140" dependencies = [ "async-compression", - "base64 0.21.5", + "base64 0.21.7", "bitflags 2.4.1", "bytes", "futures-core", @@ -10445,6 +12018,17 @@ dependencies = [ "tracing-serde", ] +[[package]] +name = "tracing-wasm" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4575c663a174420fa2d78f4108ff68f65bf2fbb7dd89f33749b6e826b3626e07" +dependencies = [ + "tracing", + "tracing-subscriber", + "wasm-bindgen", +] + [[package]] name = "try-lock" version = "0.2.5" @@ -10471,6 +12055,25 @@ dependencies = [ "utf-8", ] +[[package]] +name = "turn" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58f4fcb97da0426e8146fe0e9b78cc13120161087256198701d12d9df77f7701" +dependencies = [ + "async-trait", + "base64 0.21.7", + "futures", + "log", + "md-5", + "rand", + "ring 0.16.20", + "stun", + "thiserror", + "tokio", + "webrtc-util", +] + [[package]] name = "typed-builder" version = "0.18.0" @@ -10603,12 +12206,28 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common", + "subtle", +] + [[package]] name = "unsigned-varint" version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6889a77d49f1f013504cec6bf97a2c730394adedaeb1deb5ea08949a50541105" +[[package]] +name = "unsigned-varint" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb066959b24b5196ae73cb057f45598450d2c5f71460e98c49b738086eff9c06" + [[package]] name = "untrusted" version = "0.7.1" @@ -10628,7 +12247,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", - "idna", + "idna 0.5.0", "percent-encoding", "serde", ] @@ -10694,6 +12313,12 @@ 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 = "wait-timeout" version = "0.2.0" @@ -10703,6 +12328,15 @@ dependencies = [ "libc", ] +[[package]] +name = "waitgroup" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1f50000a783467e6c0200f9d10642f4bc424e39efc1b770203e88b488f79292" +dependencies = [ + "atomic-waker", +] + [[package]] name = "waker-fn" version = "1.1.1" @@ -10767,9 +12401,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -10777,9 +12411,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" dependencies = [ "bumpalo", "log", @@ -10792,9 +12426,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.39" +version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" +checksum = "bde2032aeb86bdfaecc8b261eef3cba735cc426c1f3a3416d1e0791be95fc461" dependencies = [ "cfg-if", "js-sys", @@ -10804,9 +12438,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -10814,9 +12448,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" dependencies = [ "proc-macro2", "quote", @@ -10827,9 +12461,34 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.89" +version = "0.2.90" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" + +[[package]] +name = "wasm-bindgen-test" +version = "0.3.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139bd73305d50e1c1c4333210c0db43d989395b64a237bd35c10ef3832a7f70c" +dependencies = [ + "console_error_panic_hook", + "js-sys", + "scoped-tls", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-bindgen-test-macro", +] + +[[package]] +name = "wasm-bindgen-test-macro" +version = "0.3.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" +checksum = "70072aebfe5da66d2716002c729a14e4aec4da0e23cc2ea66323dac541c93928" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.47", +] [[package]] name = "wasm-streams" @@ -10844,11 +12503,26 @@ dependencies = [ "web-sys", ] +[[package]] +name = "wasm-timer" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f" +dependencies = [ + "futures", + "js-sys", + "parking_lot 0.11.2", + "pin-utils", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "web-sys" -version = "0.3.66" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" +checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" dependencies = [ "js-sys", "wasm-bindgen", @@ -10870,6 +12544,212 @@ version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10" +[[package]] +name = "webrtc" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91e7cf018f7185552bf6a5dd839f4ed9827aea33b746763c9a215f84a0d0b34" +dependencies = [ + "arc-swap", + "async-trait", + "bytes", + "cfg-if", + "hex", + "interceptor", + "lazy_static", + "log", + "pem 3.0.3", + "rand", + "rcgen", + "regex", + "ring 0.16.20", + "rtcp", + "rtp", + "rustls 0.21.10", + "sdp", + "serde", + "serde_json", + "sha2", + "smol_str", + "stun", + "thiserror", + "time", + "tokio", + "turn", + "url", + "waitgroup", + "webrtc-data", + "webrtc-dtls", + "webrtc-ice", + "webrtc-mdns", + "webrtc-media", + "webrtc-sctp", + "webrtc-srtp", + "webrtc-util", +] + +[[package]] +name = "webrtc-data" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a45d2461d0e0bf93f181e30eb0b40df32b8bf3efb89c53cebb1990e603e2067d" +dependencies = [ + "bytes", + "log", + "thiserror", + "tokio", + "webrtc-sctp", + "webrtc-util", +] + +[[package]] +name = "webrtc-dtls" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32b140b953f986e97828aa33ec6318186b05d862bee689efbc57af04a243e832" +dependencies = [ + "aes", + "aes-gcm", + "async-trait", + "bincode 1.3.3", + "byteorder", + "cbc", + "ccm", + "der-parser", + "hkdf", + "hmac", + "log", + "p256", + "p384", + "pem 3.0.3", + "rand", + "rand_core", + "rcgen", + "ring 0.16.20", + "rustls 0.21.10", + "sec1", + "serde", + "sha1", + "sha2", + "subtle", + "thiserror", + "tokio", + "webrtc-util", + "x25519-dalek", + "x509-parser", +] + +[[package]] +name = "webrtc-ice" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66eb4b85646f1c52225779db3e1e7e873dede6db68cc9be080b648f1713083a3" +dependencies = [ + "arc-swap", + "async-trait", + "crc", + "log", + "rand", + "serde", + "serde_json", + "stun", + "thiserror", + "tokio", + "turn", + "url", + "uuid 1.6.1", + "waitgroup", + "webrtc-mdns", + "webrtc-util", +] + +[[package]] +name = "webrtc-mdns" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bebbd40e7f8b630a0f1a74783dbfff1edfc0ccaae891c4689891156a8c4d8c" +dependencies = [ + "log", + "socket2 0.5.5", + "thiserror", + "tokio", + "webrtc-util", +] + +[[package]] +name = "webrtc-media" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cfde3c7b9450b67d466bb2f02c6d9ff9514d33535eb9994942afd1f828839d1" +dependencies = [ + "byteorder", + "bytes", + "rand", + "rtp", + "thiserror", +] + +[[package]] +name = "webrtc-sctp" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1af6116b7f9703560c3ad0b32f67220b171bb1b59633b03563db8404d0e482ea" +dependencies = [ + "arc-swap", + "async-trait", + "bytes", + "crc", + "log", + "rand", + "thiserror", + "tokio", + "webrtc-util", +] + +[[package]] +name = "webrtc-srtp" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1db1f36c1c81e4b1e531c0b9678ba0c93809e196ce62122d87259bb71c03b9f" +dependencies = [ + "aead", + "aes", + "aes-gcm", + "byteorder", + "bytes", + "ctr", + "hmac", + "log", + "rtcp", + "rtp", + "sha1", + "subtle", + "thiserror", + "tokio", + "webrtc-util", +] + +[[package]] +name = "webrtc-util" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1adc96bee68417e1f4d19dd7698124a7f859db55ae2fd3eedbbb7e732f614735" +dependencies = [ + "async-trait", + "bitflags 1.3.2", + "bytes", + "cc", + "ipnet", + "lazy_static", + "libc", + "log", + "nix 0.26.4", + "rand", + "thiserror", + "tokio", + "winapi", +] + [[package]] name = "which" version = "4.4.2" @@ -10901,6 +12781,12 @@ version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50" +[[package]] +name = "widestring" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8" + [[package]] name = "winapi" version = "0.3.9" @@ -11205,6 +13091,36 @@ dependencies = [ "tap", ] +[[package]] +name = "x25519-dalek" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb66477291e7e8d2b0ff1bcb900bf29489a9692816d79874bea351e7a8b6de96" +dependencies = [ + "curve25519-dalek", + "rand_core", + "serde", + "zeroize", +] + +[[package]] +name = "x509-parser" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7069fba5b66b9193bd2c5d3d4ff12b839118f6bcbef5328efafafb5395cf63da" +dependencies = [ + "asn1-rs", + "data-encoding", + "der-parser", + "lazy_static", + "nom", + "oid-registry", + "ring 0.16.20", + "rusticata-macros", + "thiserror", + "time", +] + [[package]] name = "xattr" version = "1.1.3" @@ -11216,6 +13132,21 @@ dependencies = [ "rustix 0.38.28", ] +[[package]] +name = "xml-rs" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a" + +[[package]] +name = "xmltree" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7d8a75eaf6557bb84a65ace8609883db44a29951042ada9b393151532e41fcb" +dependencies = [ + "xml-rs", +] + [[package]] name = "xshell" version = "0.2.5" @@ -11237,12 +13168,52 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9828b178da53440fa9c766a3d2f73f7cf5d0ac1fe3980c1e5018d899fd19e07b" +[[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 0.12.1", + "pin-project", + "rand", + "static_assertions", +] + +[[package]] +name = "yamux" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad1d0148b89300047e72994bee99ecdabd15a9166a7b70c8b8c37c314dcc9002" +dependencies = [ + "futures", + "instant", + "log", + "nohash-hasher", + "parking_lot 0.12.1", + "pin-project", + "rand", + "static_assertions", +] + [[package]] name = "yansi" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" +[[package]] +name = "yasna" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd" +dependencies = [ + "time", +] + [[package]] name = "zerocopy" version = "0.7.30" diff --git a/Cargo.toml b/Cargo.toml index 96cb127805..ff0f243663 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -79,6 +79,7 @@ torii-core = { path = "crates/torii/core" } torii-graphql = { path = "crates/torii/graphql" } torii-grpc = { path = "crates/torii/grpc" } torii-server = { path = "crates/torii/server" } +torii-relay = { path = "crates/torii/libp2p" } # sozo sozo-signers = { path = "crates/sozo/signers" } @@ -88,7 +89,6 @@ assert_matches = "1.5.0" async-trait = "0.1.68" base64 = "0.21.2" blockifier = { git = "https://github.com/starkware-libs/blockifier", tag = "v0.4.0-rc9.2" } -cairo-lang-casm = "2.4.0" cairo-lang-compiler = "2.4.0" cairo-lang-debug = "2.4.0" cairo-lang-defs = "2.4.0" @@ -115,12 +115,10 @@ camino = { version = "1.1.2", features = [ "serde1" ] } chrono = { version = "0.4.24", features = [ "serde" ] } clap = { version = "4.2", features = [ "derive" ] } clap_complete = "4.3" -colored = "2" console = "0.15.7" convert_case = "0.6.0" crypto-bigint = { version = "0.5.3", features = [ "serde" ] } derive_more = "0.99.17" -env_logger = "0.10.0" flate2 = "1.0.24" futures = "0.3.28" hex = "0.4.3" @@ -129,7 +127,6 @@ itertools = "0.10.3" jsonrpsee = { version = "0.16.2", default-features = false } lazy_static = "1.4.0" metrics-process = "1.0.9" -num-bigint = "0.4" once_cell = "1.0" parking_lot = "0.12.1" pretty_assertions = "1.2.1" diff --git a/bin/torii/Cargo.toml b/bin/torii/Cargo.toml index e003c4a635..64d9411dbb 100644 --- a/bin/torii/Cargo.toml +++ b/bin/torii/Cargo.toml @@ -43,6 +43,7 @@ tower-http = "0.4.4" tracing-subscriber.workspace = true tracing.workspace = true url.workspace = true +torii-relay.workspace = true [dev-dependencies] camino.workspace = true diff --git a/bin/torii/src/main.rs b/bin/torii/src/main.rs index 0bcee8f72d..7621e23bce 100644 --- a/bin/torii/src/main.rs +++ b/bin/torii/src/main.rs @@ -64,6 +64,23 @@ struct Args { #[arg(long, value_name = "SOCKET", default_value = ":8080", value_parser = parse_socket_address)] addr: SocketAddr, + /// Port to serve Libp2p TCP & UDP Quic transports + #[arg(long, value_name = "PORT", default_value = "9090")] + relay_port: u16, + + /// Port to serve Libp2p WebRTC transport + #[arg(long, value_name = "PORT", default_value = "9091")] + relay_webrtc_port: u16, + + /// Path to a local identity key file. If not specified, a new identity will be generated + #[arg(long, value_name = "PATH")] + relay_local_key_path: Option, + + /// Path to a local certificate file. If not specified, a new certificate will be generated + /// for WebRTC connections + #[arg(long, value_name = "PATH")] + relay_cert_path: Option, + /// Specify allowed origins for api endpoints (comma-separated list of allowed origins, or "*" /// for all) #[arg(long, default_value = "*")] @@ -163,6 +180,14 @@ async fn main() -> anyhow::Result<()> { proxy_server.clone(), ); + let mut libp2p_relay_server = torii_relay::server::Relay::new( + args.relay_port, + args.relay_webrtc_port, + args.relay_local_key_path, + args.relay_cert_path, + ) + .expect("Failed to start libp2p relay server"); + info!(target: "torii::cli", "Starting torii endpoint: {}", format!("http://{}", args.addr)); info!(target: "torii::cli", "Serving Graphql playground: {}\n", format!("http://{}/graphql", args.addr)); @@ -183,6 +208,7 @@ async fn main() -> anyhow::Result<()> { _ = proxy_server.start(shutdown_tx.subscribe()) => {}, _ = graphql_server => {}, _ = grpc_server => {}, + _ = libp2p_relay_server.run() => {}, }; Ok(()) diff --git a/crates/torii/client/Cargo.toml b/crates/torii/client/Cargo.toml index c777de0701..9cba3518ae 100644 --- a/crates/torii/client/Cargo.toml +++ b/crates/torii/client/Cargo.toml @@ -20,7 +20,9 @@ starknet.workspace = true thiserror.workspace = true tokio = { version = "1.32.0", features = [ "sync" ], default-features = false } torii-grpc = { path = "../grpc", features = [ "client" ] } +torii-relay = { path = "../libp2p" } url.workspace = true +libp2p-gossipsub = "0.46.1" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] prost.workspace = true diff --git a/crates/torii/client/src/client/error.rs b/crates/torii/client/src/client/error.rs index 9fdaa17666..9f9b831939 100644 --- a/crates/torii/client/src/client/error.rs +++ b/crates/torii/client/src/client/error.rs @@ -17,6 +17,8 @@ pub enum Error { #[error(transparent)] GrpcClient(#[from] torii_grpc::client::Error), #[error(transparent)] + RelayClient(#[from] torii_relay::errors::Error), + #[error(transparent)] Model(#[from] ModelError), #[error("Unsupported query")] UnsupportedQuery, diff --git a/crates/torii/client/src/client/mod.rs b/crates/torii/client/src/client/mod.rs index 6f231a447a..6fe4276212 100644 --- a/crates/torii/client/src/client/mod.rs +++ b/crates/torii/client/src/client/mod.rs @@ -10,6 +10,8 @@ use dojo_types::packing::unpack; use dojo_types::schema::Ty; use dojo_types::WorldMetadata; use dojo_world::contracts::WorldContractReader; +use futures::channel::mpsc::UnboundedReceiver; +use futures_util::lock::Mutex; use parking_lot::{RwLock, RwLockReadGuard}; use starknet::core::utils::cairo_short_string_to_felt; use starknet::providers::jsonrpc::HttpTransport; @@ -20,6 +22,7 @@ use torii_grpc::client::{EntityUpdateStreaming, ModelDiffsStreaming}; use torii_grpc::proto::world::RetrieveEntitiesResponse; use torii_grpc::types::schema::Entity; use torii_grpc::types::{KeysClause, Query}; +use torii_relay::client::Message; use crate::client::error::{Error, ParseError}; use crate::client::storage::ModelStorage; @@ -34,6 +37,8 @@ pub struct Client { metadata: Arc>, /// The grpc client. inner: AsyncRwLock, + /// Libp2p client. + relay_client: torii_relay::client::RelayClient, /// Model storage storage: Arc, /// Models the client are subscribed to. @@ -49,11 +54,14 @@ impl Client { pub async fn new( torii_url: String, rpc_url: String, + libp2p_relay_url: String, world: FieldElement, models_keys: Option>, ) -> Result { let mut grpc_client = torii_grpc::client::WorldClient::new(torii_url, world).await?; + let libp2p_client = torii_relay::client::RelayClient::new(libp2p_relay_url)?; + let metadata = grpc_client.metadata().await?; let shared_metadata: Arc<_> = RwLock::new(metadata).into(); @@ -88,10 +96,45 @@ impl Client { metadata: shared_metadata, sub_client_handle: OnceCell::new(), inner: AsyncRwLock::new(grpc_client), + relay_client: libp2p_client, subscribed_models: subbed_models, }) } + /// Subscribes to a topic. + /// Returns true if the topic was subscribed to. + /// Returns false if the topic was already subscribed to. + pub async fn subscribe_topic(&mut self, topic: String) -> Result { + self.relay_client.command_sender.subscribe(topic).await.map_err(Error::RelayClient) + } + + /// Unsubscribes from a topic. + /// Returns true if the topic was subscribed to. + pub async fn unsubscribe_topic(&mut self, topic: String) -> Result { + self.relay_client.command_sender.unsubscribe(topic).await.map_err(Error::RelayClient) + } + + /// Publishes a message to a topic. + /// Returns the message id. + pub async fn publish_message(&mut self, topic: &str, message: &[u8]) -> Result, Error> { + self.relay_client + .command_sender + .publish(topic.to_string(), message.to_vec()) + .await + .map_err(Error::RelayClient) + .map(|m| m.0) + } + + /// Runs the libp2p event loop which processes incoming messages and commands. + /// And sends events in the channel + pub async fn run_libp2p(&mut self) { + self.relay_client.event_loop.run().await; + } + + pub fn libp2p_message_stream(&self) -> Arc>> { + self.relay_client.message_receiver.clone() + } + /// Returns a read lock on the World metadata that the client is connected to. pub fn metadata(&self) -> RwLockReadGuard<'_, WorldMetadata> { self.metadata.read() diff --git a/crates/torii/libp2p/Cargo.toml b/crates/torii/libp2p/Cargo.toml new file mode 100644 index 0000000000..51e308975d --- /dev/null +++ b/crates/torii/libp2p/Cargo.toml @@ -0,0 +1,36 @@ +[package] +edition.workspace = true +license-file.workspace = true +name = "torii-relay" +repository.workspace = true +version.workspace = true + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +futures.workspace = true +rand = "0.8.5" +serde.workspace = true +serde_json.workspace = true +thiserror.workspace = true +tracing-subscriber = { version = "0.3", features = ["env-filter"] } +tracing.workspace = true +async-trait = "0.1.77" +regex = "1.10.3" +anyhow.workspace = true + +[dev-dependencies] +tempfile = "3.9.0" + +[target.'cfg(not(target_arch = "wasm32"))'.dependencies] +tokio.workspace = true +libp2p = { git = "https://github.com/libp2p/rust-libp2p", features = [ "ed25519", "gossipsub", "identify", "macros", "noise", "ping", "quic", "relay", "tcp", "tokio", "yamux" ] } +libp2p-webrtc = { git = "https://github.com/libp2p/rust-libp2p", features = [ "tokio", "pem" ] } + +[target.'cfg(target_arch = "wasm32")'.dependencies] +libp2p = { git = "https://github.com/libp2p/rust-libp2p", features = [ "ed25519", "gossipsub", "identify", "macros", "ping", "tcp", "wasm-bindgen" ] } +libp2p-webrtc-websys = { git = "https://github.com/libp2p/rust-libp2p" } +tracing-wasm = "0.2.1" +wasm-bindgen-test = "0.3.40" +wasm-bindgen-futures = "0.4.40" +wasm-timer = "0.2.5" diff --git a/crates/torii/libp2p/src/client/events.rs b/crates/torii/libp2p/src/client/events.rs new file mode 100644 index 0000000000..120caa3376 --- /dev/null +++ b/crates/torii/libp2p/src/client/events.rs @@ -0,0 +1,27 @@ +use gossipsub::Event as GossipsubEvent; +use libp2p::{gossipsub, identify, ping}; + +#[derive(Debug)] +pub(crate) enum ClientEvent { + Gossipsub(GossipsubEvent), + Identify(identify::Event), + Ping(ping::Event), +} + +impl From for ClientEvent { + fn from(event: GossipsubEvent) -> Self { + Self::Gossipsub(event) + } +} + +impl From for ClientEvent { + fn from(event: identify::Event) -> Self { + Self::Identify(event) + } +} + +impl From for ClientEvent { + fn from(event: ping::Event) -> Self { + Self::Ping(event) + } +} diff --git a/crates/torii/libp2p/src/client/mod.rs b/crates/torii/libp2p/src/client/mod.rs new file mode 100644 index 0000000000..6c9d20c361 --- /dev/null +++ b/crates/torii/libp2p/src/client/mod.rs @@ -0,0 +1,277 @@ +use std::sync::Arc; +use std::time::Duration; + +use futures::channel::mpsc::{UnboundedReceiver, UnboundedSender}; +use futures::channel::oneshot; +use futures::lock::Mutex; +use futures::{select, StreamExt}; +use libp2p::gossipsub::{self, IdentTopic, MessageId, TopicHash}; +use libp2p::swarm::{NetworkBehaviour, Swarm, SwarmEvent}; +use libp2p::{identify, identity, ping, Multiaddr, PeerId}; +#[cfg(not(target_arch = "wasm32"))] +use libp2p::{noise, tcp, yamux}; +use tracing::info; + +pub mod events; +use crate::client::events::ClientEvent; +use crate::constants; +use crate::errors::Error; +use crate::types::{ClientMessage, ServerMessage}; + +#[derive(NetworkBehaviour)] +#[behaviour(out_event = "ClientEvent")] +struct Behaviour { + gossipsub: gossipsub::Behaviour, + identify: identify::Behaviour, + ping: ping::Behaviour, +} + +pub struct RelayClient { + pub message_receiver: Arc>>, + pub command_sender: CommandSender, + pub event_loop: EventLoop, +} + +pub struct EventLoop { + swarm: Swarm, + message_sender: UnboundedSender, + command_receiver: UnboundedReceiver, +} + +#[derive(Debug, Clone)] +pub struct Message { + // PeerId of the relay that propagated the message + pub propagation_source: PeerId, + // Peer that published the message + pub source: PeerId, + pub message_id: MessageId, + // Hash of the topic message was published to + pub topic: TopicHash, + // Raw message payload + pub data: Vec, +} + +#[derive(Debug)] +enum Command { + Subscribe(String, oneshot::Sender>), + Unsubscribe(String, oneshot::Sender>), + Publish(String, Vec, oneshot::Sender>), +} + +impl RelayClient { + #[cfg(not(target_arch = "wasm32"))] + pub fn new(relay_addr: String) -> Result { + let local_key = identity::Keypair::generate_ed25519(); + let peer_id = PeerId::from(local_key.public()); + + info!(target: "torii::relay::client", peer_id = %peer_id, "Local peer id"); + + let mut swarm = libp2p::SwarmBuilder::with_existing_identity(local_key) + .with_tokio() + .with_tcp(tcp::Config::default(), noise::Config::new, yamux::Config::default)? + .with_quic() + .with_behaviour(|key| { + let gossipsub_config: gossipsub::Config = gossipsub::ConfigBuilder::default() + .heartbeat_interval(Duration::from_secs( + constants::GOSSIPSUB_HEARTBEAT_INTERVAL_SECS, + )) + .build() + .expect("Gossipsup config is invalid"); + + Behaviour { + gossipsub: gossipsub::Behaviour::new( + gossipsub::MessageAuthenticity::Signed(key.clone()), + gossipsub_config, + ) + .expect("Gossipsub behaviour is invalid"), + identify: identify::Behaviour::new(identify::Config::new( + "/torii-client/0.0.1".to_string(), + key.public(), + )), + ping: ping::Behaviour::new(ping::Config::default()), + } + })? + .with_swarm_config(|cfg| { + cfg.with_idle_connection_timeout(Duration::from_secs( + constants::IDLE_CONNECTION_TIMEOUT_SECS, + )) + }) + .build(); + + info!(target: "torii::relay::client", addr = %relay_addr, "Dialing relay"); + swarm.dial(relay_addr.parse::()?)?; + + let (message_sender, message_receiver) = futures::channel::mpsc::unbounded(); + let (command_sender, command_receiver) = futures::channel::mpsc::unbounded(); + Ok(Self { + command_sender: CommandSender::new(command_sender), + message_receiver: Arc::new(Mutex::new(message_receiver)), + event_loop: EventLoop { swarm, message_sender, command_receiver }, + }) + } + + #[cfg(target_arch = "wasm32")] + pub fn new(relay_addr: String) -> Result { + let local_key = identity::Keypair::generate_ed25519(); + let peer_id = PeerId::from(local_key.public()); + + info!(target: "torii::relay::client", peer_id = %peer_id, "Local peer id"); + + let mut swarm = libp2p::SwarmBuilder::with_existing_identity(local_key) + .with_wasm_bindgen() + .with_other_transport(|key| { + libp2p_webrtc_websys::Transport::new(libp2p_webrtc_websys::Config::new(&key)) + }) + .expect("Failed to create WebRTC transport") + .with_behaviour(|key| { + let gossipsub_config: gossipsub::Config = gossipsub::ConfigBuilder::default() + .heartbeat_interval(std::time::Duration::from_secs(10)) + .build() + .expect("Gossipsup config is invalid"); + + Behaviour { + gossipsub: gossipsub::Behaviour::new( + gossipsub::MessageAuthenticity::Signed(key.clone()), + gossipsub_config, + ) + .expect("Gossipsub behaviour is invalid"), + identify: identify::Behaviour::new(identify::Config::new( + "/torii-client/0.0.1".to_string(), + key.public(), + )), + ping: ping::Behaviour::new(ping::Config::default()), + } + })? + .with_swarm_config(|cfg| cfg.with_idle_connection_timeout(Duration::from_secs(60))) + .build(); + + info!(target: "torii::relay::client", addr = %relay_addr, "Dialing relay"); + swarm.dial(relay_addr.parse::()?)?; + + let (message_sender, message_receiver) = futures::channel::mpsc::unbounded(); + let (command_sender, command_receiver) = futures::channel::mpsc::unbounded(); + Ok(Self { + command_sender: CommandSender::new(command_sender), + message_receiver: Arc::new(Mutex::new(message_receiver)), + event_loop: EventLoop { swarm, message_sender, command_receiver }, + }) + } +} + +pub struct CommandSender { + sender: UnboundedSender, +} + +impl CommandSender { + fn new(sender: UnboundedSender) -> Self { + Self { sender } + } + + pub async fn subscribe(&mut self, room: String) -> Result { + let (tx, rx) = oneshot::channel(); + + self.sender.unbounded_send(Command::Subscribe(room, tx)).expect("Failed to send command"); + + rx.await.expect("Failed to receive response") + } + + pub async fn unsubscribe(&mut self, room: String) -> Result { + let (tx, rx) = oneshot::channel(); + + self.sender.unbounded_send(Command::Unsubscribe(room, tx)).expect("Failed to send command"); + + rx.await.expect("Failed to receive response") + } + + pub async fn publish(&mut self, topic: String, data: Vec) -> Result { + let (tx, rx) = oneshot::channel(); + + self.sender + .unbounded_send(Command::Publish(topic, data, tx)) + .expect("Failed to send command"); + + rx.await.expect("Failed to receive response") + } +} + +impl EventLoop { + pub async fn run(&mut self) { + loop { + // Poll the swarm for new events. + select! { + command = self.command_receiver.select_next_some() => { + match command { + Command::Subscribe(room, sender) => { + sender.send(self.subscribe(&room)).expect("Failed to send response"); + }, + Command::Unsubscribe(room, sender) => { + sender.send(self.unsubscribe(&room)).expect("Failed to send response"); + }, + Command::Publish(topic, data, sender) => { + sender.send(self.publish(topic, data)).expect("Failed to send response"); + }, + } + }, + event = self.swarm.select_next_some() => { + match event { + SwarmEvent::Behaviour(event) => { + // Handle behaviour events. + if let ClientEvent::Gossipsub(gossipsub::Event::Message { + propagation_source: peer_id, + message_id, + message, + }) = event + { + // deserialize message payload + let message_payload: ServerMessage = serde_json::from_slice(&message.data) + .expect("Failed to deserialize message"); + + let message = Message { + propagation_source: peer_id, + source: PeerId::from_bytes(&message_payload.peer_id).expect("Failed to parse peer id"), + message_id, + topic: message.topic, + data: message_payload.data, + }; + + self.message_sender.unbounded_send(message).expect("Failed to send message"); + } + } + SwarmEvent::ConnectionClosed { cause: Some(cause), .. } => { + info!(target: "torii::relay::client", cause = ?cause, "Connection closed"); + + if let libp2p::swarm::ConnectionError::KeepAliveTimeout = cause { + info!(target: "torii::relay::client", "Connection closed due to keep alive timeout. Shutting down client."); + return; + } + } + evt => { + info!(target: "torii::relay::client", event = ?evt, "Unhandled event"); + } + } + }, + } + } + } + + fn subscribe(&mut self, room: &str) -> Result { + let topic = IdentTopic::new(room); + self.swarm.behaviour_mut().gossipsub.subscribe(&topic).map_err(Error::SubscriptionError) + } + + fn unsubscribe(&mut self, room: &str) -> Result { + let topic = IdentTopic::new(room); + self.swarm.behaviour_mut().gossipsub.unsubscribe(&topic).map_err(Error::PublishError) + } + + fn publish(&mut self, topic: String, data: Vec) -> Result { + self.swarm + .behaviour_mut() + .gossipsub + .publish( + IdentTopic::new(constants::MESSAGING_TOPIC), + serde_json::to_string(&ClientMessage { topic, data }).unwrap(), + ) + .map_err(Error::PublishError) + } +} diff --git a/crates/torii/libp2p/src/constants.rs b/crates/torii/libp2p/src/constants.rs new file mode 100644 index 0000000000..2d061e72e4 --- /dev/null +++ b/crates/torii/libp2p/src/constants.rs @@ -0,0 +1,3 @@ +pub(crate) const GOSSIPSUB_HEARTBEAT_INTERVAL_SECS: u64 = 10; +pub(crate) const MESSAGING_TOPIC: &str = "message"; +pub(crate) const IDLE_CONNECTION_TIMEOUT_SECS: u64 = 60; diff --git a/crates/torii/libp2p/src/errors.rs b/crates/torii/libp2p/src/errors.rs new file mode 100644 index 0000000000..b9845817fc --- /dev/null +++ b/crates/torii/libp2p/src/errors.rs @@ -0,0 +1,42 @@ +use std::convert::Infallible; +use std::io; + +use libp2p::gossipsub::{PublishError, SubscriptionError}; +#[cfg(not(target_arch = "wasm32"))] +use libp2p::noise; +use thiserror::Error; + +#[derive(Error, Debug)] +pub enum Error { + #[error(transparent)] + MultiaddrParseError(#[from] libp2p::core::multiaddr::Error), + + #[cfg(not(target_arch = "wasm32"))] + #[error(transparent)] + NoiseUpgradeError(#[from] noise::Error), + + #[error(transparent)] + DialError(#[from] libp2p::swarm::DialError), + + // accept any error + #[error(transparent)] + BehaviourError(#[from] Infallible), + + #[error(transparent)] + GossipConfigError(#[from] libp2p::gossipsub::ConfigBuilderError), + + #[error(transparent)] + TransportError(#[from] libp2p::TransportError), + + #[error(transparent)] + SubscriptionError(#[from] SubscriptionError), + + #[error(transparent)] + PublishError(#[from] PublishError), + + #[error("Failed to read identity: {0}")] + ReadIdentityError(anyhow::Error), + + #[error("Failed to read certificate: {0}")] + ReadCertificateError(anyhow::Error), +} diff --git a/crates/torii/libp2p/src/lib.rs b/crates/torii/libp2p/src/lib.rs new file mode 100644 index 0000000000..db6b58cbeb --- /dev/null +++ b/crates/torii/libp2p/src/lib.rs @@ -0,0 +1,7 @@ +pub mod client; +mod constants; +pub mod errors; +#[cfg(not(target_arch = "wasm32"))] +pub mod server; +mod tests; +pub mod types; diff --git a/crates/torii/libp2p/src/server/events.rs b/crates/torii/libp2p/src/server/events.rs new file mode 100644 index 0000000000..791284c8fa --- /dev/null +++ b/crates/torii/libp2p/src/server/events.rs @@ -0,0 +1,36 @@ +use libp2p::gossipsub::Event as GossipsubEvent; +use libp2p::identify::Event as IdentifyEvent; +use libp2p::ping::Event as PingEvent; +use libp2p::relay::Event as RelayEvent; + +#[derive(Debug)] +pub enum ServerEvent { + Identify(IdentifyEvent), + Ping(PingEvent), + Relay(RelayEvent), + Gossipsub(GossipsubEvent), +} + +impl From for ServerEvent { + fn from(event: IdentifyEvent) -> Self { + Self::Identify(event) + } +} + +impl From for ServerEvent { + fn from(event: PingEvent) -> Self { + Self::Ping(event) + } +} + +impl From for ServerEvent { + fn from(event: RelayEvent) -> Self { + Self::Relay(event) + } +} + +impl From for ServerEvent { + fn from(event: GossipsubEvent) -> Self { + Self::Gossipsub(event) + } +} diff --git a/crates/torii/libp2p/src/server/mod.rs b/crates/torii/libp2p/src/server/mod.rs new file mode 100644 index 0000000000..6d64cc743a --- /dev/null +++ b/crates/torii/libp2p/src/server/mod.rs @@ -0,0 +1,289 @@ +use std::collections::hash_map::DefaultHasher; +use std::hash::{Hash, Hasher}; +use std::net::Ipv4Addr; +use std::path::Path; +use std::time::Duration; +use std::{fs, io}; + +use futures::StreamExt; +use libp2p::core::multiaddr::Protocol; +use libp2p::core::muxing::StreamMuxerBox; +use libp2p::core::Multiaddr; +use libp2p::gossipsub::{self, IdentTopic}; +use libp2p::swarm::{NetworkBehaviour, SwarmEvent}; +use libp2p::{identify, identity, noise, ping, relay, tcp, yamux, PeerId, Swarm, Transport}; +use libp2p_webrtc as webrtc; +use rand::thread_rng; +use tracing::info; +use webrtc::tokio::Certificate; + +use crate::constants; +use crate::errors::Error; + +mod events; + +use crate::server::events::ServerEvent; +use crate::types::{ClientMessage, ServerMessage}; + +#[derive(NetworkBehaviour)] +#[behaviour(out_event = "ServerEvent")] +pub struct Behaviour { + relay: relay::Behaviour, + ping: ping::Behaviour, + identify: identify::Behaviour, + gossipsub: gossipsub::Behaviour, +} + +pub struct Relay { + swarm: Swarm, +} + +impl Relay { + pub fn new( + port: u16, + port_webrtc: u16, + local_key_path: Option, + cert_path: Option, + ) -> Result { + let local_key = if let Some(path) = local_key_path { + let path = Path::new(&path); + read_or_create_identity(path).map_err(Error::ReadIdentityError)? + } else { + identity::Keypair::generate_ed25519() + }; + + let cert = if let Some(path) = cert_path { + let path = Path::new(&path); + read_or_create_certificate(path).map_err(Error::ReadCertificateError)? + } else { + Certificate::generate(&mut thread_rng()).unwrap() + }; + + info!(target: "torii::relay::server", peer_id = %PeerId::from(local_key.public()), "Relay peer id"); + + let mut swarm = libp2p::SwarmBuilder::with_existing_identity(local_key) + .with_tokio() + .with_tcp(tcp::Config::default(), noise::Config::new, yamux::Config::default)? + .with_quic() + .with_other_transport(|key| { + Ok(webrtc::tokio::Transport::new(key.clone(), cert) + .map(|(peer_id, conn), _| (peer_id, StreamMuxerBox::new(conn)))) + }) + .expect("Failed to create WebRTC transport") + .with_behaviour(|key| { + let message_id_fn = |message: &gossipsub::Message| { + let mut s = DefaultHasher::new(); + message.data.hash(&mut s); + gossipsub::MessageId::from(s.finish().to_string()) + }; + let gossipsub_config = gossipsub::ConfigBuilder::default() + .heartbeat_interval(Duration::from_secs(constants::GOSSIPSUB_HEARTBEAT_INTERVAL_SECS)) // This is set to aid debugging by not cluttering the log space + .validation_mode(gossipsub::ValidationMode::Strict) // This sets the kind of message validation. The default is Strict (enforce message signing) + .message_id_fn(message_id_fn) // content-address messages. No two messages of the same content will be propagated. + .build() + .map_err(|msg| io::Error::new(io::ErrorKind::Other, msg)).unwrap(); // Temporary hack because `build` does not return a proper `std::error::Error`. + + Behaviour { + relay: relay::Behaviour::new(key.public().to_peer_id(), Default::default()), + ping: ping::Behaviour::new(ping::Config::new()), + identify: identify::Behaviour::new(identify::Config::new( + "/torii-relay/0.0.1".to_string(), + key.public(), + )), + gossipsub: gossipsub::Behaviour::new( + gossipsub::MessageAuthenticity::Signed(key.clone()), + gossipsub_config, + ) + .unwrap(), + } + })? + .with_swarm_config(|cfg| { + cfg.with_idle_connection_timeout(Duration::from_secs( + constants::IDLE_CONNECTION_TIMEOUT_SECS, + )) + }) + .build(); + + // TCP + let listen_addr_tcp = Multiaddr::from(Ipv4Addr::UNSPECIFIED).with(Protocol::Tcp(port)); + swarm.listen_on(listen_addr_tcp.clone())?; + + // UDP QUIC + let listen_addr_quic = + Multiaddr::from(Ipv4Addr::UNSPECIFIED).with(Protocol::Udp(port)).with(Protocol::QuicV1); + swarm.listen_on(listen_addr_quic.clone())?; + + // WebRTC + let listen_addr_webrtc = Multiaddr::from(Ipv4Addr::UNSPECIFIED) + .with(Protocol::Udp(port_webrtc)) + .with(Protocol::WebRTCDirect); + swarm.listen_on(listen_addr_webrtc.clone())?; + + // Clients will send their messages to the "message" topic + // with a room name as the message data. + // and we will forward those messages to a specific room - in this case the topic + // along with the message data. + swarm + .behaviour_mut() + .gossipsub + .subscribe(&IdentTopic::new(constants::MESSAGING_TOPIC)) + .unwrap(); + + Ok(Self { swarm }) + } + + pub async fn run(&mut self) { + loop { + match self.swarm.next().await.expect("Infinite Stream.") { + SwarmEvent::Behaviour(event) => { + match &event { + ServerEvent::Gossipsub(gossipsub::Event::Message { + propagation_source: peer_id, + message_id, + message, + }) => { + // Deserialize message. + // We shouldn't panic here + let message = serde_json::from_slice::(&message.data); + if let Err(e) = message { + info!( + target: "torii::relay::server", + error = %e, + "Failed to deserialize message" + ); + continue; + } + + let message = message.unwrap(); + + info!( + target: "torii::relay::server", + message_id = %message_id, + peer_id = %peer_id, + topic = %message.topic, + data = %String::from_utf8_lossy(&message.data), + "Received message" + ); + + // forward message to room + let server_message = + ServerMessage { peer_id: peer_id.to_bytes(), data: message.data }; + + if let Err(e) = self.swarm.behaviour_mut().gossipsub.publish( + IdentTopic::new(message.topic), + serde_json::to_string(&server_message) + .expect("Failed to serialize message") + .as_bytes(), + ) { + info!( + target: "torii::relay::server", + error = %e, + "Failed to publish message" + ); + } + } + ServerEvent::Identify(identify::Event::Received { + info: identify::Info { observed_addr, .. }, + peer_id, + }) => { + info!( + target: "torii::relay::server", + peer_id = %peer_id, + observed_addr = %observed_addr, + "Received identify event" + ); + self.swarm.add_external_address(observed_addr.clone()); + } + ServerEvent::Ping(ping::Event { peer, result, .. }) => { + info!( + target: "torii::relay::server", + peer_id = %peer, + result = ?result, + "Received ping event" + ); + } + _ => {} + } + } + SwarmEvent::NewListenAddr { address, .. } => { + info!(target: "torii::relay::server", address = %address, "New listen address"); + } + _ => {} + } + } + } +} + +fn read_or_create_identity(path: &Path) -> anyhow::Result { + if path.exists() { + let bytes = fs::read(path)?; + + info!(target: "torii::relay::server", path = %path.display(), "Using existing identity"); + + return Ok(identity::Keypair::from_protobuf_encoding(&bytes)?); // This only works for ed25519 but that is what we are using. + } + + let identity = identity::Keypair::generate_ed25519(); + + fs::write(path, identity.to_protobuf_encoding()?)?; + + info!(target: "torii::relay::server", path = %path.display(), "Generated new identity"); + + Ok(identity) +} + +fn read_or_create_certificate(path: &Path) -> anyhow::Result { + if path.exists() { + let pem = fs::read_to_string(path)?; + + info!(target: "torii::relay::server", path = %path.display(), "Using existing certificate"); + + return Ok(Certificate::from_pem(&pem)?); + } + + let cert = Certificate::generate(&mut rand::thread_rng())?; + fs::write(path, cert.serialize_pem().as_bytes())?; + + info!(target: "torii::relay::server", path = %path.display(), "Generated new certificate"); + + Ok(cert) +} + +#[cfg(test)] +mod tests { + use tempfile::tempdir; + + use super::*; + + #[tokio::test] + async fn test_read_or_create_identity() { + let dir = tempdir().unwrap(); + let identity_path = dir.path().join("identity"); + + // Test identity creation + let identity1 = read_or_create_identity(&identity_path).unwrap(); + assert!(identity_path.exists()); + + // Test identity reading + let identity2 = read_or_create_identity(&identity_path).unwrap(); + assert_eq!(identity1.public(), identity2.public()); + + dir.close().unwrap(); + } + + #[tokio::test] + async fn test_read_or_create_certificate() { + let dir = tempdir().unwrap(); + let cert_path = dir.path().join("certificate"); + + // Test certificate creation + let cert1 = read_or_create_certificate(&cert_path).unwrap(); + assert!(cert_path.exists()); + + // Test certificate reading + let cert2 = read_or_create_certificate(&cert_path).unwrap(); + assert_eq!(cert1.serialize_pem(), cert2.serialize_pem()); + + dir.close().unwrap(); + } +} diff --git a/crates/torii/libp2p/src/tests.rs b/crates/torii/libp2p/src/tests.rs new file mode 100644 index 0000000000..460779aa24 --- /dev/null +++ b/crates/torii/libp2p/src/tests.rs @@ -0,0 +1,105 @@ +#[cfg(test)] +mod test { + use std::error::Error; + + use futures::StreamExt; + + use crate::client::RelayClient; + + #[cfg(target_arch = "wasm32")] + wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); + #[cfg(target_arch = "wasm32")] + use wasm_bindgen_test::*; + + // This tests subscribing to a topic and receiving a message + #[cfg(not(target_arch = "wasm32"))] + #[tokio::test] + async fn test_client_messaging() -> Result<(), Box> { + use std::time::Duration; + + use tokio::time::sleep; + use tokio::{self, select}; + + use crate::server::Relay; + + let _ = tracing_subscriber::fmt() + .with_env_filter("torii::relay::client=debug,torii::relay::server=debug") + .try_init(); + // Initialize the relay server + let mut relay_server: Relay = Relay::new(9090, 9091, None, None)?; + tokio::spawn(async move { + relay_server.run().await; + }); + + // Initialize the first client (listener) + let mut client = RelayClient::new("/ip4/127.0.0.1/tcp/9090".to_string())?; + tokio::spawn(async move { + client.event_loop.run().await; + }); + + client.command_sender.subscribe("mawmaw".to_string()).await?; + sleep(Duration::from_secs(1)).await; + client.command_sender.publish("mawmaw".to_string(), "mimi".as_bytes().to_vec()).await?; + + let message_receiver = client.message_receiver.clone(); + let mut message_receiver = message_receiver.lock().await; + + loop { + select! { + event = message_receiver.next() => { + if let Some(message) = event { + println!("Received message from {:?} with id {:?}: {:?}", message.source, message.message_id, message); + return Ok(()); + } + } + _ = sleep(Duration::from_secs(5)) => { + println!("Test Failed: Did not receive message within 5 seconds."); + return Err("Timeout reached without receiving a message".into()); + } + } + } + } + + #[cfg(target_arch = "wasm32")] + #[wasm_bindgen_test] + async fn test_client_connection_wasm() -> Result<(), Box> { + use futures::future::{select, Either}; + use wasm_bindgen_futures::spawn_local; + + tracing_wasm::set_as_global_default(); + + let _ = tracing_subscriber::fmt().with_env_filter("torii_libp2p=debug").try_init(); + // Initialize the first client (listener) + // Make sure the cert hash is correct - corresponding to the cert in the relay server + let mut client = RelayClient::new( + "/ip4/127.0.0.1/udp/9091/webrtc-direct/certhash/\ + uEiD6v3wzt8XU3s3SqgNSBJPvn9E0VMVFm8-G0iSEsIIDxw" + .to_string(), + )?; + + spawn_local(async move { + client.event_loop.run().await; + }); + + // Give some time for the client to start up + let _ = wasm_timer::Delay::new(std::time::Duration::from_secs(10)).await; + + client.command_sender.subscribe("mawmaw".to_string()).await?; + let _ = wasm_timer::Delay::new(std::time::Duration::from_secs(1)).await; + client.command_sender.publish("mawmaw".to_string(), "mimi".as_bytes().to_vec()).await?; + + let timeout = wasm_timer::Delay::new(std::time::Duration::from_secs(5)); + let message_future = client.message_receiver.next(); + + match select(message_future, timeout).await { + Either::Left((Some(_message), _)) => { + println!("Test OK: Received message within 5 seconds."); + Ok(()) + } + _ => { + println!("Test Failed: Did not receive message within 5 seconds."); + Err("Timeout reached without receiving a message".into()) + } + } + } +} diff --git a/crates/torii/libp2p/src/types.rs b/crates/torii/libp2p/src/types.rs new file mode 100644 index 0000000000..4b75f26028 --- /dev/null +++ b/crates/torii/libp2p/src/types.rs @@ -0,0 +1,13 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Serialize, Deserialize)] +pub(crate) struct ClientMessage { + pub topic: String, + pub data: Vec, +} + +#[derive(Debug, Serialize, Deserialize)] +pub(crate) struct ServerMessage { + pub peer_id: Vec, + pub data: Vec, +}