diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index f4613da..0000000 --- a/Cargo.lock +++ /dev/null @@ -1,3204 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "aead" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" -dependencies = [ - "generic-array", -] - -[[package]] -name = "aes" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", - "opaque-debug", -] - -[[package]] -name = "aes-gcm" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df5f85a83a7d8b0442b6aa7b504b8212c1733da07b98aae43d4bc21b2cb3cdf6" -dependencies = [ - "aead", - "aes", - "cipher", - "ctr", - "ghash", - "subtle", -] - -[[package]] -name = "aho-corasick" -version = "0.7.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" -dependencies = [ - "memchr", -] - -[[package]] -name = "anyhow" -version = "1.0.66" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" - -[[package]] -name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - -[[package]] -name = "arrayvec" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" - -[[package]] -name = "asn1-rs" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf6690c370453db30743b373a60ba498fc0d6d83b11f4abfd87a84a075db5dd4" -dependencies = [ - "asn1-rs-derive", - "asn1-rs-impl", - "displaydoc", - "nom", - "num-traits", - "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", - "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", -] - -[[package]] -name = "asn1_der" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e22d1f4b888c298a027c99dc9048015fac177587de20fc30232a057dfbe24a21" - -[[package]] -name = "async-attributes" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3203e79f4dd9bdda415ed03cf14dae5a2bf775c683a00f94e9cd1faf0f596e5" -dependencies = [ - "quote", - "syn", -] - -[[package]] -name = "async-channel" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833" -dependencies = [ - "concurrent-queue", - "event-listener", - "futures-core", -] - -[[package]] -name = "async-executor" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17adb73da160dfb475c183343c8cccd80721ea5a605d3eb57125f0a7b7a92d0b" -dependencies = [ - "async-lock", - "async-task", - "concurrent-queue", - "fastrand", - "futures-lite", - "slab", -] - -[[package]] -name = "async-fs" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "279cf904654eeebfa37ac9bb1598880884924aab82e290aa65c9e77a0e142e06" -dependencies = [ - "async-lock", - "autocfg", - "blocking", - "futures-lite", -] - -[[package]] -name = "async-global-executor" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1b6f5d7df27bd294849f8eec66ecfc63d11814df7a4f5d74168a2394467b776" -dependencies = [ - "async-channel", - "async-executor", - "async-io", - "async-lock", - "blocking", - "futures-lite", - "once_cell", -] - -[[package]] -name = "async-io" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c374dda1ed3e7d8f0d9ba58715f924862c63eae6849c92d3a18e7fbde9e2794" -dependencies = [ - "async-lock", - "autocfg", - "concurrent-queue", - "futures-lite", - "libc", - "log", - "parking", - "polling", - "slab", - "socket2", - "waker-fn", - "windows-sys", -] - -[[package]] -name = "async-lock" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8101efe8695a6c17e02911402145357e718ac92d3ff88ae8419e84b1707b685" -dependencies = [ - "event-listener", - "futures-lite", -] - -[[package]] -name = "async-net" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4051e67316bc7eff608fe723df5d32ed639946adcd69e07df41fd42a7b411f1f" -dependencies = [ - "async-io", - "autocfg", - "blocking", - "futures-lite", -] - -[[package]] -name = "async-process" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6381ead98388605d0d9ff86371043b5aa922a3905824244de40dc263a14fcba4" -dependencies = [ - "async-io", - "async-lock", - "autocfg", - "blocking", - "cfg-if", - "event-listener", - "futures-lite", - "libc", - "signal-hook", - "windows-sys", -] - -[[package]] -name = "async-std" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" -dependencies = [ - "async-attributes", - "async-channel", - "async-global-executor", - "async-io", - "async-lock", - "async-process", - "crossbeam-utils", - "futures-channel", - "futures-core", - "futures-io", - "futures-lite", - "gloo-timers", - "kv-log-macro", - "log", - "memchr", - "once_cell", - "pin-project-lite", - "pin-utils", - "slab", - "wasm-bindgen-futures", -] - -[[package]] -name = "async-std-resolver" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ba50e24d9ee0a8950d3d03fc6d0dd10aa14b5de3b101949b4e160f7fee7c723" -dependencies = [ - "async-std", - "async-trait", - "futures-io", - "futures-util", - "pin-utils", - "socket2", - "trust-dns-resolver", -] - -[[package]] -name = "async-task" -version = "4.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" - -[[package]] -name = "async-trait" -version = "0.1.59" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6e93155431f3931513b243d371981bb2770112b370c82745a1d19d2f99364" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "atomic-waker" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a" - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "base-x" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" - -[[package]] -name = "base16ct" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" - -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - -[[package]] -name = "base64ct" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "blake2" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b12e5fd123190ce1c2e559308a94c9bacad77907d4c6005d9e58fe1a0689e55e" -dependencies = [ - "digest 0.10.6", -] - -[[package]] -name = "blake3" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ae2468a89544a466886840aa467a25b766499f4f04bf7d9fcd10ecee9fccef" -dependencies = [ - "arrayref", - "arrayvec", - "cc", - "cfg-if", - "constant_time_eq", -] - -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "generic-array", -] - -[[package]] -name = "block-buffer" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" -dependencies = [ - "generic-array", -] - -[[package]] -name = "blocking" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c67b173a56acffd6d2326fb7ab938ba0b00a71480e14902b2591c87bc5741e8" -dependencies = [ - "async-channel", - "async-lock", - "async-task", - "atomic-waker", - "fastrand", - "futures-lite", -] - -[[package]] -name = "bs58" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" - -[[package]] -name = "bumpalo" -version = "3.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" - -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - -[[package]] -name = "bytes" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" - -[[package]] -name = "cc" -version = "1.0.78" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chacha20" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c80e5460aa66fe3b91d40bcbdab953a597b60053e34d684ac6903f863b680a6" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", - "zeroize", -] - -[[package]] -name = "chacha20poly1305" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18446b09be63d457bbec447509e85f662f32952b035ce892290396bc0b0cff5" -dependencies = [ - "aead", - "chacha20", - "cipher", - "poly1305", - "zeroize", -] - -[[package]] -name = "cid" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9b68e3193982cd54187d71afdb2a271ad4cf8af157858e9cb911b91321de143" -dependencies = [ - "core2", - "multibase", - "multihash 0.17.0", - "serde", - "unsigned-varint", -] - -[[package]] -name = "cipher" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" -dependencies = [ - "generic-array", -] - -[[package]] -name = "concurrent-queue" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd7bef69dc86e3c610e4e7aed41035e2a7ed12e72dd7530f61327a6579a4390b" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "const-oid" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cec318a675afcb6a1ea1d4340e2d377e56e47c266f28043ceccbf4412ddfdd3b" - -[[package]] -name = "constant_time_eq" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3ad85c1f65dc7b37604eb0e89748faf0b9653065f2a8ef69f96a687ec1e9279" - -[[package]] -name = "core-foundation" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" - -[[package]] -name = "core2" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b49ba7ef1ad6107f8824dbe97de947cbaac53c44e7f9756a1fba0d37c1eec505" -dependencies = [ - "memchr", -] - -[[package]] -name = "cpufeatures" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" -dependencies = [ - "libc", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "ctor" -version = "0.1.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" -dependencies = [ - "quote", - "syn", -] - -[[package]] -name = "ctr" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" -dependencies = [ - "cipher", -] - -[[package]] -name = "curve25519-dalek" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" -dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.5.1", - "subtle", - "zeroize", -] - -[[package]] -name = "curve25519-dalek" -version = "4.0.0-pre.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67bc65846be335cb20f4e52d49a437b773a2c1fdb42b19fc84e79e6f6771536f" -dependencies = [ - "cfg-if", - "fiat-crypto", - "packed_simd_2", - "platforms", - "subtle", - "zeroize", -] - -[[package]] -name = "data-encoding" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d8666cb01533c39dde32bcbab8e227b4ed6679b2c925eba05feabea39508fb" - -[[package]] -name = "data-encoding-macro" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86927b7cd2fe88fa698b87404b287ab98d1a0063a34071d92e575b72d3029aca" -dependencies = [ - "data-encoding", - "data-encoding-macro-internal", -] - -[[package]] -name = "data-encoding-macro-internal" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5bbed42daaa95e780b60a50546aa345b8413a1e46f9a40a12907d3598f038db" -dependencies = [ - "data-encoding", - "syn", -] - -[[package]] -name = "der" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" -dependencies = [ - "const-oid", - "zeroize", -] - -[[package]] -name = "der-parser" -version = "8.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42d4bc9b0db0a0df9ae64634ac5bdefb7afcb534e182275ca0beadbe486701c1" -dependencies = [ - "asn1-rs", - "displaydoc", - "nom", - "num-bigint", - "num-traits", - "rusticata-macros", -] - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array", -] - -[[package]] -name = "digest" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" -dependencies = [ - "block-buffer 0.10.3", - "crypto-common", - "subtle", -] - -[[package]] -name = "displaydoc" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bf95dc3f046b9da4f2d51833c0d3547d8564ef6910f5c1ed130306a75b92886" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "ed25519" -version = "1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9c280362032ea4203659fc489832d0204ef09f247a0506f170dafcac08c369" -dependencies = [ - "signature", -] - -[[package]] -name = "ed25519-dalek" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" -dependencies = [ - "curve25519-dalek 3.2.0", - "ed25519", - "rand 0.7.3", - "serde", - "sha2 0.9.9", - "zeroize", -] - -[[package]] -name = "either" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" - -[[package]] -name = "enum-as-inner" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9720bba047d567ffc8a3cba48bf19126600e249ab7f128e9233e6376976a116" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "env_logger" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" -dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", -] - -[[package]] -name = "event-listener" -version = "2.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" - -[[package]] -name = "fastrand" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" -dependencies = [ - "instant", -] - -[[package]] -name = "fiat-crypto" -version = "0.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a214f5bb88731d436478f3ae1f8a277b62124089ba9fb67f4f93fb100ef73c90" - -[[package]] -name = "fixedbitset" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "form_urlencoded" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "futures" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" - -[[package]] -name = "futures-executor" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", - "num_cpus", -] - -[[package]] -name = "futures-io" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" - -[[package]] -name = "futures-lite" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" -dependencies = [ - "fastrand", - "futures-core", - "futures-io", - "memchr", - "parking", - "pin-project-lite", - "waker-fn", -] - -[[package]] -name = "futures-macro" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "futures-rustls" -version = "0.22.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2411eed028cdf8c8034eaf21f9915f956b6c3abec4d4c7949ee67f0721127bd" -dependencies = [ - "futures-io", - "rustls", - "webpki", -] - -[[package]] -name = "futures-sink" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" - -[[package]] -name = "futures-task" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" - -[[package]] -name = "futures-timer" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" - -[[package]] -name = "futures-util" -version = "0.3.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "generic-array" -version = "0.14.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - -[[package]] -name = "getrandom" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", -] - -[[package]] -name = "ghash" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" -dependencies = [ - "opaque-debug", - "polyval", -] - -[[package]] -name = "gloo-timers" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98c4a8d6391675c6b2ee1a6c8d06e8e2d03605c44cec1270675985a4c2a5500b" -dependencies = [ - "futures-channel", - "futures-core", - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "heck" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[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 = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - -[[package]] -name = "idna" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "idna" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "if-addrs" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbc0fa01ffc752e9dbc72818cdb072cd028b86be5e09dd04c5a643704fe101a9" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "if-watch" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba7abdbb86e485125dad06c2691e1e393bf3b08c7b743b43aa162a00fd39062e" -dependencies = [ - "async-io", - "core-foundation", - "fnv", - "futures", - "if-addrs", - "ipnet", - "log", - "rtnetlink", - "smol", - "system-configuration", - "windows", -] - -[[package]] -name = "indexmap" -version = "1.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" -dependencies = [ - "autocfg", - "hashbrown", -] - -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "ipconfig" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd302af1b90f2463a98fa5ad469fc212c8e3175a41c3068601bfa2727591c5be" -dependencies = [ - "socket2", - "widestring", - "winapi", - "winreg", -] - -[[package]] -name = "ipnet" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11b0d96e660696543b251e58030cf9787df56da39dab19ad60eae7353040917e" - -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" - -[[package]] -name = "js-sys" -version = "0.3.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "kv-log-macro" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" -dependencies = [ - "log", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.138" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8" - -[[package]] -name = "libipld" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a20e38e0ad9a2fd600476691fa0780421931a198279985e398a3a0851903e1b2" -dependencies = [ - "fnv", - "libipld-cbor", - "libipld-core", - "libipld-macro", - "log", - "multihash 0.17.0", - "thiserror", -] - -[[package]] -name = "libipld-cbor" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b75370e27e0745910a9991c83f365cdae58027acf0502aa7987ac538a8a4744" -dependencies = [ - "byteorder", - "libipld-core", - "thiserror", -] - -[[package]] -name = "libipld-core" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7a704ba3b25dee9e7a2361fae2c7c19defae2a92e69ae96ffb203996705cd7c" -dependencies = [ - "anyhow", - "cid", - "core2", - "multibase", - "multihash 0.17.0", - "thiserror", -] - -[[package]] -name = "libipld-macro" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4c7ccd89e54f2796cf3f99aabeea7a7751d418df504926544f28348d3c890c7" -dependencies = [ - "libipld-core", -] - -[[package]] -name = "libm" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" - -[[package]] -name = "libp2p" -version = "0.50.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e0a0d2f693675f49ded13c5d510c48b78069e23cbd9108d7ccd59f6dc568819" -dependencies = [ - "bytes", - "futures", - "futures-timer", - "getrandom 0.2.8", - "instant", - "libp2p-core", - "libp2p-dns", - "libp2p-mdns", - "libp2p-noise", - "libp2p-quic", - "libp2p-request-response", - "libp2p-swarm", - "libp2p-tcp", - "libp2p-yamux", - "multiaddr", - "parking_lot", - "pin-project", - "smallvec", -] - -[[package]] -name = "libp2p-bitswap" -version = "0.25.0" -dependencies = [ - "async-std", - "async-trait", - "env_logger", - "fnv", - "futures", - "lazy_static", - "libipld", - "libp2p", - "multihash 0.17.0", - "prometheus", - "prost", - "prost-build", - "thiserror", - "tracing", - "tracing-subscriber", - "unsigned-varint", -] - -[[package]] -name = "libp2p-core" -version = "0.38.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6a8fcd392ff67af6cc3f03b1426c41f7f26b6b9aff2dc632c1c56dd649e571f" -dependencies = [ - "asn1_der", - "bs58", - "ed25519-dalek", - "either", - "fnv", - "futures", - "futures-timer", - "instant", - "log", - "multiaddr", - "multihash 0.16.3", - "multistream-select", - "once_cell", - "parking_lot", - "pin-project", - "prost", - "prost-build", - "rand 0.8.5", - "ring", - "rw-stream-sink", - "sec1", - "sha2 0.10.6", - "smallvec", - "thiserror", - "unsigned-varint", - "void", - "zeroize", -] - -[[package]] -name = "libp2p-dns" -version = "0.38.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e42a271c1b49f789b92f7fc87749fa79ce5c7bdc88cbdfacb818a4bca47fec5" -dependencies = [ - "async-std-resolver", - "futures", - "libp2p-core", - "log", - "parking_lot", - "smallvec", - "trust-dns-resolver", -] - -[[package]] -name = "libp2p-mdns" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04f378264aade9872d6ccd315c0accc18be3a35d15fc1b9c36e5b6f983b62b5b" -dependencies = [ - "async-io", - "data-encoding", - "futures", - "if-watch", - "libp2p-core", - "libp2p-swarm", - "log", - "rand 0.8.5", - "smallvec", - "socket2", - "trust-dns-proto", - "void", -] - -[[package]] -name = "libp2p-noise" -version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a978cb57efe82e892ec6f348a536bfbd9fee677adbe5689d7a93ad3a9bffbf2e" -dependencies = [ - "bytes", - "curve25519-dalek 3.2.0", - "futures", - "libp2p-core", - "log", - "once_cell", - "prost", - "prost-build", - "rand 0.8.5", - "sha2 0.10.6", - "snow", - "static_assertions", - "thiserror", - "x25519-dalek", - "zeroize", -] - -[[package]] -name = "libp2p-quic" -version = "0.7.0-alpha" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01e7c867e95c8130667b24409d236d37598270e6da69b3baf54213ba31ffca59" -dependencies = [ - "async-std", - "bytes", - "futures", - "futures-timer", - "if-watch", - "libp2p-core", - "libp2p-tls", - "log", - "parking_lot", - "quinn-proto", - "rand 0.8.5", - "rustls", - "thiserror", -] - -[[package]] -name = "libp2p-request-response" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3236168796727bfcf4927f766393415361e2c644b08bedb6a6b13d957c9a4884" -dependencies = [ - "async-trait", - "bytes", - "futures", - "instant", - "libp2p-core", - "libp2p-swarm", - "log", - "rand 0.8.5", - "smallvec", - "unsigned-varint", -] - -[[package]] -name = "libp2p-swarm" -version = "0.41.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2a35472fe3276b3855c00f1c032ea8413615e030256429ad5349cdf67c6e1a0" -dependencies = [ - "async-std", - "either", - "fnv", - "futures", - "futures-timer", - "instant", - "libp2p-core", - "log", - "pin-project", - "rand 0.8.5", - "smallvec", - "thiserror", - "void", -] - -[[package]] -name = "libp2p-tcp" -version = "0.38.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4b257baf6df8f2df39678b86c578961d48cc8b68642a12f0f763f56c8e5858d" -dependencies = [ - "async-io", - "futures", - "futures-timer", - "if-watch", - "libc", - "libp2p-core", - "log", - "socket2", -] - -[[package]] -name = "libp2p-tls" -version = "0.1.0-alpha" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7905ce0d040576634e8a3229a7587cc8beab83f79db6023800f1792895defa8" -dependencies = [ - "futures", - "futures-rustls", - "libp2p-core", - "rcgen", - "ring", - "rustls", - "thiserror", - "webpki", - "x509-parser", - "yasna", -] - -[[package]] -name = "libp2p-yamux" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f63594a0aa818642d9d4915c791945053877253f08a3626f13416b5cd928a29" -dependencies = [ - "futures", - "libp2p-core", - "log", - "parking_lot", - "thiserror", - "yamux", -] - -[[package]] -name = "linked-hash-map" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" - -[[package]] -name = "lock_api" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", - "value-bag", -] - -[[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 = "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" -dependencies = [ - "regex-automata", -] - -[[package]] -name = "matches" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - -[[package]] -name = "mio" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" -dependencies = [ - "libc", - "log", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys", -] - -[[package]] -name = "multiaddr" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4aebdb21e90f81d13ed01dc84123320838e53963c2ca94b60b305d3fa64f31e" -dependencies = [ - "arrayref", - "byteorder", - "data-encoding", - "multibase", - "multihash 0.16.3", - "percent-encoding", - "serde", - "static_assertions", - "unsigned-varint", - "url", -] - -[[package]] -name = "multibase" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b3539ec3c1f04ac9748a260728e855f261b4977f5c3406612c884564f329404" -dependencies = [ - "base-x", - "data-encoding", - "data-encoding-macro", -] - -[[package]] -name = "multihash" -version = "0.16.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c346cf9999c631f002d8f977c4eaeaa0e6386f16007202308d0b3757522c2cc" -dependencies = [ - "core2", - "digest 0.10.6", - "multihash-derive", - "sha2 0.10.6", - "unsigned-varint", -] - -[[package]] -name = "multihash" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "835d6ff01d610179fbce3de1694d007e500bf33a7f29689838941d6bf783ae40" -dependencies = [ - "blake3", - "core2", - "digest 0.10.6", - "multihash-derive", - "sha2 0.10.6", - "unsigned-varint", -] - -[[package]] -name = "multihash-derive" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6d4752e6230d8ef7adf7bd5d8c4b1f6561c1014c5ba9a37445ccefe18aa1db" -dependencies = [ - "proc-macro-crate", - "proc-macro-error", - "proc-macro2", - "quote", - "syn", - "synstructure", -] - -[[package]] -name = "multimap" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" - -[[package]] -name = "multistream-select" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8552ab875c1313b97b8d20cb857b9fd63e2d1d6a0a1b53ce9821e575405f27a" -dependencies = [ - "bytes", - "futures", - "log", - "pin-project", - "smallvec", - "unsigned-varint", -] - -[[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", - "byteorder", - "libc", - "netlink-packet-core", - "netlink-packet-utils", -] - -[[package]] -name = "netlink-packet-utils" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25af9cf0dc55498b7bd94a1508af7a78706aa0ab715a73c5169273e03c84845e" -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.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92b654097027250401127914afb37cb1f311df6610a9891ff07a757e94199027" -dependencies = [ - "async-io", - "bytes", - "futures", - "libc", - "log", -] - -[[package]] -name = "nix" -version = "0.24.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" -dependencies = [ - "bitflags", - "cfg-if", - "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.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" -dependencies = [ - "memchr", - "minimal-lexical", -] - -[[package]] -name = "nu-ansi-term" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" -dependencies = [ - "overload", - "winapi", -] - -[[package]] -name = "num-bigint" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" -dependencies = [ - "hermit-abi", - "libc", -] - -[[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.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" - -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - -[[package]] -name = "packed_simd_2" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1914cd452d8fccd6f9db48147b29fd4ae05bea9dc5d9ad578509f72415de282" -dependencies = [ - "cfg-if", - "libm", -] - -[[package]] -name = "parking" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" - -[[package]] -name = "parking_lot" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-sys", -] - -[[package]] -name = "paste" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1c2c742266c2f1041c914ba65355a83ae8747b05f208319784083583494b4b" - -[[package]] -name = "pem" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c64931a1a212348ec4f3b4362585eca7159d0d09cbdf4a7f74f02173596fd4" -dependencies = [ - "base64", -] - -[[package]] -name = "percent-encoding" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" - -[[package]] -name = "petgraph" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5014253a1331579ce62aa67443b4a658c5e7dd03d4bc6d302b94474888143" -dependencies = [ - "fixedbitset", - "indexmap", -] - -[[package]] -name = "pin-project" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkcs8" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" -dependencies = [ - "der", - "spki", -] - -[[package]] -name = "platforms" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d7ddaed09e0eb771a79ab0fd64609ba0afb0a8366421957936ad14cbd13630" - -[[package]] -name = "polling" -version = "2.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22122d5ec4f9fe1b3916419b76be1e80bcb93f618d071d2edf841b137b2a2bd6" -dependencies = [ - "autocfg", - "cfg-if", - "libc", - "log", - "wepoll-ffi", - "windows-sys", -] - -[[package]] -name = "poly1305" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede" -dependencies = [ - "cpufeatures", - "opaque-debug", - "universal-hash", -] - -[[package]] -name = "polyval" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" -dependencies = [ - "cfg-if", - "cpufeatures", - "opaque-debug", - "universal-hash", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" - -[[package]] -name = "prettyplease" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c142c0e46b57171fe0c528bee8c5b7569e80f0c17e377cd0e30ea57dbc11bb51" -dependencies = [ - "proc-macro2", - "syn", -] - -[[package]] -name = "proc-macro-crate" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e17d47ce914bf4de440332250b0edd23ce48c005f59fab39d3335866b114f11a" -dependencies = [ - "thiserror", - "toml", -] - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - -[[package]] -name = "proc-macro2" -version = "1.0.47" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "prometheus" -version = "0.13.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "449811d15fbdf5ceb5c1144416066429cf82316e2ec8ce0c1f6f8a02e7bbcf8c" -dependencies = [ - "cfg-if", - "fnv", - "lazy_static", - "memchr", - "parking_lot", - "protobuf", - "thiserror", -] - -[[package]] -name = "prost" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0b18e655c21ff5ac2084a5ad0611e827b3f92badf79f4910b5a5c58f4d87ff0" -dependencies = [ - "bytes", - "prost-derive", -] - -[[package]] -name = "prost-build" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "276470f7f281b0ed53d2ae42dd52b4a8d08853a3c70e7fe95882acbb98a6ae94" -dependencies = [ - "bytes", - "heck", - "itertools", - "lazy_static", - "log", - "multimap", - "petgraph", - "prettyplease", - "prost", - "prost-types", - "regex", - "syn", - "tempfile", - "which", -] - -[[package]] -name = "prost-derive" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "164ae68b6587001ca506d3bf7f1000bfa248d0e1217b618108fba4ec1d0cc306" -dependencies = [ - "anyhow", - "itertools", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "prost-types" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "747761bc3dc48f9a34553bf65605cf6cb6288ba219f3450b4275dbd81539551a" -dependencies = [ - "bytes", - "prost", -] - -[[package]] -name = "protobuf" -version = "2.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" - -[[package]] -name = "quick-error" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" - -[[package]] -name = "quinn-proto" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4ced82a24bb281af338b9e8f94429b6eca01b4e66d899f40031f074e74c9" -dependencies = [ - "bytes", - "rand 0.8.5", - "ring", - "rustc-hash", - "rustls", - "slab", - "thiserror", - "tinyvec", - "tracing", - "webpki", -] - -[[package]] -name = "quote" -version = "1.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom 0.2.8", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core 0.5.1", -] - -[[package]] -name = "rcgen" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffbe84efe2f38dea12e9bfc1f65377fdf03e53a18cb3b995faedf7934c7e785b" -dependencies = [ - "pem", - "ring", - "time", - "yasna", -] - -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags", -] - -[[package]] -name = "regex" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.6.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" - -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] - -[[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 = "ring" -version = "0.16.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" -dependencies = [ - "cc", - "libc", - "once_cell", - "spin", - "untrusted", - "web-sys", - "winapi", -] - -[[package]] -name = "rtnetlink" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322c53fd76a18698f1c27381d58091de3a043d356aa5bd0d510608b565f469a0" -dependencies = [ - "async-global-executor", - "futures", - "log", - "netlink-packet-route", - "netlink-proto", - "nix", - "thiserror", -] - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -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 = "rustls" -version = "0.20.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "539a2bfe908f471bfa933876bd1eb6a19cf2176d375f82ef7f99530a40e48c2c" -dependencies = [ - "log", - "ring", - "sct", - "webpki", -] - -[[package]] -name = "rw-stream-sink" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26338f5e09bb721b85b135ea05af7767c90b52f6de4f087d4f4a3a9d64e7dc04" -dependencies = [ - "futures", - "pin-project", - "static_assertions", -] - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "sct" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "sec1" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" -dependencies = [ - "base16ct", - "der", - "generic-array", - "pkcs8", - "zeroize", -] - -[[package]] -name = "semver" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" - -[[package]] -name = "serde" -version = "1.0.150" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e326c9ec8042f1b5da33252c8a37e9ffbd2c9bef0155215b6e6c80c790e05f91" - -[[package]] -name = "sha2" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug", -] - -[[package]] -name = "sha2" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.10.6", -] - -[[package]] -name = "sharded-slab" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "signal-hook" -version = "0.3.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a253b5e89e2698464fc26b545c9edceb338e18a89effeeecfea192c3025be29d" -dependencies = [ - "libc", - "signal-hook-registry", -] - -[[package]] -name = "signal-hook-registry" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" -dependencies = [ - "libc", -] - -[[package]] -name = "signature" -version = "1.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" - -[[package]] -name = "slab" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" -dependencies = [ - "autocfg", -] - -[[package]] -name = "smallvec" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" - -[[package]] -name = "smol" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13f2b548cd8447f8de0fdf1c592929f70f4fc7039a05e47404b0d096ec6987a1" -dependencies = [ - "async-channel", - "async-executor", - "async-fs", - "async-io", - "async-lock", - "async-net", - "async-process", - "blocking", - "futures-lite", -] - -[[package]] -name = "snow" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "774d05a3edae07ce6d68ea6984f3c05e9bba8927e3dd591e3b479e5b03213d0d" -dependencies = [ - "aes-gcm", - "blake2", - "chacha20poly1305", - "curve25519-dalek 4.0.0-pre.5", - "rand_core 0.6.4", - "ring", - "rustc_version", - "sha2 0.10.6", - "subtle", -] - -[[package]] -name = "socket2" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - -[[package]] -name = "spki" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" -dependencies = [ - "base64ct", - "der", -] - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "subtle" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" - -[[package]] -name = "syn" -version = "1.0.105" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "synstructure" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "unicode-xid", -] - -[[package]] -name = "system-configuration" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d75182f12f490e953596550b65ee31bda7c8e043d9386174b353bda50838c3fd" -dependencies = [ - "bitflags", - "core-foundation", - "system-configuration-sys", -] - -[[package]] -name = "system-configuration-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "tempfile" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" -dependencies = [ - "cfg-if", - "fastrand", - "libc", - "redox_syscall", - "remove_dir_all", - "winapi", -] - -[[package]] -name = "termcolor" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "thiserror" -version = "1.0.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "thread_local" -version = "1.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" -dependencies = [ - "once_cell", -] - -[[package]] -name = "time" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376" -dependencies = [ - "itoa", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" - -[[package]] -name = "time-macros" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2" -dependencies = [ - "time-core", -] - -[[package]] -name = "tinyvec" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" - -[[package]] -name = "tokio" -version = "1.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eab6d665857cc6ca78d6e80303a02cea7a7851e85dfbd77cbdc09bd129f1ef46" -dependencies = [ - "autocfg", - "bytes", - "libc", - "memchr", - "mio", - "num_cpus", - "pin-project-lite", - "socket2", - "windows-sys", -] - -[[package]] -name = "toml" -version = "0.5.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f" -dependencies = [ - "serde", -] - -[[package]] -name = "tracing" -version = "0.1.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" -dependencies = [ - "cfg-if", - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tracing-core" -version = "0.1.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" -dependencies = [ - "once_cell", - "valuable", -] - -[[package]] -name = "tracing-log" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" -dependencies = [ - "lazy_static", - "log", - "tracing-core", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6176eae26dd70d0c919749377897b54a9276bd7061339665dd68777926b5a70" -dependencies = [ - "matchers", - "nu-ansi-term", - "once_cell", - "regex", - "sharded-slab", - "smallvec", - "thread_local", - "tracing", - "tracing-core", - "tracing-log", -] - -[[package]] -name = "trust-dns-proto" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f7f83d1e4a0e4358ac54c5c3681e5d7da5efc5a7a632c90bb6d6669ddd9bc26" -dependencies = [ - "async-trait", - "cfg-if", - "data-encoding", - "enum-as-inner", - "futures-channel", - "futures-io", - "futures-util", - "idna 0.2.3", - "ipnet", - "lazy_static", - "rand 0.8.5", - "smallvec", - "socket2", - "thiserror", - "tinyvec", - "tokio", - "tracing", - "url", -] - -[[package]] -name = "trust-dns-resolver" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aff21aa4dcefb0a1afbfac26deb0adc93888c7d295fb63ab273ef276ba2b7cfe" -dependencies = [ - "cfg-if", - "futures-util", - "ipconfig", - "lazy_static", - "lru-cache", - "parking_lot", - "resolv-conf", - "smallvec", - "thiserror", - "tracing", - "trust-dns-proto", -] - -[[package]] -name = "typenum" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" - -[[package]] -name = "unicode-bidi" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" - -[[package]] -name = "unicode-ident" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" - -[[package]] -name = "unicode-normalization" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - -[[package]] -name = "universal-hash" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" -dependencies = [ - "generic-array", - "subtle", -] - -[[package]] -name = "unsigned-varint" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d86a8dc7f45e4c1b0d30e43038c38f274e77af056aa5f74b93c2cf9eb3c1c836" -dependencies = [ - "futures-io", - "futures-util", -] - -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - -[[package]] -name = "url" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" -dependencies = [ - "form_urlencoded", - "idna 0.3.0", - "percent-encoding", -] - -[[package]] -name = "valuable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" - -[[package]] -name = "value-bag" -version = "1.0.0-alpha.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2209b78d1249f7e6f3293657c9779fe31ced465df091bbd433a1cf88e916ec55" -dependencies = [ - "ctor", - "version_check", -] - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" - -[[package]] -name = "waker-fn" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" - -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" - -[[package]] -name = "web-sys" -version = "0.3.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webpki" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "wepoll-ffi" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d743fdedc5c64377b5fc2bc036b01c7fd642205a0d96356034ae3404d49eb7fb" -dependencies = [ - "cc", -] - -[[package]] -name = "which" -version = "4.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c831fbbee9e129a8cf93e7747a82da9d95ba8e16621cae60ec2cdc849bacb7b" -dependencies = [ - "either", - "libc", - "once_cell", -] - -[[package]] -name = "widestring" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17882f045410753661207383517a6f62ec3dbeb6a4ed2acce01f0728238d1983" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45296b64204227616fdbf2614cefa4c236b98ee64dfaaaa435207ed99fe7829f" -dependencies = [ - "windows_aarch64_msvc 0.34.0", - "windows_i686_gnu 0.34.0", - "windows_i686_msvc 0.34.0", - "windows_x86_64_gnu 0.34.0", - "windows_x86_64_msvc 0.34.0", -] - -[[package]] -name = "windows-sys" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.0", - "windows_i686_gnu 0.42.0", - "windows_i686_msvc 0.42.0", - "windows_x86_64_gnu 0.42.0", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.0", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17cffbe740121affb56fad0fc0e421804adf0ae00891205213b5cecd30db881d" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" - -[[package]] -name = "windows_i686_gnu" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2564fde759adb79129d9b4f54be42b32c89970c18ebf93124ca8870a498688ed" - -[[package]] -name = "windows_i686_gnu" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" - -[[package]] -name = "windows_i686_msvc" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cd9d32ba70453522332c14d38814bceeb747d80b3958676007acadd7e166956" - -[[package]] -name = "windows_i686_msvc" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfce6deae227ee8d356d19effc141a509cc503dfd1f850622ec4b0f84428e1f4" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d19538ccc21819d01deaf88d6a17eae6596a12e9aafdbb97916fb49896d89de9" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" - -[[package]] -name = "winreg" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" -dependencies = [ - "winapi", -] - -[[package]] -name = "x25519-dalek" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a0c105152107e3b96f6a00a65e86ce82d9b125230e1c4302940eca58ff71f4f" -dependencies = [ - "curve25519-dalek 3.2.0", - "rand_core 0.5.1", - "zeroize", -] - -[[package]] -name = "x509-parser" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0ecbeb7b67ce215e40e3cc7f2ff902f94a223acf44995934763467e7b1febc8" -dependencies = [ - "asn1-rs", - "base64", - "data-encoding", - "der-parser", - "lazy_static", - "nom", - "oid-registry", - "rusticata-macros", - "thiserror", - "time", -] - -[[package]] -name = "yamux" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d9ba232399af1783a58d8eb26f6b5006fbefe2dc9ef36bd283324792d03ea5" -dependencies = [ - "futures", - "log", - "nohash-hasher", - "parking_lot", - "rand 0.8.5", - "static_assertions", -] - -[[package]] -name = "yasna" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "346d34a236c9d3e5f3b9b74563f238f955bbd05fa0b8b4efa53c130c43982f4c" -dependencies = [ - "time", -] - -[[package]] -name = "zeroize" -version = "1.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] diff --git a/Cargo.toml b/Cargo.toml index c024d93..2d7f487 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libp2p-bitswap" -version = "0.25.0" +version = "0.26.0" authors = ["David Craven "] edition = "2018" description = "Implementation of the ipfs bitswap protocol." @@ -15,11 +15,12 @@ prost-build = { version = "0.11", optional = true } [dependencies] async-trait = "0.1.52" +either = "1.8.1" fnv = "1.0.7" futures = "0.3.19" lazy_static = "1.4.0" -libipld = { version = "0.15.0", default-features = false } -libp2p = { version = "0.50.0", features = ["request-response"] } +libipld = { version = "0.16.0", default-features = false } +libp2p = { version = "0.51.3", features = ["request-response"] } prometheus = "0.13.0" prost = { version = "0.11", optional = true } thiserror = "1.0.30" @@ -29,7 +30,7 @@ unsigned-varint = { version = "0.7.1", features = ["futures", "std"] } [dev-dependencies] async-std = { version = "1.10.0", features = ["attributes"] } env_logger = "0.9.0" -libipld = { version = "0.15.0", default-features = false, features = ["dag-cbor"] } -libp2p = { version = "0.50.0", features = ["tcp", "noise", "yamux", "rsa", "async-std"] } -multihash = { version = "0.17.0", default-features = false, features = ["blake3", "sha2"] } +libipld = { version = "0.16.0", default-features = false, features = ["dag-cbor"] } +libp2p = { version = "0.51.3", features = ["tcp", "noise", "yamux", "rsa", "async-std"] } +multihash = { version = "0.18", default-features = false, features = ["blake3", "sha2"] } tracing-subscriber = { version = "0.3.5", features = ["env-filter", "tracing-log"] } diff --git a/src/behaviour.rs b/src/behaviour.rs index b025b94..77fece5 100644 --- a/src/behaviour.rs +++ b/src/behaviour.rs @@ -5,37 +5,67 @@ //! //! The `Bitswap` struct implements the `NetworkBehaviour` trait. When used, it //! will allow providing and reciving IPFS blocks. + #[cfg(feature = "compat")] -use crate::compat::{CompatMessage, CompatProtocol, InboundMessage}; -use crate::protocol::{ - BitswapCodec, BitswapProtocol, BitswapRequest, BitswapResponse, RequestType, -}; -use crate::query::{QueryEvent, QueryId, QueryManager, Request, Response}; -use crate::stats::*; -use fnv::FnvHashMap; +use either::Either; #[cfg(feature = "compat")] use fnv::FnvHashSet; -use futures::{ +#[cfg(feature = "compat")] +use libp2p::swarm::{ConnectionHandlerSelect, NotifyHandler, OneShotHandler}; +use { + crate::{ + protocol::{ + BitswapCodec, + BitswapProtocol, + BitswapRequest, + BitswapResponse, + RequestType, + }, + query::{QueryEvent, QueryId, QueryManager, Request, Response}, + stats::*, + }, + fnv::FnvHashMap, + futures::{ channel::mpsc, stream::{Stream, StreamExt}, task::{Context, Poll}, -}; -use libipld::{error::BlockNotFound, store::StoreParams, Block, Cid, Result}; -#[cfg(feature = "compat")] -use libp2p::core::either::EitherOutput; -use libp2p::core::{connection::ConnectionId, Multiaddr, PeerId}; -use libp2p::swarm::derive_prelude::{ConnectionClosed, DialFailure, FromSwarm, ListenFailure}; -#[cfg(feature = "compat")] -use libp2p::swarm::{ConnectionHandlerSelect, NotifyHandler, OneShotHandler}; -use libp2p::{ + }, + libipld::{error::BlockNotFound, store::StoreParams, Block, Cid, Result}, + libp2p::{ + core::Multiaddr, request_response::{ - InboundFailure, OutboundFailure, ProtocolSupport, RequestId, RequestResponse, - RequestResponseConfig, RequestResponseEvent, RequestResponseMessage, ResponseChannel, + Behaviour as RequestResponse, + Config as RequestResponseConfig, + Event as RequestResponseEvent, + InboundFailure, + Message as RequestResponseMessage, + OutboundFailure, + ProtocolSupport, + RequestId, + ResponseChannel, }, - swarm::{ConnectionHandler, NetworkBehaviour, NetworkBehaviourAction, PollParameters}, + swarm::{ + derive_prelude::{ + ConnectionClosed, + DialFailure, + FromSwarm, + ListenFailure, + }, + ConnectionHandler, + ConnectionId, + NetworkBehaviour, + PollParameters, + THandlerInEvent, + ToSwarm, + }, + PeerId, + }, + prometheus::Registry, + std::{pin::Pin, time::Duration}, }; -use prometheus::Registry; -use std::{pin::Pin, time::Duration}; + +#[cfg(feature = "compat")] +use crate::compat::{CompatMessage, CompatProtocol, InboundMessage}; /// Bitswap response channel. pub type Channel = ResponseChannel; @@ -43,922 +73,1045 @@ pub type Channel = ResponseChannel; /// Event emitted by the bitswap behaviour. #[derive(Debug)] pub enum BitswapEvent { - /// Received a block from a peer. Includes the number of known missing blocks for a - /// sync query. When a block is received and missing blocks is not empty the counter - /// is increased. If missing blocks is empty the counter is decremented. - Progress(QueryId, usize), - /// A get or sync query completed. - Complete(QueryId, Result<()>), + /// Received a block from a peer. Includes the number of known missing blocks + /// for a sync query. When a block is received and missing blocks is not + /// empty the counter is increased. If missing blocks is empty the counter + /// is decremented. + Progress(QueryId, usize), + /// A get or sync query completed. + Complete(QueryId, Result<()>), } /// Trait implemented by a block store. pub trait BitswapStore: Send + Sync + 'static { - /// The store params. - type Params: StoreParams; - /// A have query needs to know if the block store contains the block. - fn contains(&mut self, cid: &Cid) -> Result; - /// A block query needs to retrieve the block from the store. - fn get(&mut self, cid: &Cid) -> Result>>; - /// A block response needs to insert the block into the store. - fn insert(&mut self, block: &Block) -> Result<()>; - /// A sync query needs a list of missing blocks to make progress. - fn missing_blocks(&mut self, cid: &Cid) -> Result>; + /// The store params. + type Params: StoreParams; + /// A have query needs to know if the block store contains the block. + fn contains(&mut self, cid: &Cid) -> Result; + /// A block query needs to retrieve the block from the store. + fn get(&mut self, cid: &Cid) -> Result>>; + /// A block response needs to insert the block into the store. + fn insert(&mut self, block: &Block) -> Result<()>; + /// A sync query needs a list of missing blocks to make progress. + fn missing_blocks(&mut self, cid: &Cid) -> Result>; } /// Bitswap configuration. #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub struct BitswapConfig { - /// Timeout of a request. - pub request_timeout: Duration, - /// Time a connection is kept alive. - pub connection_keep_alive: Duration, + /// Timeout of a request. + pub request_timeout: Duration, + /// Time a connection is kept alive. + pub connection_keep_alive: Duration, } impl BitswapConfig { - /// Creates a new `BitswapConfig`. - pub fn new() -> Self { - Self { - request_timeout: Duration::from_secs(10), - connection_keep_alive: Duration::from_secs(10), - } + /// Creates a new `BitswapConfig`. + pub fn new() -> Self { + Self { + request_timeout: Duration::from_secs(10), + connection_keep_alive: Duration::from_secs(10), } + } } impl Default for BitswapConfig { - fn default() -> Self { - Self::new() - } + fn default() -> Self { + Self::new() + } } #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] enum BitswapId { - Bitswap(RequestId), - #[cfg(feature = "compat")] - Compat(Cid), + Bitswap(RequestId), + #[cfg(feature = "compat")] + Compat(Cid), } enum BitswapChannel { - Bitswap(Channel), - #[cfg(feature = "compat")] - Compat(PeerId, Cid), + Bitswap(Channel), + #[cfg(feature = "compat")] + Compat(PeerId, Cid), } /// Network behaviour that handles sending and receiving blocks. pub struct Bitswap { - /// Inner behaviour. - inner: RequestResponse>, - /// Query manager. - query_manager: QueryManager, - /// Requests. - requests: FnvHashMap, - /// Db request channel. - db_tx: mpsc::UnboundedSender>, - /// Db response channel. - db_rx: mpsc::UnboundedReceiver, - /// Compat peers. - #[cfg(feature = "compat")] - compat: FnvHashSet, + /// Inner behaviour. + inner: RequestResponse>, + /// Query manager. + query_manager: QueryManager, + /// Requests. + requests: FnvHashMap, + /// Db request channel. + db_tx: mpsc::UnboundedSender>, + /// Db response channel. + db_rx: mpsc::UnboundedReceiver, + /// Compat peers. + #[cfg(feature = "compat")] + compat: FnvHashSet, } impl Bitswap

{ - /// Creates a new `Bitswap` behaviour. - pub fn new>(config: BitswapConfig, store: S) -> Self { - let mut rr_config = RequestResponseConfig::default(); - rr_config.set_connection_keep_alive(config.connection_keep_alive); - rr_config.set_request_timeout(config.request_timeout); - let protocols = std::iter::once((BitswapProtocol, ProtocolSupport::Full)); - let inner = RequestResponse::new(BitswapCodec::

::default(), protocols, rr_config); - let (db_tx, db_rx) = start_db_thread(store); - Self { - inner, - query_manager: Default::default(), - requests: Default::default(), - db_tx, - db_rx, - #[cfg(feature = "compat")] - compat: Default::default(), - } + /// Creates a new `Bitswap` behaviour. + pub fn new>( + config: BitswapConfig, + store: S, + ) -> Self { + let mut rr_config = RequestResponseConfig::default(); + rr_config.set_connection_keep_alive(config.connection_keep_alive); + rr_config.set_request_timeout(config.request_timeout); + let protocols = std::iter::once((BitswapProtocol, ProtocolSupport::Full)); + let inner = + RequestResponse::new(BitswapCodec::

::default(), protocols, rr_config); + let (db_tx, db_rx) = start_db_thread(store); + Self { + inner, + query_manager: Default::default(), + requests: Default::default(), + db_tx, + db_rx, + #[cfg(feature = "compat")] + compat: Default::default(), } + } - /// Adds an address for a peer. - pub fn add_address(&mut self, peer_id: &PeerId, addr: Multiaddr) { - self.inner.add_address(peer_id, addr); - } + /// Adds an address for a peer. + pub fn add_address(&mut self, peer_id: &PeerId, addr: Multiaddr) { + self.inner.add_address(peer_id, addr); + } - /// Removes an address for a peer. - pub fn remove_address(&mut self, peer_id: &PeerId, addr: &Multiaddr) { - self.inner.remove_address(peer_id, addr); - } + /// Removes an address for a peer. + pub fn remove_address(&mut self, peer_id: &PeerId, addr: &Multiaddr) { + self.inner.remove_address(peer_id, addr); + } - /// Starts a get query with an initial guess of providers. - pub fn get(&mut self, cid: Cid, peers: impl Iterator) -> QueryId { - self.query_manager.get(None, cid, peers) - } + /// Starts a get query with an initial guess of providers. + pub fn get( + &mut self, + cid: Cid, + peers: impl Iterator, + ) -> QueryId { + self.query_manager.get(None, cid, peers) + } - /// Starts a sync query with an the initial set of missing blocks. - pub fn sync( - &mut self, - cid: Cid, - peers: Vec, - missing: impl Iterator, - ) -> QueryId { - self.query_manager.sync(cid, peers, missing) - } + /// Starts a sync query with an the initial set of missing blocks. + pub fn sync( + &mut self, + cid: Cid, + peers: Vec, + missing: impl Iterator, + ) -> QueryId { + self.query_manager.sync(cid, peers, missing) + } - /// Cancels an in progress query. Returns true if a query was cancelled. - pub fn cancel(&mut self, id: QueryId) -> bool { - let res = self.query_manager.cancel(id); - if res { - REQUESTS_CANCELED.inc(); - } - res + /// Cancels an in progress query. Returns true if a query was cancelled. + pub fn cancel(&mut self, id: QueryId) -> bool { + let res = self.query_manager.cancel(id); + if res { + REQUESTS_CANCELED.inc(); } + res + } - /// Registers prometheus metrics. - pub fn register_metrics(&self, registry: &Registry) -> Result<()> { - registry.register(Box::new(REQUESTS_TOTAL.clone()))?; - registry.register(Box::new(REQUEST_DURATION_SECONDS.clone()))?; - registry.register(Box::new(REQUESTS_CANCELED.clone()))?; - registry.register(Box::new(BLOCK_NOT_FOUND.clone()))?; - registry.register(Box::new(PROVIDERS_TOTAL.clone()))?; - registry.register(Box::new(MISSING_BLOCKS_TOTAL.clone()))?; - registry.register(Box::new(RECEIVED_BLOCK_BYTES.clone()))?; - registry.register(Box::new(RECEIVED_INVALID_BLOCK_BYTES.clone()))?; - registry.register(Box::new(SENT_BLOCK_BYTES.clone()))?; - registry.register(Box::new(RESPONSES_TOTAL.clone()))?; - registry.register(Box::new(THROTTLED_INBOUND.clone()))?; - registry.register(Box::new(THROTTLED_OUTBOUND.clone()))?; - registry.register(Box::new(OUTBOUND_FAILURE.clone()))?; - registry.register(Box::new(INBOUND_FAILURE.clone()))?; - Ok(()) - } + /// Registers prometheus metrics. + pub fn register_metrics(&self, registry: &Registry) -> Result<()> { + registry.register(Box::new(REQUESTS_TOTAL.clone()))?; + registry.register(Box::new(REQUEST_DURATION_SECONDS.clone()))?; + registry.register(Box::new(REQUESTS_CANCELED.clone()))?; + registry.register(Box::new(BLOCK_NOT_FOUND.clone()))?; + registry.register(Box::new(PROVIDERS_TOTAL.clone()))?; + registry.register(Box::new(MISSING_BLOCKS_TOTAL.clone()))?; + registry.register(Box::new(RECEIVED_BLOCK_BYTES.clone()))?; + registry.register(Box::new(RECEIVED_INVALID_BLOCK_BYTES.clone()))?; + registry.register(Box::new(SENT_BLOCK_BYTES.clone()))?; + registry.register(Box::new(RESPONSES_TOTAL.clone()))?; + registry.register(Box::new(THROTTLED_INBOUND.clone()))?; + registry.register(Box::new(THROTTLED_OUTBOUND.clone()))?; + registry.register(Box::new(OUTBOUND_FAILURE.clone()))?; + registry.register(Box::new(INBOUND_FAILURE.clone()))?; + Ok(()) + } } enum DbRequest { - Bitswap(BitswapChannel, BitswapRequest), - Insert(Block

), - MissingBlocks(QueryId, Cid), + Bitswap(BitswapChannel, BitswapRequest), + Insert(Block

), + MissingBlocks(QueryId, Cid), } enum DbResponse { - Bitswap(BitswapChannel, BitswapResponse), - MissingBlocks(QueryId, Result>), + Bitswap(BitswapChannel, BitswapResponse), + MissingBlocks(QueryId, Result>), } fn start_db_thread( - mut store: S, + mut store: S, ) -> ( - mpsc::UnboundedSender>, - mpsc::UnboundedReceiver, + mpsc::UnboundedSender>, + mpsc::UnboundedReceiver, ) { - let (tx, requests) = mpsc::unbounded(); - let (responses, rx) = mpsc::unbounded(); - std::thread::spawn(move || { - let mut requests: mpsc::UnboundedReceiver> = requests; - while let Some(request) = futures::executor::block_on(requests.next()) { - match request { - DbRequest::Bitswap(channel, request) => { - let response = match request.ty { - RequestType::Have => { - let have = store.contains(&request.cid).ok().unwrap_or_default(); - if have { - RESPONSES_TOTAL.with_label_values(&["have"]).inc(); - } else { - RESPONSES_TOTAL.with_label_values(&["dont_have"]).inc(); - } - tracing::trace!("have {}", have); - BitswapResponse::Have(have) - } - RequestType::Block => { - let block = store.get(&request.cid).ok().unwrap_or_default(); - if let Some(data) = block { - RESPONSES_TOTAL.with_label_values(&["block"]).inc(); - SENT_BLOCK_BYTES.inc_by(data.len() as u64); - tracing::trace!("block {}", data.len()); - BitswapResponse::Block(data) - } else { - RESPONSES_TOTAL.with_label_values(&["dont_have"]).inc(); - tracing::trace!("have false"); - BitswapResponse::Have(false) - } - } - }; - responses - .unbounded_send(DbResponse::Bitswap(channel, response)) - .ok(); - } - DbRequest::Insert(block) => { - if let Err(err) = store.insert(&block) { - tracing::error!("error inserting blocks {}", err); - } - } - DbRequest::MissingBlocks(id, cid) => { - let res = store.missing_blocks(&cid); - responses - .unbounded_send(DbResponse::MissingBlocks(id, res)) - .ok(); - } + let (tx, requests) = mpsc::unbounded(); + let (responses, rx) = mpsc::unbounded(); + std::thread::spawn(move || { + let mut requests: mpsc::UnboundedReceiver> = requests; + while let Some(request) = futures::executor::block_on(requests.next()) { + match request { + DbRequest::Bitswap(channel, request) => { + let response = match request.ty { + RequestType::Have => { + let have = store.contains(&request.cid).ok().unwrap_or_default(); + if have { + RESPONSES_TOTAL.with_label_values(&["have"]).inc(); + } else { + RESPONSES_TOTAL.with_label_values(&["dont_have"]).inc(); + } + tracing::trace!("have {}", have); + BitswapResponse::Have(have) + } + RequestType::Block => { + let block = store.get(&request.cid).ok().unwrap_or_default(); + if let Some(data) = block { + RESPONSES_TOTAL.with_label_values(&["block"]).inc(); + SENT_BLOCK_BYTES.inc_by(data.len() as u64); + tracing::trace!("block {}", data.len()); + BitswapResponse::Block(data) + } else { + RESPONSES_TOTAL.with_label_values(&["dont_have"]).inc(); + tracing::trace!("have false"); + BitswapResponse::Have(false) + } } + }; + responses + .unbounded_send(DbResponse::Bitswap(channel, response)) + .ok(); + } + DbRequest::Insert(block) => { + if let Err(err) = store.insert(&block) { + tracing::error!("error inserting blocks {}", err); + } } - }); - (tx, rx) + DbRequest::MissingBlocks(id, cid) => { + let res = store.missing_blocks(&cid); + responses + .unbounded_send(DbResponse::MissingBlocks(id, res)) + .ok(); + } + } + } + }); + (tx, rx) } impl Bitswap

{ - /// Processes an incoming bitswap request. - fn inject_request(&mut self, channel: BitswapChannel, request: BitswapRequest) { - self.db_tx - .unbounded_send(DbRequest::Bitswap(channel, request)) - .ok(); - } + /// Processes an incoming bitswap request. + fn inject_request( + &mut self, + channel: BitswapChannel, + request: BitswapRequest, + ) { + self + .db_tx + .unbounded_send(DbRequest::Bitswap(channel, request)) + .ok(); + } - /// Processes an incoming bitswap response. - fn inject_response(&mut self, id: BitswapId, peer: PeerId, response: BitswapResponse) { - if let Some(id) = self.requests.remove(&id) { - match response { - BitswapResponse::Have(have) => { - self.query_manager - .inject_response(id, Response::Have(peer, have)); - } - BitswapResponse::Block(data) => { - if let Some(info) = self.query_manager.query_info(id) { - let len = data.len(); - if let Ok(block) = Block::new(info.cid, data) { - RECEIVED_BLOCK_BYTES.inc_by(len as u64); - self.db_tx.unbounded_send(DbRequest::Insert(block)).ok(); - self.query_manager - .inject_response(id, Response::Block(peer, true)); - } else { - tracing::error!("received invalid block"); - RECEIVED_INVALID_BLOCK_BYTES.inc_by(len as u64); - self.query_manager - .inject_response(id, Response::Block(peer, false)); - } - } - } + /// Processes an incoming bitswap response. + fn inject_response( + &mut self, + id: BitswapId, + peer: PeerId, + response: BitswapResponse, + ) { + if let Some(id) = self.requests.remove(&id) { + match response { + BitswapResponse::Have(have) => { + self + .query_manager + .inject_response(id, Response::Have(peer, have)); + } + BitswapResponse::Block(data) => { + if let Some(info) = self.query_manager.query_info(id) { + let len = data.len(); + if let Ok(block) = Block::new(info.cid, data) { + RECEIVED_BLOCK_BYTES.inc_by(len as u64); + self.db_tx.unbounded_send(DbRequest::Insert(block)).ok(); + self + .query_manager + .inject_response(id, Response::Block(peer, true)); + } else { + tracing::error!("received invalid block"); + RECEIVED_INVALID_BLOCK_BYTES.inc_by(len as u64); + self + .query_manager + .inject_response(id, Response::Block(peer, false)); } + } } + } } + } - fn inject_outbound_failure( - &mut self, - peer: &PeerId, - request_id: RequestId, - error: &OutboundFailure, - ) { - tracing::debug!( - "bitswap outbound failure {} {} {:?}", - peer, - request_id, - error - ); - match error { - OutboundFailure::DialFailure => { - OUTBOUND_FAILURE.with_label_values(&["dial_failure"]).inc(); - } - OutboundFailure::Timeout => { - OUTBOUND_FAILURE.with_label_values(&["timeout"]).inc(); - } - OutboundFailure::ConnectionClosed => { - OUTBOUND_FAILURE - .with_label_values(&["connection_closed"]) - .inc(); - } - OutboundFailure::UnsupportedProtocols => { - OUTBOUND_FAILURE - .with_label_values(&["unsupported_protocols"]) - .inc(); - } - } + fn inject_outbound_failure( + &mut self, + peer: &PeerId, + request_id: RequestId, + error: &OutboundFailure, + ) { + tracing::debug!( + "bitswap outbound failure {} {} {:?}", + peer, + request_id, + error + ); + match error { + OutboundFailure::DialFailure => { + OUTBOUND_FAILURE.with_label_values(&["dial_failure"]).inc(); + } + OutboundFailure::Timeout => { + OUTBOUND_FAILURE.with_label_values(&["timeout"]).inc(); + } + OutboundFailure::ConnectionClosed => { + OUTBOUND_FAILURE + .with_label_values(&["connection_closed"]) + .inc(); + } + OutboundFailure::UnsupportedProtocols => { + OUTBOUND_FAILURE + .with_label_values(&["unsupported_protocols"]) + .inc(); + } } + } - fn inject_inbound_failure( - &mut self, - peer: &PeerId, - request_id: RequestId, - error: &InboundFailure, - ) { - tracing::error!( - "bitswap inbound failure {} {} {:?}", - peer, - request_id, - error - ); - match error { - InboundFailure::Timeout => { - INBOUND_FAILURE.with_label_values(&["timeout"]).inc(); - } - InboundFailure::ConnectionClosed => { - INBOUND_FAILURE - .with_label_values(&["connection_closed"]) - .inc(); - } - InboundFailure::UnsupportedProtocols => { - INBOUND_FAILURE - .with_label_values(&["unsupported_protocols"]) - .inc(); - } - InboundFailure::ResponseOmission => { - INBOUND_FAILURE - .with_label_values(&["response_omission"]) - .inc(); - } - } + fn inject_inbound_failure( + &mut self, + peer: &PeerId, + request_id: RequestId, + error: &InboundFailure, + ) { + tracing::error!( + "bitswap inbound failure {} {} {:?}", + peer, + request_id, + error + ); + match error { + InboundFailure::Timeout => { + INBOUND_FAILURE.with_label_values(&["timeout"]).inc(); + } + InboundFailure::ConnectionClosed => { + INBOUND_FAILURE + .with_label_values(&["connection_closed"]) + .inc(); + } + InboundFailure::UnsupportedProtocols => { + INBOUND_FAILURE + .with_label_values(&["unsupported_protocols"]) + .inc(); + } + InboundFailure::ResponseOmission => { + INBOUND_FAILURE + .with_label_values(&["response_omission"]) + .inc(); + } } + } } impl NetworkBehaviour for Bitswap

{ + #[cfg(not(feature = "compat"))] + type ConnectionHandler = + > as NetworkBehaviour>::ConnectionHandler; + #[cfg(feature = "compat")] + #[allow(clippy::type_complexity)] + type ConnectionHandler = ConnectionHandlerSelect< + > as NetworkBehaviour>::ConnectionHandler, + OneShotHandler, + >; + type OutEvent = BitswapEvent; + + fn handle_established_inbound_connection( + &mut self, + connection_id: ConnectionId, + peer: PeerId, + local_addr: &Multiaddr, + remote_addr: &Multiaddr, + ) -> std::result::Result< + libp2p::swarm::THandler, + libp2p::swarm::ConnectionDenied, + > { + let handler = self.inner.handle_established_inbound_connection( + connection_id, + peer, + local_addr, + remote_addr, + )?; #[cfg(not(feature = "compat"))] - type ConnectionHandler = - > as NetworkBehaviour>::ConnectionHandler; + return Ok(handler); + #[cfg(feature = "compat")] + Ok(ConnectionHandler::select( + handler, + OneShotHandler::default(), + )) + } + fn handle_established_outbound_connection( + &mut self, + connection_id: ConnectionId, + peer: PeerId, + addr: &Multiaddr, + role_override: libp2p::core::Endpoint, + ) -> std::result::Result< + libp2p::swarm::THandler, + libp2p::swarm::ConnectionDenied, + > { + let handler = self.inner.handle_established_outbound_connection( + connection_id, + peer, + addr, + role_override, + )?; + #[cfg(not(feature = "compat"))] + return Ok(handler); #[cfg(feature = "compat")] - #[allow(clippy::type_complexity)] - type ConnectionHandler = ConnectionHandlerSelect< - > as NetworkBehaviour>::ConnectionHandler, - OneShotHandler, - >; - type OutEvent = BitswapEvent; - - fn new_handler(&mut self) -> Self::ConnectionHandler { - #[cfg(not(feature = "compat"))] - return self.inner.new_handler(); + Ok(ConnectionHandler::select( + handler, + OneShotHandler::default(), + )) + } + + fn handle_pending_inbound_connection( + &mut self, + connection_id: ConnectionId, + local_addr: &Multiaddr, + remote_addr: &Multiaddr, + ) -> std::result::Result<(), libp2p::swarm::ConnectionDenied> { + self.inner.handle_pending_inbound_connection( + connection_id, + local_addr, + remote_addr, + ) + } + + fn handle_pending_outbound_connection( + &mut self, + connection_id: ConnectionId, + maybe_peer: Option, + addresses: &[Multiaddr], + effective_role: libp2p::core::Endpoint, + ) -> std::result::Result, libp2p::swarm::ConnectionDenied> { + self.inner.handle_pending_outbound_connection( + connection_id, + maybe_peer, + addresses, + effective_role, + ) + } + + fn on_swarm_event(&mut self, event: FromSwarm) { + match event { + FromSwarm::ConnectionEstablished(ev) => self + .inner + .on_swarm_event(FromSwarm::ConnectionEstablished(ev)), + FromSwarm::ConnectionClosed(ConnectionClosed { + peer_id, + connection_id, + endpoint, + handler, + remaining_established, + }) => { #[cfg(feature = "compat")] - ConnectionHandler::select(self.inner.new_handler(), OneShotHandler::default()) + if remaining_established == 0 { + self.compat.remove(&peer_id); + } + #[cfg(feature = "compat")] + let (handler, _oneshot) = handler.into_inner(); + self.inner.on_swarm_event(FromSwarm::ConnectionClosed( + ConnectionClosed { + peer_id, + connection_id, + endpoint, + handler, + remaining_established, + }, + )); + } + FromSwarm::DialFailure(DialFailure { + peer_id, + error, + connection_id, + }) => { + self + .inner + .on_swarm_event(FromSwarm::DialFailure(DialFailure { + peer_id, + error, + connection_id, + })); + } + FromSwarm::AddressChange(ev) => { + self.inner.on_swarm_event(FromSwarm::AddressChange(ev)) + } + FromSwarm::ListenFailure(ListenFailure { + local_addr, + send_back_addr, + error, + connection_id, + }) => { + self + .inner + .on_swarm_event(FromSwarm::ListenFailure(ListenFailure { + local_addr, + send_back_addr, + error, + connection_id, + })); + } + FromSwarm::NewListener(ev) => { + self.inner.on_swarm_event(FromSwarm::NewListener(ev)) + } + FromSwarm::NewListenAddr(ev) => { + self.inner.on_swarm_event(FromSwarm::NewListenAddr(ev)) + } + FromSwarm::ExpiredListenAddr(ev) => { + self.inner.on_swarm_event(FromSwarm::ExpiredListenAddr(ev)) + } + FromSwarm::ListenerError(ev) => { + self.inner.on_swarm_event(FromSwarm::ListenerError(ev)) + } + FromSwarm::ListenerClosed(ev) => { + self.inner.on_swarm_event(FromSwarm::ListenerClosed(ev)) + } + FromSwarm::NewExternalAddr(ev) => { + self.inner.on_swarm_event(FromSwarm::NewExternalAddr(ev)) + } + FromSwarm::ExpiredExternalAddr(ev) => self + .inner + .on_swarm_event(FromSwarm::ExpiredExternalAddr(ev)), } + } - fn addresses_of_peer(&mut self, peer_id: &PeerId) -> Vec { - self.inner.addresses_of_peer(peer_id) + fn on_connection_handler_event( + &mut self, + peer_id: PeerId, + conn: ConnectionId, + event: ::OutEvent, + ) { + tracing::trace!(?event, "on_connection_handler_event"); + #[cfg(not(feature = "compat"))] + return self.inner.on_connection_handler_event(peer_id, conn, event); + #[cfg(feature = "compat")] + match event { + Either::Left(event) => { + self.inner.on_connection_handler_event(peer_id, conn, event) + } + Either::Right(msg) => { + for msg in msg.0 { + match msg { + CompatMessage::Request(req) => { + tracing::trace!("received compat request"); + self + .inject_request(BitswapChannel::Compat(peer_id, req.cid), req); + } + CompatMessage::Response(cid, res) => { + tracing::trace!("received compat response"); + self.inject_response(BitswapId::Compat(cid), peer_id, res); + } + } + } + } } + } - fn on_swarm_event(&mut self, event: FromSwarm) { - match event { - FromSwarm::ConnectionEstablished(ev) => self - .inner - .on_swarm_event(FromSwarm::ConnectionEstablished(ev)), - FromSwarm::ConnectionClosed(ConnectionClosed { - peer_id, - connection_id, - endpoint, - handler, - remaining_established, - }) => { - #[cfg(feature = "compat")] - if remaining_established == 0 { - self.compat.remove(&peer_id); - } - #[cfg(feature = "compat")] - let (handler, _oneshot) = handler.into_inner(); - self.inner - .on_swarm_event(FromSwarm::ConnectionClosed(ConnectionClosed { - peer_id, - connection_id, - endpoint, - handler, - remaining_established, - })); + fn poll( + &mut self, + cx: &mut Context, + pp: &mut impl PollParameters, + ) -> Poll>> { + let mut exit = false; + while !exit { + exit = true; + while let Poll::Ready(Some(response)) = + Pin::new(&mut self.db_rx).poll_next(cx) + { + exit = false; + match response { + DbResponse::Bitswap(channel, response) => match channel { + BitswapChannel::Bitswap(channel) => { + self.inner.send_response(channel, response).ok(); } - FromSwarm::DialFailure(DialFailure { + #[cfg(feature = "compat")] + BitswapChannel::Compat(peer_id, cid) => { + let compat = CompatMessage::Response(cid, response); + return Poll::Ready(ToSwarm::NotifyHandler { peer_id, - handler, - error, - }) => { - #[cfg(feature = "compat")] - let (handler, _oneshot) = handler.into_inner(); - self.inner - .on_swarm_event(FromSwarm::DialFailure(DialFailure { - peer_id, - handler, - error, - })); + handler: NotifyHandler::Any, + event: Either::Right(compat), + }); } - FromSwarm::AddressChange(ev) => self.inner.on_swarm_event(FromSwarm::AddressChange(ev)), - FromSwarm::ListenFailure(ListenFailure { - local_addr, - send_back_addr, - handler, - }) => { - #[cfg(feature = "compat")] - let (handler, _oneshot) = handler.into_inner(); - self.inner - .on_swarm_event(FromSwarm::ListenFailure(ListenFailure { - local_addr, - send_back_addr, - handler, - })); + }, + DbResponse::MissingBlocks(id, res) => match res { + Ok(missing) => { + MISSING_BLOCKS_TOTAL.inc_by(missing.len() as u64); + self + .query_manager + .inject_response(id, Response::MissingBlocks(missing)); } - FromSwarm::NewListener(ev) => self.inner.on_swarm_event(FromSwarm::NewListener(ev)), - FromSwarm::NewListenAddr(ev) => self.inner.on_swarm_event(FromSwarm::NewListenAddr(ev)), - FromSwarm::ExpiredListenAddr(ev) => { - self.inner.on_swarm_event(FromSwarm::ExpiredListenAddr(ev)) + Err(err) => { + self.query_manager.cancel(id); + let event = BitswapEvent::Complete(id, Err(err)); + return Poll::Ready(ToSwarm::GenerateEvent(event)); } - FromSwarm::ListenerError(ev) => self.inner.on_swarm_event(FromSwarm::ListenerError(ev)), - FromSwarm::ListenerClosed(ev) => { - self.inner.on_swarm_event(FromSwarm::ListenerClosed(ev)) + }, + } + } + while let Some(query) = self.query_manager.next() { + exit = false; + match query { + QueryEvent::Request(id, req) => match req { + Request::Have(peer_id, cid) => { + let req = BitswapRequest { + ty: RequestType::Have, + cid, + }; + let rid = self.inner.send_request(&peer_id, req); + self.requests.insert(BitswapId::Bitswap(rid), id); } - FromSwarm::NewExternalAddr(ev) => { - self.inner.on_swarm_event(FromSwarm::NewExternalAddr(ev)) + Request::Block(peer_id, cid) => { + let req = BitswapRequest { + ty: RequestType::Block, + cid, + }; + let rid = self.inner.send_request(&peer_id, req); + self.requests.insert(BitswapId::Bitswap(rid), id); } - FromSwarm::ExpiredExternalAddr(ev) => self - .inner - .on_swarm_event(FromSwarm::ExpiredExternalAddr(ev)), - } - } - - fn on_connection_handler_event( - &mut self, - peer_id: PeerId, - conn: ConnectionId, - event: ::OutEvent, - ) { - tracing::trace!(?event, "on_connection_handler_event"); - #[cfg(not(feature = "compat"))] - return self.inner.on_connection_handler_event(peer_id, conn, event); - #[cfg(feature = "compat")] - match event { - EitherOutput::First(event) => { - self.inner.on_connection_handler_event(peer_id, conn, event) + Request::MissingBlocks(cid) => { + self + .db_tx + .unbounded_send(DbRequest::MissingBlocks(id, cid)) + .ok(); } - EitherOutput::Second(msg) => { - for msg in msg.0 { - match msg { - CompatMessage::Request(req) => { - tracing::trace!("received compat request"); - self.inject_request(BitswapChannel::Compat(peer_id, req.cid), req); - } - CompatMessage::Response(cid, res) => { - tracing::trace!("received compat response"); - self.inject_response(BitswapId::Compat(cid), peer_id, res); - } - } - } + }, + QueryEvent::Progress(id, missing) => { + let event = BitswapEvent::Progress(id, missing); + return Poll::Ready(ToSwarm::GenerateEvent(event)); + } + QueryEvent::Complete(id, res) => { + if res.is_err() { + BLOCK_NOT_FOUND.inc(); } + let event = BitswapEvent::Complete( + id, + res.map_err(|cid| BlockNotFound(cid).into()), + ); + return Poll::Ready(ToSwarm::GenerateEvent(event)); + } } - } - - fn poll( - &mut self, - cx: &mut Context, - pp: &mut impl PollParameters, - ) -> Poll> { - let mut exit = false; - while !exit { - exit = true; - while let Poll::Ready(Some(response)) = Pin::new(&mut self.db_rx).poll_next(cx) { - exit = false; - match response { - DbResponse::Bitswap(channel, response) => match channel { - BitswapChannel::Bitswap(channel) => { - self.inner.send_response(channel, response).ok(); - } - #[cfg(feature = "compat")] - BitswapChannel::Compat(peer_id, cid) => { - let compat = CompatMessage::Response(cid, response); - return Poll::Ready(NetworkBehaviourAction::NotifyHandler { - peer_id, - handler: NotifyHandler::Any, - event: EitherOutput::Second(compat), - }); - } - }, - DbResponse::MissingBlocks(id, res) => match res { - Ok(missing) => { - MISSING_BLOCKS_TOTAL.inc_by(missing.len() as u64); - self.query_manager - .inject_response(id, Response::MissingBlocks(missing)); - } - Err(err) => { - self.query_manager.cancel(id); - let event = BitswapEvent::Complete(id, Err(err)); - return Poll::Ready(NetworkBehaviourAction::GenerateEvent(event)); - } - }, - } - } - while let Some(query) = self.query_manager.next() { - exit = false; - match query { - QueryEvent::Request(id, req) => match req { - Request::Have(peer_id, cid) => { - let req = BitswapRequest { - ty: RequestType::Have, - cid, - }; - let rid = self.inner.send_request(&peer_id, req); - self.requests.insert(BitswapId::Bitswap(rid), id); - } - Request::Block(peer_id, cid) => { - let req = BitswapRequest { - ty: RequestType::Block, - cid, - }; - let rid = self.inner.send_request(&peer_id, req); - self.requests.insert(BitswapId::Bitswap(rid), id); - } - Request::MissingBlocks(cid) => { - self.db_tx - .unbounded_send(DbRequest::MissingBlocks(id, cid)) - .ok(); - } - }, - QueryEvent::Progress(id, missing) => { - let event = BitswapEvent::Progress(id, missing); - return Poll::Ready(NetworkBehaviourAction::GenerateEvent(event)); - } - QueryEvent::Complete(id, res) => { - if res.is_err() { - BLOCK_NOT_FOUND.inc(); - } - let event = BitswapEvent::Complete( - id, - res.map_err(|cid| BlockNotFound(cid).into()), - ); - return Poll::Ready(NetworkBehaviourAction::GenerateEvent(event)); - } + } + while let Poll::Ready(event) = self.inner.poll(cx, pp) { + exit = false; + let event = match event { + ToSwarm::GenerateEvent(event) => event, + ToSwarm::Dial { opts } => { + return Poll::Ready(ToSwarm::Dial { opts }); + } + ToSwarm::NotifyHandler { + peer_id, + handler, + event, + } => { + return Poll::Ready(ToSwarm::NotifyHandler { + peer_id, + handler, + #[cfg(not(feature = "compat"))] + event, + #[cfg(feature = "compat")] + event: Either::Left(event), + }); + } + ToSwarm::ReportObservedAddr { address, score } => { + return Poll::Ready(ToSwarm::ReportObservedAddr { address, score }); + } + ToSwarm::CloseConnection { + peer_id, + connection, + } => { + return Poll::Ready(ToSwarm::CloseConnection { + peer_id, + connection, + }); + } + }; + match event { + RequestResponseEvent::Message { peer, message } => match message { + RequestResponseMessage::Request { + request_id: _, + request, + channel, + } => self.inject_request(BitswapChannel::Bitswap(channel), request), + RequestResponseMessage::Response { + request_id, + response, + } => self.inject_response( + BitswapId::Bitswap(request_id), + peer, + response, + ), + }, + RequestResponseEvent::ResponseSent { .. } => {} + RequestResponseEvent::OutboundFailure { + peer, + request_id, + error, + } => { + self.inject_outbound_failure(&peer, request_id, &error); + #[cfg(feature = "compat")] + if let OutboundFailure::UnsupportedProtocols = error { + if let Some(id) = + self.requests.remove(&BitswapId::Bitswap(request_id)) + { + if let Some(info) = self.query_manager.query_info(id) { + let ty = match info.label { + "have" => RequestType::Have, + "block" => RequestType::Block, + _ => unreachable!(), + }; + let request = BitswapRequest { ty, cid: info.cid }; + self.requests.insert(BitswapId::Compat(info.cid), id); + tracing::trace!("adding compat peer {}", peer); + self.compat.insert(peer); + return Poll::Ready(ToSwarm::NotifyHandler { + peer_id: peer, + handler: NotifyHandler::Any, + event: Either::Right(CompatMessage::Request(request)), + }); } + } } - while let Poll::Ready(event) = self.inner.poll(cx, pp) { - exit = false; - let event = match event { - NetworkBehaviourAction::GenerateEvent(event) => event, - NetworkBehaviourAction::Dial { opts, handler } => { - #[cfg(feature = "compat")] - let handler = ConnectionHandler::select(handler, Default::default()); - return Poll::Ready(NetworkBehaviourAction::Dial { opts, handler }); - } - NetworkBehaviourAction::NotifyHandler { - peer_id, - handler, - event, - } => { - return Poll::Ready(NetworkBehaviourAction::NotifyHandler { - peer_id, - handler, - #[cfg(not(feature = "compat"))] - event, - #[cfg(feature = "compat")] - event: EitherOutput::First(event), - }); - } - NetworkBehaviourAction::ReportObservedAddr { address, score } => { - return Poll::Ready(NetworkBehaviourAction::ReportObservedAddr { - address, - score, - }); - } - NetworkBehaviourAction::CloseConnection { - peer_id, - connection, - } => { - return Poll::Ready(NetworkBehaviourAction::CloseConnection { - peer_id, - connection, - }); - } - }; - match event { - RequestResponseEvent::Message { peer, message } => match message { - RequestResponseMessage::Request { - request_id: _, - request, - channel, - } => self.inject_request(BitswapChannel::Bitswap(channel), request), - RequestResponseMessage::Response { - request_id, - response, - } => self.inject_response(BitswapId::Bitswap(request_id), peer, response), - }, - RequestResponseEvent::ResponseSent { .. } => {} - RequestResponseEvent::OutboundFailure { - peer, - request_id, - error, - } => { - self.inject_outbound_failure(&peer, request_id, &error); - #[cfg(feature = "compat")] - if let OutboundFailure::UnsupportedProtocols = error { - if let Some(id) = self.requests.remove(&BitswapId::Bitswap(request_id)) - { - if let Some(info) = self.query_manager.query_info(id) { - let ty = match info.label { - "have" => RequestType::Have, - "block" => RequestType::Block, - _ => unreachable!(), - }; - let request = BitswapRequest { ty, cid: info.cid }; - self.requests.insert(BitswapId::Compat(info.cid), id); - tracing::trace!("adding compat peer {}", peer); - self.compat.insert(peer); - return Poll::Ready(NetworkBehaviourAction::NotifyHandler { - peer_id: peer, - handler: NotifyHandler::Any, - event: EitherOutput::Second(CompatMessage::Request( - request, - )), - }); - } - } - } - if let Some(id) = self.requests.remove(&BitswapId::Bitswap(request_id)) { - self.query_manager - .inject_response(id, Response::Have(peer, false)); - } - } - RequestResponseEvent::InboundFailure { - peer, - request_id, - error, - } => { - self.inject_inbound_failure(&peer, request_id, &error); - } - } + if let Some(id) = + self.requests.remove(&BitswapId::Bitswap(request_id)) + { + self + .query_manager + .inject_response(id, Response::Have(peer, false)); } + } + RequestResponseEvent::InboundFailure { + peer, + request_id, + error, + } => { + self.inject_inbound_failure(&peer, request_id, &error); + } } - Poll::Pending + } } + Poll::Pending + } } #[cfg(test)] mod tests { - use super::*; - use async_std::task; - use futures::prelude::*; - use libipld::block::Block; - use libipld::cbor::DagCborCodec; - use libipld::ipld; - use libipld::ipld::Ipld; - use libipld::multihash::Code; - use libipld::store::DefaultParams; - use libp2p::core::muxing::StreamMuxerBox; - use libp2p::core::transport::Boxed; - use libp2p::identity; - use libp2p::noise::{Keypair, NoiseConfig, X25519Spec}; - use libp2p::swarm::SwarmEvent; - use libp2p::tcp::{self, async_io}; - use libp2p::yamux::YamuxConfig; - use libp2p::{PeerId, Swarm, Transport}; - use std::sync::{Arc, Mutex}; - use std::time::Duration; - use tracing_subscriber::fmt::TestWriter; - - fn tracing_try_init() { - tracing_subscriber::fmt() - .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) - .with_writer(TestWriter::new()) - .try_init() - .ok(); - } + use { + super::*, + async_std::task, + futures::prelude::*, + libipld::{ + block::Block, + cbor::DagCborCodec, + ipld::Ipld, + multihash::Code, + store::DefaultParams, + }, + libp2p::{ + core::{muxing::StreamMuxerBox, transport::Boxed}, + identity, + noise::{Keypair, NoiseConfig, X25519Spec}, + swarm::{SwarmBuilder, SwarmEvent}, + tcp::{self, async_io}, + yamux::YamuxConfig, + PeerId, + Swarm, + Transport, + }, + std::{ + sync::{Arc, Mutex}, + time::Duration, + }, + tracing_subscriber::fmt::TestWriter, + }; + + fn tracing_try_init() { + tracing_subscriber::fmt() + .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) + .with_writer(TestWriter::new()) + .try_init() + .ok(); + } + + fn mk_transport() -> (PeerId, Boxed<(PeerId, StreamMuxerBox)>) { + let id_key = identity::Keypair::generate_ed25519(); + let peer_id = id_key.public().to_peer_id(); + let dh_key = Keypair::::new() + .into_authentic(&id_key) + .unwrap(); + let noise = NoiseConfig::xx(dh_key).into_authenticated(); + + let transport = async_io::Transport::new(tcp::Config::new().nodelay(true)) + .upgrade(libp2p::core::upgrade::Version::V1) + .authenticate(noise) + .multiplex(YamuxConfig::default()) + .timeout(Duration::from_secs(20)) + .boxed(); + (peer_id, transport) + } + + fn create_block(ipld: Ipld) -> Block { + Block::encode(DagCborCodec, Code::Blake3_256, &ipld).unwrap() + } - fn mk_transport() -> (PeerId, Boxed<(PeerId, StreamMuxerBox)>) { - let id_key = identity::Keypair::generate_ed25519(); - let peer_id = id_key.public().to_peer_id(); - let dh_key = Keypair::::new() - .into_authentic(&id_key) - .unwrap(); - let noise = NoiseConfig::xx(dh_key).into_authenticated(); - - let transport = async_io::Transport::new(tcp::Config::new().nodelay(true)) - .upgrade(libp2p::core::upgrade::Version::V1) - .authenticate(noise) - .multiplex(YamuxConfig::default()) - .timeout(Duration::from_secs(20)) - .boxed(); - (peer_id, transport) + #[derive(Clone, Default)] + struct Store(Arc>>>); + + impl BitswapStore for Store { + type Params = DefaultParams; + + fn contains(&mut self, cid: &Cid) -> Result { + Ok(self.0.lock().unwrap().contains_key(cid)) } - fn create_block(ipld: Ipld) -> Block { - Block::encode(DagCborCodec, Code::Blake3_256, &ipld).unwrap() + fn get(&mut self, cid: &Cid) -> Result>> { + Ok(self.0.lock().unwrap().get(cid).cloned()) } - #[derive(Clone, Default)] - struct Store(Arc>>>); + fn insert(&mut self, block: &Block) -> Result<()> { + self + .0 + .lock() + .unwrap() + .insert(*block.cid(), block.data().to_vec()); + Ok(()) + } - impl BitswapStore for Store { - type Params = DefaultParams; - fn contains(&mut self, cid: &Cid) -> Result { - Ok(self.0.lock().unwrap().contains_key(cid)) - } - fn get(&mut self, cid: &Cid) -> Result>> { - Ok(self.0.lock().unwrap().get(cid).cloned()) - } - fn insert(&mut self, block: &Block) -> Result<()> { - self.0 - .lock() - .unwrap() - .insert(*block.cid(), block.data().to_vec()); - Ok(()) - } - fn missing_blocks(&mut self, cid: &Cid) -> Result> { - let mut stack = vec![*cid]; - let mut missing = vec![]; - while let Some(cid) = stack.pop() { - if let Some(data) = self.get(&cid)? { - let block = Block::::new_unchecked(cid, data); - block.references(&mut stack)?; - } else { - missing.push(cid); - } - } - Ok(missing) + fn missing_blocks(&mut self, cid: &Cid) -> Result> { + let mut stack = vec![*cid]; + let mut missing = vec![]; + while let Some(cid) = stack.pop() { + if let Some(data) = self.get(&cid)? { + let block = Block::::new_unchecked(cid, data); + block.references(&mut stack)?; + } else { + missing.push(cid); } + } + Ok(missing) } + } - struct Peer { - peer_id: PeerId, - addr: Multiaddr, - store: Store, - swarm: Swarm>, - } + struct Peer { + peer_id: PeerId, + addr: Multiaddr, + store: Store, + swarm: Swarm>, + } - impl Peer { - fn new() -> Self { - let (peer_id, trans) = mk_transport(); - let store = Store::default(); - let mut swarm = Swarm::with_async_std_executor( - trans, - Bitswap::new(BitswapConfig::new(), store.clone()), - peer_id, - ); - Swarm::listen_on(&mut swarm, "/ip4/127.0.0.1/tcp/0".parse().unwrap()).unwrap(); - while swarm.next().now_or_never().is_some() {} - let addr = Swarm::listeners(&swarm).next().unwrap().clone(); - Self { - peer_id, - addr, - store, - swarm, - } - } + impl Peer { + fn new() -> Self { + let (peer_id, trans) = mk_transport(); + let store = Store::default(); + let mut swarm = SwarmBuilder::with_async_std_executor( + trans, + Bitswap::new(BitswapConfig::new(), store.clone()), + peer_id, + ) + .build(); + Swarm::listen_on(&mut swarm, "/ip4/127.0.0.1/tcp/0".parse().unwrap()) + .unwrap(); + while swarm.next().now_or_never().is_some() {} + let addr = Swarm::listeners(&swarm).next().unwrap().clone(); + Self { + peer_id, + addr, + store, + swarm, + } + } - fn add_address(&mut self, peer: &Peer) { - self.swarm - .behaviour_mut() - .add_address(&peer.peer_id, peer.addr.clone()); - } + fn add_address(&mut self, peer: &Peer) { + self + .swarm + .behaviour_mut() + .add_address(&peer.peer_id, peer.addr.clone()); + } - fn store(&mut self) -> impl std::ops::DerefMut>> + '_ { - self.store.0.lock().unwrap() - } + fn store( + &mut self, + ) -> impl std::ops::DerefMut>> + '_ { + self.store.0.lock().unwrap() + } - fn swarm(&mut self) -> &mut Swarm> { - &mut self.swarm - } + fn swarm(&mut self) -> &mut Swarm> { + &mut self.swarm + } - fn spawn(mut self, name: &'static str) -> PeerId { - let peer_id = self.peer_id; - task::spawn(async move { - loop { - let event = self.swarm.next().await; - tracing::debug!("{}: {:?}", name, event); - } - }); - peer_id + fn spawn(mut self, name: &'static str) -> PeerId { + let peer_id = self.peer_id; + task::spawn(async move { + loop { + let event = self.swarm.next().await; + tracing::debug!("{}: {:?}", name, event); } + }); + peer_id + } - async fn next(&mut self) -> Option { - loop { - let ev = self.swarm.next().await?; - if let SwarmEvent::Behaviour(event) = ev { - return Some(event); - } - } + async fn next(&mut self) -> Option { + loop { + let ev = self.swarm.next().await?; + if let SwarmEvent::Behaviour(event) = ev { + return Some(event); } + } } + } - fn assert_progress(event: Option, id: QueryId, missing: usize) { - if let Some(BitswapEvent::Progress(id2, missing2)) = event { - assert_eq!(id2, id); - assert_eq!(missing2, missing); - } else { - panic!("{:?} is not a progress event", event); - } + fn assert_progress(event: Option, id: QueryId, missing: usize) { + if let Some(BitswapEvent::Progress(id2, missing2)) = event { + assert_eq!(id2, id); + assert_eq!(missing2, missing); + } else { + panic!("{:?} is not a progress event", event); } + } - fn assert_complete_ok(event: Option, id: QueryId) { - if let Some(BitswapEvent::Complete(id2, Ok(()))) = event { - assert_eq!(id2, id); - } else { - panic!("{:?} is not a complete event", event); - } + fn assert_complete_ok(event: Option, id: QueryId) { + if let Some(BitswapEvent::Complete(id2, Ok(()))) = event { + assert_eq!(id2, id); + } else { + panic!("{:?} is not a complete event", event); } + } - #[async_std::test] - async fn test_bitswap_get() { - tracing_try_init(); - let mut peer1 = Peer::new(); - let mut peer2 = Peer::new(); - peer2.add_address(&peer1); + #[async_std::test] + async fn test_bitswap_get() { + tracing_try_init(); + let mut peer1 = Peer::new(); + let mut peer2 = Peer::new(); + peer2.add_address(&peer1); - let block = create_block(ipld!(&b"hello world"[..])); - peer1.store().insert(*block.cid(), block.data().to_vec()); - let peer1 = peer1.spawn("peer1"); + let block = create_block(libipld::ipld!(&b"hello world"[..])); + peer1.store().insert(*block.cid(), block.data().to_vec()); + let peer1 = peer1.spawn("peer1"); - let id = peer2 - .swarm() - .behaviour_mut() - .get(*block.cid(), std::iter::once(peer1)); + let id = peer2 + .swarm() + .behaviour_mut() + .get(*block.cid(), std::iter::once(peer1)); - assert_complete_ok(peer2.next().await, id); - } + assert_complete_ok(peer2.next().await, id); + } - #[async_std::test] - async fn test_bitswap_cancel_get() { - tracing_try_init(); - let mut peer1 = Peer::new(); - let mut peer2 = Peer::new(); - peer2.add_address(&peer1); - - let block = create_block(ipld!(&b"hello world"[..])); - peer1.store().insert(*block.cid(), block.data().to_vec()); - let peer1 = peer1.spawn("peer1"); - - let id = peer2 - .swarm() - .behaviour_mut() - .get(*block.cid(), std::iter::once(peer1)); - peer2.swarm().behaviour_mut().cancel(id); - let res = peer2.next().now_or_never(); - println!("{:?}", res); - assert!(res.is_none()); - } + #[async_std::test] + async fn test_bitswap_cancel_get() { + tracing_try_init(); + let mut peer1 = Peer::new(); + let mut peer2 = Peer::new(); + peer2.add_address(&peer1); - #[async_std::test] - async fn test_bitswap_sync() { - tracing_try_init(); - let mut peer1 = Peer::new(); - let mut peer2 = Peer::new(); - peer2.add_address(&peer1); - - let b0 = create_block(ipld!({ - "n": 0, - })); - let b1 = create_block(ipld!({ - "prev": b0.cid(), - "n": 1, - })); - let b2 = create_block(ipld!({ - "prev": b1.cid(), - "n": 2, - })); - peer1.store().insert(*b0.cid(), b0.data().to_vec()); - peer1.store().insert(*b1.cid(), b1.data().to_vec()); - peer1.store().insert(*b2.cid(), b2.data().to_vec()); - let peer1 = peer1.spawn("peer1"); - - let id = - peer2 - .swarm() - .behaviour_mut() - .sync(*b2.cid(), vec![peer1], std::iter::once(*b2.cid())); - - assert_progress(peer2.next().await, id, 1); - assert_progress(peer2.next().await, id, 1); - - assert_complete_ok(peer2.next().await, id); - } + let block = create_block(libipld::ipld!(&b"hello world"[..])); + peer1.store().insert(*block.cid(), block.data().to_vec()); + let peer1 = peer1.spawn("peer1"); - #[async_std::test] - async fn test_bitswap_cancel_sync() { - tracing_try_init(); - let mut peer1 = Peer::new(); - let mut peer2 = Peer::new(); - peer2.add_address(&peer1); - - let block = create_block(ipld!(&b"hello world"[..])); - peer1.store().insert(*block.cid(), block.data().to_vec()); - let peer1 = peer1.spawn("peer1"); - - let id = peer2.swarm().behaviour_mut().sync( - *block.cid(), - vec![peer1], - std::iter::once(*block.cid()), - ); - peer2.swarm().behaviour_mut().cancel(id); - let res = peer2.next().now_or_never(); - println!("{:?}", res); - assert!(res.is_none()); - } + let id = peer2 + .swarm() + .behaviour_mut() + .get(*block.cid(), std::iter::once(peer1)); + peer2.swarm().behaviour_mut().cancel(id); + let res = peer2.next().now_or_never(); + println!("{:?}", res); + assert!(res.is_none()); + } - #[cfg(feature = "compat")] - #[async_std::test] - async fn compat_test() { - tracing_try_init(); - let cid: Cid = "QmP8njGuyiw9cjkhwHD9nZhyBTHufXFanAvZgcy9xYoWiB" - .parse() - .unwrap(); - let peer_id: PeerId = "12D3KooWC1EaEEpghwnPdd89LaPTKEweD1PRLz4aRBkJEA9UiUuS" - .parse() - .unwrap(); - let multiaddr: Multiaddr = "/ip4/95.217.194.97/tcp/8008".parse().unwrap(); - - let mut peer = Peer::new(); - peer.swarm() - .behaviour_mut() - .add_address(&peer_id, multiaddr); - let id = peer - .swarm() - .behaviour_mut() - .get(cid, std::iter::once(peer_id)); - assert_complete_ok(peer.next().await, id); - } + #[async_std::test] + async fn test_bitswap_sync() { + tracing_try_init(); + let mut peer1 = Peer::new(); + let mut peer2 = Peer::new(); + peer2.add_address(&peer1); + + let b0 = create_block(libipld::ipld!({ + "n": 0, + })); + let b1 = create_block(libipld::ipld!({ + "prev": b0.cid(), + "n": 1, + })); + let b2 = create_block(libipld::ipld!({ + "prev": b1.cid(), + "n": 2, + })); + peer1.store().insert(*b0.cid(), b0.data().to_vec()); + peer1.store().insert(*b1.cid(), b1.data().to_vec()); + peer1.store().insert(*b2.cid(), b2.data().to_vec()); + let peer1 = peer1.spawn("peer1"); + + let id = peer2.swarm().behaviour_mut().sync( + *b2.cid(), + vec![peer1], + std::iter::once(*b2.cid()), + ); + + assert_progress(peer2.next().await, id, 1); + assert_progress(peer2.next().await, id, 1); + + assert_complete_ok(peer2.next().await, id); + } + + #[async_std::test] + async fn test_bitswap_cancel_sync() { + tracing_try_init(); + let mut peer1 = Peer::new(); + let mut peer2 = Peer::new(); + peer2.add_address(&peer1); + + let block = create_block(libipld::ipld!(&b"hello world"[..])); + peer1.store().insert(*block.cid(), block.data().to_vec()); + let peer1 = peer1.spawn("peer1"); + + let id = peer2.swarm().behaviour_mut().sync( + *block.cid(), + vec![peer1], + std::iter::once(*block.cid()), + ); + peer2.swarm().behaviour_mut().cancel(id); + let res = peer2.next().now_or_never(); + println!("{:?}", res); + assert!(res.is_none()); + } + + #[cfg(feature = "compat")] + #[async_std::test] + async fn compat_test() { + tracing_try_init(); + let cid: Cid = "QmP8njGuyiw9cjkhwHD9nZhyBTHufXFanAvZgcy9xYoWiB" + .parse() + .unwrap(); + let peer_id: PeerId = + "12D3KooWC1EaEEpghwnPdd89LaPTKEweD1PRLz4aRBkJEA9UiUuS" + .parse() + .unwrap(); + let multiaddr: Multiaddr = "/ip4/95.217.194.97/tcp/8008".parse().unwrap(); + + let mut peer = Peer::new(); + peer + .swarm() + .behaviour_mut() + .add_address(&peer_id, multiaddr); + let id = peer + .swarm() + .behaviour_mut() + .get(cid, std::iter::once(peer_id)); + assert_complete_ok(peer.next().await, id); + } } diff --git a/src/protocol.rs b/src/protocol.rs index 055afe5..452759d 100644 --- a/src/protocol.rs +++ b/src/protocol.rs @@ -1,13 +1,16 @@ -use async_trait::async_trait; -use futures::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt}; -use libipld::cid::Cid; -use libipld::store::StoreParams; -use libp2p::request_response::{ProtocolName, RequestResponseCodec}; -use std::convert::TryFrom; -use std::io::{self, Write}; -use std::marker::PhantomData; -use thiserror::Error; -use unsigned_varint::{aio, io::ReadError}; +use { + async_trait::async_trait, + futures::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt}, + libipld::{cid::Cid, store::StoreParams}, + libp2p::request_response::{Codec as RequestResponseCodec, ProtocolName}, + std::{ + convert::TryFrom, + io::{self, Write}, + marker::PhantomData, + }, + thiserror::Error, + unsigned_varint::{aio, io::ReadError}, +}; // version codec hash size (u64 varint is max 10 bytes) + digest const MAX_CID_SIZE: usize = 4 * 10 + 64; @@ -16,204 +19,216 @@ const MAX_CID_SIZE: usize = 4 * 10 + 64; pub struct BitswapProtocol; impl ProtocolName for BitswapProtocol { - fn protocol_name(&self) -> &[u8] { - b"/ipfs-embed/bitswap/1.0.0" - } + fn protocol_name(&self) -> &[u8] { + b"/ipfs-embed/bitswap/1.0.0" + } } #[derive(Clone)] pub struct BitswapCodec

{ - _marker: PhantomData

, - buffer: Vec, + _marker: PhantomData

, + buffer: Vec, } impl Default for BitswapCodec

{ - fn default() -> Self { - let capacity = usize::max(P::MAX_BLOCK_SIZE, MAX_CID_SIZE) + 1; - debug_assert!(capacity <= u32::MAX as usize); - Self { - _marker: PhantomData, - buffer: Vec::with_capacity(capacity), - } + fn default() -> Self { + let capacity = usize::max(P::MAX_BLOCK_SIZE, MAX_CID_SIZE) + 1; + debug_assert!(capacity <= u32::MAX as usize); + Self { + _marker: PhantomData, + buffer: Vec::with_capacity(capacity), } + } } #[async_trait] impl RequestResponseCodec for BitswapCodec

{ - type Protocol = BitswapProtocol; - type Request = BitswapRequest; - type Response = BitswapResponse; + type Protocol = BitswapProtocol; + type Request = BitswapRequest; + type Response = BitswapResponse; - async fn read_request(&mut self, _: &Self::Protocol, io: &mut T) -> io::Result - where - T: AsyncRead + Send + Unpin, - { - let msg_len = u32_to_usize(aio::read_u32(&mut *io).await.map_err(|e| match e { - ReadError::Io(e) => e, - err => other(err), - })?); - if msg_len > MAX_CID_SIZE + 1 { - return Err(invalid_data(MessageTooLarge(msg_len))); - } - self.buffer.resize(msg_len, 0); - io.read_exact(&mut self.buffer).await?; - let request = BitswapRequest::from_bytes(&self.buffer).map_err(invalid_data)?; - Ok(request) + async fn read_request( + &mut self, + _: &Self::Protocol, + io: &mut T, + ) -> io::Result + where + T: AsyncRead + Send + Unpin, + { + let msg_len = + u32_to_usize(aio::read_u32(&mut *io).await.map_err(|e| match e { + ReadError::Io(e) => e, + err => other(err), + })?); + if msg_len > MAX_CID_SIZE + 1 { + return Err(invalid_data(MessageTooLarge(msg_len))); } + self.buffer.resize(msg_len, 0); + io.read_exact(&mut self.buffer).await?; + let request = + BitswapRequest::from_bytes(&self.buffer).map_err(invalid_data)?; + Ok(request) + } - async fn read_response( - &mut self, - _: &Self::Protocol, - io: &mut T, - ) -> io::Result - where - T: AsyncRead + Send + Unpin, - { - let msg_len = u32_to_usize(aio::read_u32(&mut *io).await.map_err(|e| match e { - ReadError::Io(e) => e, - err => other(err), - })?); - if msg_len > P::MAX_BLOCK_SIZE + 1 { - return Err(invalid_data(MessageTooLarge(msg_len))); - } - self.buffer.resize(msg_len, 0); - io.read_exact(&mut self.buffer).await?; - let response = BitswapResponse::from_bytes(&self.buffer).map_err(invalid_data)?; - Ok(response) + async fn read_response( + &mut self, + _: &Self::Protocol, + io: &mut T, + ) -> io::Result + where + T: AsyncRead + Send + Unpin, + { + let msg_len = + u32_to_usize(aio::read_u32(&mut *io).await.map_err(|e| match e { + ReadError::Io(e) => e, + err => other(err), + })?); + if msg_len > P::MAX_BLOCK_SIZE + 1 { + return Err(invalid_data(MessageTooLarge(msg_len))); } + self.buffer.resize(msg_len, 0); + io.read_exact(&mut self.buffer).await?; + let response = + BitswapResponse::from_bytes(&self.buffer).map_err(invalid_data)?; + Ok(response) + } - async fn write_request( - &mut self, - _: &Self::Protocol, - io: &mut T, - req: Self::Request, - ) -> io::Result<()> - where - T: AsyncWrite + Send + Unpin, - { - self.buffer.clear(); - req.write_to(&mut self.buffer)?; - if self.buffer.len() > MAX_CID_SIZE + 1 { - return Err(invalid_data(MessageTooLarge(self.buffer.len()))); - } - let mut buf = unsigned_varint::encode::u32_buffer(); - let msg_len = unsigned_varint::encode::u32(self.buffer.len() as u32, &mut buf); - io.write_all(msg_len).await?; - io.write_all(&self.buffer).await?; - Ok(()) + async fn write_request( + &mut self, + _: &Self::Protocol, + io: &mut T, + req: Self::Request, + ) -> io::Result<()> + where + T: AsyncWrite + Send + Unpin, + { + self.buffer.clear(); + req.write_to(&mut self.buffer)?; + if self.buffer.len() > MAX_CID_SIZE + 1 { + return Err(invalid_data(MessageTooLarge(self.buffer.len()))); } + let mut buf = unsigned_varint::encode::u32_buffer(); + let msg_len = + unsigned_varint::encode::u32(self.buffer.len() as u32, &mut buf); + io.write_all(msg_len).await?; + io.write_all(&self.buffer).await?; + Ok(()) + } - async fn write_response( - &mut self, - _: &Self::Protocol, - io: &mut T, - res: Self::Response, - ) -> io::Result<()> - where - T: AsyncWrite + Send + Unpin, - { - self.buffer.clear(); - res.write_to(&mut self.buffer)?; - if self.buffer.len() > P::MAX_BLOCK_SIZE + 1 { - return Err(invalid_data(MessageTooLarge(self.buffer.len()))); - } - let mut buf = unsigned_varint::encode::u32_buffer(); - let msg_len = unsigned_varint::encode::u32(self.buffer.len() as u32, &mut buf); - io.write_all(msg_len).await?; - io.write_all(&self.buffer).await?; - Ok(()) + async fn write_response( + &mut self, + _: &Self::Protocol, + io: &mut T, + res: Self::Response, + ) -> io::Result<()> + where + T: AsyncWrite + Send + Unpin, + { + self.buffer.clear(); + res.write_to(&mut self.buffer)?; + if self.buffer.len() > P::MAX_BLOCK_SIZE + 1 { + return Err(invalid_data(MessageTooLarge(self.buffer.len()))); } + let mut buf = unsigned_varint::encode::u32_buffer(); + let msg_len = + unsigned_varint::encode::u32(self.buffer.len() as u32, &mut buf); + io.write_all(msg_len).await?; + io.write_all(&self.buffer).await?; + Ok(()) + } } #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum RequestType { - Have, - Block, + Have, + Block, } #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub struct BitswapRequest { - pub ty: RequestType, - pub cid: Cid, + pub ty: RequestType, + pub cid: Cid, } impl BitswapRequest { - pub fn write_to(&self, w: &mut W) -> io::Result<()> { - match self { - BitswapRequest { - ty: RequestType::Have, - cid, - } => { - w.write_all(&[0])?; - cid.write_bytes(&mut *w).map_err(other)?; - } - BitswapRequest { - ty: RequestType::Block, - cid, - } => { - w.write_all(&[1])?; - cid.write_bytes(&mut *w).map_err(other)?; - } - } - Ok(()) + pub fn write_to(&self, w: &mut W) -> io::Result<()> { + match self { + BitswapRequest { + ty: RequestType::Have, + cid, + } => { + w.write_all(&[0])?; + cid.write_bytes(&mut *w).map_err(other)?; + } + BitswapRequest { + ty: RequestType::Block, + cid, + } => { + w.write_all(&[1])?; + cid.write_bytes(&mut *w).map_err(other)?; + } } + Ok(()) + } - pub fn from_bytes(bytes: &[u8]) -> io::Result { - let ty = match bytes[0] { - 0 => RequestType::Have, - 1 => RequestType::Block, - c => return Err(invalid_data(UnknownMessageType(c))), - }; - let cid = Cid::try_from(&bytes[1..]).map_err(invalid_data)?; - Ok(Self { ty, cid }) - } + pub fn from_bytes(bytes: &[u8]) -> io::Result { + let ty = match bytes[0] { + 0 => RequestType::Have, + 1 => RequestType::Block, + c => return Err(invalid_data(UnknownMessageType(c))), + }; + let cid = Cid::try_from(&bytes[1..]).map_err(invalid_data)?; + Ok(Self { ty, cid }) + } } #[derive(Clone, Debug, Eq, PartialEq)] pub enum BitswapResponse { - Have(bool), - Block(Vec), + Have(bool), + Block(Vec), } impl BitswapResponse { - pub fn write_to(&self, w: &mut W) -> io::Result<()> { - match self { - BitswapResponse::Have(have) => { - if *have { - w.write_all(&[0])?; - } else { - w.write_all(&[2])?; - } - } - BitswapResponse::Block(data) => { - w.write_all(&[1])?; - w.write_all(data)?; - } - }; - Ok(()) - } + pub fn write_to(&self, w: &mut W) -> io::Result<()> { + match self { + BitswapResponse::Have(have) => { + if *have { + w.write_all(&[0])?; + } else { + w.write_all(&[2])?; + } + } + BitswapResponse::Block(data) => { + w.write_all(&[1])?; + w.write_all(data)?; + } + }; + Ok(()) + } - pub fn from_bytes(bytes: &[u8]) -> io::Result { - let res = match bytes[0] { - 0 | 2 => BitswapResponse::Have(bytes[0] == 0), - 1 => BitswapResponse::Block(bytes[1..].to_vec()), - c => return Err(invalid_data(UnknownMessageType(c))), - }; - Ok(res) - } + pub fn from_bytes(bytes: &[u8]) -> io::Result { + let res = match bytes[0] { + 0 | 2 => BitswapResponse::Have(bytes[0] == 0), + 1 => BitswapResponse::Block(bytes[1..].to_vec()), + c => return Err(invalid_data(UnknownMessageType(c))), + }; + Ok(res) + } } -fn invalid_data(e: E) -> io::Error { - io::Error::new(io::ErrorKind::InvalidData, e) +fn invalid_data( + e: E, +) -> io::Error { + io::Error::new(io::ErrorKind::InvalidData, e) } fn other(e: E) -> io::Error { - io::Error::new(io::ErrorKind::Other, e) + io::Error::new(io::ErrorKind::Other, e) } #[cfg(any(target_pointer_width = "64", target_pointer_width = "32"))] fn u32_to_usize(n: u32) -> usize { - n as usize + n as usize } #[derive(Debug, Error)] @@ -226,47 +241,48 @@ pub struct MessageTooLarge(usize); #[cfg(test)] pub(crate) mod tests { - use super::*; - use libipld::multihash::Code; - use multihash::MultihashDigest; + use { + super::*, + libipld::multihash::{Code, MultihashDigest}, + }; - pub fn create_cid(bytes: &[u8]) -> Cid { - let digest = Code::Blake3_256.digest(bytes); - Cid::new_v1(0x55, digest) - } + pub fn create_cid(bytes: &[u8]) -> Cid { + let digest = Code::Blake3_256.digest(bytes); + Cid::new_v1(0x55, digest) + } - #[test] - fn test_request_encode_decode() { - let requests = [ - BitswapRequest { - ty: RequestType::Have, - cid: create_cid(&b"have_request"[..]), - }, - BitswapRequest { - ty: RequestType::Block, - cid: create_cid(&b"block_request"[..]), - }, - ]; - let mut buf = Vec::with_capacity(MAX_CID_SIZE + 1); - for request in &requests { - buf.clear(); - request.write_to(&mut buf).unwrap(); - assert_eq!(&BitswapRequest::from_bytes(&buf).unwrap(), request); - } + #[test] + fn test_request_encode_decode() { + let requests = [ + BitswapRequest { + ty: RequestType::Have, + cid: create_cid(&b"have_request"[..]), + }, + BitswapRequest { + ty: RequestType::Block, + cid: create_cid(&b"block_request"[..]), + }, + ]; + let mut buf = Vec::with_capacity(MAX_CID_SIZE + 1); + for request in &requests { + buf.clear(); + request.write_to(&mut buf).unwrap(); + assert_eq!(&BitswapRequest::from_bytes(&buf).unwrap(), request); } + } - #[test] - fn test_response_encode_decode() { - let responses = [ - BitswapResponse::Have(true), - BitswapResponse::Have(false), - BitswapResponse::Block(b"block_response".to_vec()), - ]; - let mut buf = Vec::with_capacity(13 + 1); - for response in &responses { - buf.clear(); - response.write_to(&mut buf).unwrap(); - assert_eq!(&BitswapResponse::from_bytes(&buf).unwrap(), response); - } + #[test] + fn test_response_encode_decode() { + let responses = [ + BitswapResponse::Have(true), + BitswapResponse::Have(false), + BitswapResponse::Block(b"block_response".to_vec()), + ]; + let mut buf = Vec::with_capacity(13 + 1); + for response in &responses { + buf.clear(); + response.write_to(&mut buf).unwrap(); + assert_eq!(&BitswapResponse::from_bytes(&buf).unwrap(), response); } + } }