diff --git a/content-discovery/Cargo.lock b/content-discovery/Cargo.lock index dfd808a..16cfdce 100644 --- a/content-discovery/Cargo.lock +++ b/content-discovery/Cargo.lock @@ -28,18 +28,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "ahash" -version = "0.8.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", - "zerocopy", -] - [[package]] name = "aho-corasick" version = "1.1.3" @@ -141,57 +129,6 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" -[[package]] -name = "asn1-rs" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5493c3bedbacf7fd7382c6346bbd66687d12bbaad3a89a2d2c303ee6cf20b048" -dependencies = [ - "asn1-rs-derive", - "asn1-rs-impl", - "displaydoc", - "nom", - "num-traits", - "rusticata-macros", - "thiserror 1.0.69", - "time", -] - -[[package]] -name = "asn1-rs-derive" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "965c2d33e53cb6b267e148a4cb0760bc01f4904c1cd4bb4002a085bb016d1490" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.103", - "synstructure", -] - -[[package]] -name = "asn1-rs-impl" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.103", -] - -[[package]] -name = "async-channel" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b47800b0be77592da0afd425cc03468052844aff33b84e33cc696f64e77b6a" -dependencies = [ - "concurrent-queue", - "event-listener-strategy", - "futures-core", - "pin-project-lite", -] - [[package]] name = "async-compat" version = "0.2.4" @@ -227,6 +164,15 @@ dependencies = [ "rustc_version", ] +[[package]] +name = "atomic-polyfill" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cf2bce30dfe09ef0bfaef228b9d414faaf7e563035494d7fe092dba54b300f4" +dependencies = [ + "critical-section", +] + [[package]] name = "atomic-waker" version = "1.1.2" @@ -290,7 +236,9 @@ dependencies = [ "positioned-io", "range-collections", "self_cell", + "serde", "smallvec", + "tokio", ] [[package]] @@ -363,6 +311,12 @@ version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "102dbef1187b1893e6dfe05a774e79fd52265f49f214f6879c8ff49f52c8188b" +[[package]] +name = "btparse" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "387e80962b798815a2b5c4bcfdb6bf626fa922ffe9f74e373103b858738e9f31" + [[package]] name = "bumpalo" version = "3.18.1" @@ -393,6 +347,12 @@ dependencies = [ "shlex", ] +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + [[package]] name = "cfg-if" version = "1.0.1" @@ -488,6 +448,17 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" +[[package]] +name = "color-backtrace" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2123a5984bd52ca861c66f66a9ab9883b27115c607f801f86c1bc2a84eb69f0f" +dependencies = [ + "backtrace", + "btparse", + "termcolor", +] + [[package]] name = "colorchoice" version = "1.0.4" @@ -495,12 +466,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" [[package]] -name = "concurrent-queue" -version = "2.5.0" +name = "combine" +version = "4.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" dependencies = [ - "crossbeam-utils", + "bytes", + "memchr", ] [[package]] @@ -535,6 +507,16 @@ dependencies = [ "libc", ] +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -697,20 +679,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "der-parser" -version = "9.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cd0a5c643689626bec213c4d8bd4d96acc8ffdb4ad4bb6bc16abf27d5f4b553" -dependencies = [ - "asn1-rs", - "displaydoc", - "nom", - "num-bigint", - "num-traits", - "rusticata-macros", -] - [[package]] name = "der_derive" version = "0.7.3" @@ -737,7 +705,16 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" dependencies = [ - "derive_more-impl", + "derive_more-impl 1.0.0", +] + +[[package]] +name = "derive_more" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678" +dependencies = [ + "derive_more-impl 2.0.1", ] [[package]] @@ -752,6 +729,18 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "derive_more-impl" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.103", + "unicode-xid", +] + [[package]] name = "diatomic-waker" version = "0.2.3" @@ -947,27 +936,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "event-listener" -version = "5.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3492acde4c3fc54c845eaab3eed8bd00c7a7d881f78bfc801e43a93dec1331ae" -dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite", -] - -[[package]] -name = "event-listener-strategy" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" -dependencies = [ - "event-listener", - "pin-project-lite", -] - [[package]] name = "fallible-iterator" version = "0.3.0" @@ -1004,7 +972,6 @@ checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" dependencies = [ "futures-core", "futures-sink", - "nanorand", "spin", ] @@ -1282,12 +1249,12 @@ dependencies = [ ] [[package]] -name = "hashbrown" -version = "0.14.5" +name = "hash32" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" dependencies = [ - "ahash", + "byteorder", ] [[package]] @@ -1303,24 +1270,32 @@ dependencies = [ [[package]] name = "hashlink" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" +checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" dependencies = [ - "hashbrown 0.14.5", + "hashbrown", ] [[package]] -name = "heck" -version = "0.5.0" +name = "heapless" +version = "0.7.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +checksum = "cdc6457c0eb62c71aac4bc17216026d8410337c4126773b9c5daba343f17964f" +dependencies = [ + "atomic-polyfill", + "hash32", + "rustc_version", + "serde", + "spin", + "stable_deref_trait", +] [[package]] -name = "hermit-abi" -version = "0.5.2" +name = "heck" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hex" @@ -1689,7 +1664,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" dependencies = [ "equivalent", - "hashbrown 0.15.4", + "hashbrown", ] [[package]] @@ -1752,21 +1727,18 @@ dependencies = [ [[package]] name = "iroh" -version = "0.35.0" +version = "0.90.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ca758f4ce39ae3f07de922be6c73de6a48a07f39554e78b5745585652ce38f5" +checksum = "9436f319c2d24bca1b28a2fab4477c8d2ac795ab2d3aeda142d207b38ec068f4" dependencies = [ "aead", - "anyhow", - "atomic-waker", "backon", "bytes", "cfg_aliases", - "concurrent-queue", "crypto_box", "data-encoding", "der", - "derive_more", + "derive_more 1.0.0", "ed25519-dalek", "futures-buffered", "futures-util", @@ -1782,24 +1754,27 @@ dependencies = [ "iroh-quinn-udp", "iroh-relay", "n0-future", + "n0-snafu", + "n0-watcher", + "nested_enum_utils", "netdev", "netwatch", "pin-project", "pkarr", "portmapper", "rand 0.8.5", - "rcgen 0.13.2", "reqwest", "ring", "rustls", - "rustls-webpki 0.102.8", + "rustls-pki-types", + "rustls-webpki", "serde", "smallvec", + "snafu", "spki", "strum", "stun-rs", "surge-ping", - "thiserror 2.0.12", "time", "tokio", "tokio-stream", @@ -1808,44 +1783,43 @@ dependencies = [ "url", "wasm-bindgen-futures", "webpki-roots 0.26.11", - "x509-parser", "z32", ] [[package]] name = "iroh-base" -version = "0.35.0" +version = "0.90.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91ac4aaab68153d726c4e6b39c30f9f9253743f0e25664e52f4caeb46f48d11" +checksum = "8e0090050c4055b21e61cbcb856f043a2b24ad22c65d76bab91f121b4c7bece3" dependencies = [ "curve25519-dalek", "data-encoding", - "derive_more", + "derive_more 1.0.0", "ed25519-dalek", + "n0-snafu", + "nested_enum_utils", "postcard", "rand_core 0.6.4", "serde", - "thiserror 2.0.12", + "snafu", "url", ] [[package]] name = "iroh-blobs" -version = "0.35.0" +version = "0.90.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "817b785193b73c34ef1f2dcb5ddf8729ecef9b72a8fc0e706ee6d7a9bf8766a6" +checksum = "e5b6e39e8a3e9dded2eb0083fe5decf8a17000f22ba9b0b500ae1f476ce877b4" dependencies = [ "anyhow", - "async-channel", + "arrayvec", "bao-tree", - "blake3", "bytes", "chrono", "data-encoding", - "derive_more", + "derive_more 2.0.1", "futures-buffered", "futures-lite", - "futures-util", "genawaiter", "hashlink", "hex", @@ -1853,32 +1827,24 @@ dependencies = [ "iroh-base", "iroh-io", "iroh-metrics", - "nested_enum_utils 0.1.0", - "num_cpus", - "oneshot", - "parking_lot", - "portable-atomic", + "iroh-quinn", + "irpc", + "n0-future", + "n0-snafu", + "nested_enum_utils", "postcard", - "quic-rpc", - "quic-rpc-derive", "rand 0.8.5", "range-collections", "redb 2.4.0", + "ref-cast", "reflink-copy", "self_cell", "serde", - "serde-error", "smallvec", - "ssh-key", - "strum", - "tempfile", - "thiserror 2.0.12", + "snafu", "tokio", "tokio-util", "tracing", - "tracing-futures", - "tracing-test", - "walkdir", ] [[package]] @@ -1886,7 +1852,7 @@ name = "iroh-content-discovery" version = "0.1.0" dependencies = [ "anyhow", - "derive_more", + "derive_more 1.0.0", "ed25519-dalek", "futures-buffered", "hex", @@ -1909,7 +1875,7 @@ version = "0.1.0" dependencies = [ "anyhow", "clap", - "derive_more", + "derive_more 1.0.0", "futures", "iroh", "iroh-blobs", @@ -1927,7 +1893,7 @@ dependencies = [ "bao-tree", "bytes", "clap", - "derive_more", + "derive_more 1.0.0", "dirs-next", "futures", "hex", @@ -1942,6 +1908,7 @@ dependencies = [ "serde", "serde-big-array", "serde_json", + "ssh-key", "tempfile", "tokio", "tokio-util", @@ -1967,12 +1934,13 @@ dependencies = [ [[package]] name = "iroh-metrics" -version = "0.34.0" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f70466f14caff7420a14373676947e25e2917af6a5b1bec45825beb2bf1eb6a7" +checksum = "c8922c169f1b84d39d325c02ef1bbe1419d4de6e35f0403462b3c7e60cc19634" dependencies = [ "iroh-metrics-derive", "itoa", + "postcard", "serde", "snafu", "tracing", @@ -1992,9 +1960,9 @@ dependencies = [ [[package]] name = "iroh-quinn" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76c6245c9ed906506ab9185e8d7f64857129aee4f935e899f398a3bd3b70338d" +checksum = "0cde160ebee7aabede6ae887460cd303c8b809054224815addf1469d54a6fcf7" dependencies = [ "bytes", "cfg_aliases", @@ -2023,6 +1991,7 @@ dependencies = [ "rustc-hash", "rustls", "rustls-pki-types", + "rustls-platform-verifier", "slab", "thiserror 2.0.12", "tinyvec", @@ -2046,15 +2015,14 @@ dependencies = [ [[package]] name = "iroh-relay" -version = "0.35.0" +version = "0.90.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c63f122cdfaa4b4e0e7d6d3921d2b878f42a0c6d3ee5a29456dc3f5ab5ec931f" +checksum = "c3f3cdbdaebc92835452e4e1d0d4b36118206b0950089b7bc3654f13e843475b" dependencies = [ - "anyhow", "bytes", "cfg_aliases", "data-encoding", - "derive_more", + "derive_more 1.0.0", "getrandom 0.3.3", "hickory-resolver", "http 1.3.1", @@ -2065,8 +2033,10 @@ dependencies = [ "iroh-metrics", "iroh-quinn", "iroh-quinn-proto", - "lru 0.12.5", + "lru", "n0-future", + "n0-snafu", + "nested_enum_utils", "num_enum", "pin-project", "pkarr", @@ -2074,12 +2044,12 @@ dependencies = [ "rand 0.8.5", "reqwest", "rustls", - "rustls-webpki 0.102.8", + "rustls-pki-types", + "rustls-webpki", "serde", "sha1", + "snafu", "strum", - "stun-rs", - "thiserror 2.0.12", "tokio", "tokio-rustls", "tokio-util", @@ -2091,6 +2061,40 @@ dependencies = [ "z32", ] +[[package]] +name = "irpc" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b355fe12226ee885e1c1056a867c2cf37be2b22032a16f5ab7091069e98a966f" +dependencies = [ + "anyhow", + "futures-buffered", + "futures-util", + "iroh-quinn", + "irpc-derive", + "n0-future", + "postcard", + "rcgen 0.13.2", + "rustls", + "serde", + "smallvec", + "thiserror 2.0.12", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "irpc-derive" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efeabe1ee5615ea0416340b1a6d71a16f971495859c87fad48633b6497ee7a77" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "is_terminal_polyfill" version = "1.70.1" @@ -2103,6 +2107,28 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +[[package]] +name = "jni" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" +dependencies = [ + "cesu8", + "cfg-if", + "combine", + "jni-sys", + "log", + "thiserror 1.0.69", + "walkdir", + "windows-sys 0.45.0", +] + +[[package]] +name = "jni-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" + [[package]] name = "js-sys" version = "0.3.77" @@ -2197,20 +2223,14 @@ dependencies = [ "tracing-subscriber", ] -[[package]] -name = "lru" -version = "0.12.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" -dependencies = [ - "hashbrown 0.15.4", -] - [[package]] name = "lru" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "227748d55f2f0ab4735d87fd623798cb6b664512fe979705f829c9f81c934465" +dependencies = [ + "hashbrown", +] [[package]] name = "lru-slab" @@ -2231,7 +2251,7 @@ dependencies = [ "flume", "futures-lite", "getrandom 0.2.16", - "lru 0.13.0", + "lru", "serde", "serde_bencode", "serde_bytes", @@ -2261,12 +2281,6 @@ version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - [[package]] name = "miniz_oxide" version = "0.8.9" @@ -2313,7 +2327,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7bb0e5d99e681ab3c938842b96fcb41bf8a7bb4bfdb11ccbd653a7e83e06c794" dependencies = [ "cfg_aliases", - "derive_more", + "derive_more 1.0.0", "futures-buffered", "futures-lite", "futures-util", @@ -2328,24 +2342,27 @@ dependencies = [ ] [[package]] -name = "nanorand" -version = "0.7.0" +name = "n0-snafu" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +checksum = "c4fed465ff57041f29db78a9adc8864296ef93c6c16029f9e192dc303404ebd0" dependencies = [ - "getrandom 0.2.16", + "anyhow", + "btparse", + "color-backtrace", + "snafu", + "tracing-error", ] [[package]] -name = "nested_enum_utils" -version = "0.1.0" +name = "n0-watcher" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f256ef99e7ac37428ef98c89bef9d84b590172de4bbfbe81b68a4cd3abadb32" +checksum = "f216d4ebc5fcf9548244803cbb93f488a2ae160feba3706cd17040d69cf7a368" dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 1.0.109", + "derive_more 1.0.0", + "n0-future", + "snafu", ] [[package]] @@ -2458,24 +2475,26 @@ dependencies = [ [[package]] name = "netwatch" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67eeaa5f7505c93c5a9b35ba84fd21fb8aa3f24678c76acfe8716af7862fb07a" +checksum = "2a829a830199b14989f9bccce6136ab928ab48336ab1f8b9002495dbbbb2edbe" dependencies = [ "atomic-waker", "bytes", "cfg_aliases", - "derive_more", + "derive_more 1.0.0", "iroh-quinn-udp", "js-sys", "libc", "n0-future", - "nested_enum_utils 0.2.2", + "n0-watcher", + "nested_enum_utils", "netdev", "netlink-packet-core", "netlink-packet-route 0.23.0", "netlink-proto", "netlink-sys", + "pin-project-lite", "serde", "snafu", "socket2", @@ -2495,16 +2514,6 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43794a0ace135be66a25d3ae77d41b91615fb68ae937f904090203e81f755b65" -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - [[package]] name = "ntimestamp" version = "1.0.0" @@ -2530,16 +2539,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "num-bigint" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" -dependencies = [ - "num-integer", - "num-traits", -] - [[package]] name = "num-bigint-dig" version = "0.8.4" @@ -2593,16 +2592,6 @@ dependencies = [ "libm", ] -[[package]] -name = "num_cpus" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b" -dependencies = [ - "hermit-abi", - "libc", -] - [[package]] name = "num_enum" version = "0.7.3" @@ -2633,15 +2622,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "oid-registry" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8d8034d9489cdaf79228eb9f6a3b8d7bb32ba00d6645ebd48eef4077ceb5bd9" -dependencies = [ - "asn1-rs", -] - [[package]] name = "once_cell" version = "1.21.3" @@ -2658,18 +2638,18 @@ version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" -[[package]] -name = "oneshot" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ce411919553d3f9fa53a0880544cda985a112117a0444d5ff1e870a893d6ea" - [[package]] name = "opaque-debug" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" +[[package]] +name = "openssl-probe" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" + [[package]] name = "overload" version = "0.1.1" @@ -2877,7 +2857,7 @@ dependencies = [ "futures-lite", "getrandom 0.2.16", "log", - "lru 0.13.0", + "lru", "mainline", "ntimestamp", "reqwest", @@ -2974,20 +2954,20 @@ checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" [[package]] name = "portmapper" -version = "0.5.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d6db66007eac4a0ec8331d0d20c734bd64f6445d64bbaf0d0a27fea7a054e36" +checksum = "2d82975dc029c00d566f4e0f61f567d31f0297a290cb5416b5580dd8b4b54ade" dependencies = [ "base64", "bytes", - "derive_more", + "derive_more 1.0.0", "futures-lite", "futures-util", "hyper-util", "igd-next", "iroh-metrics", "libc", - "nested_enum_utils 0.2.2", + "nested_enum_utils", "netwatch", "num_enum", "rand 0.8.5", @@ -3022,6 +3002,7 @@ dependencies = [ "cobs", "embedded-io 0.4.0", "embedded-io 0.6.1", + "heapless", "postcard-derive", "serde", ] @@ -3154,40 +3135,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "quic-rpc" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18bad98bd048264ceb1361ff9d77a031535d8c1e3fe8f12c6966ec825bf68eb7" -dependencies = [ - "anyhow", - "document-features", - "flume", - "futures-lite", - "futures-sink", - "futures-util", - "pin-project", - "serde", - "slab", - "smallvec", - "time", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "quic-rpc-derive" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf13f1bced5f2f2642d9d89a29d75f2d81ab34c4acfcb434c209d6094b9b2b7" -dependencies = [ - "proc-macro2", - "quic-rpc", - "quote", - "syn 1.0.109", -] - [[package]] name = "quinn" version = "0.11.8" @@ -3336,6 +3283,7 @@ dependencies = [ "binary-merge", "inplace-vec-builder", "ref-cast", + "serde", "smallvec", ] @@ -3597,15 +3545,6 @@ dependencies = [ "semver", ] -[[package]] -name = "rusticata-macros" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "faf0c4a6ece9950b9abdb62b1cfcf2a68b3b67a10ba445b3bb85be2a293d0632" -dependencies = [ - "nom", -] - [[package]] name = "rustix" version = "1.0.7" @@ -3629,11 +3568,23 @@ dependencies = [ "once_cell", "ring", "rustls-pki-types", - "rustls-webpki 0.103.3", + "rustls-webpki", "subtle", "zeroize", ] +[[package]] +name = "rustls-native-certs" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fcff2dd52b58a8d98a70243663a0d234c4e2b79235637849d15913394a247d3" +dependencies = [ + "openssl-probe", + "rustls-pki-types", + "schannel", + "security-framework", +] + [[package]] name = "rustls-pki-types" version = "1.12.0" @@ -3645,16 +3596,32 @@ dependencies = [ ] [[package]] -name = "rustls-webpki" -version = "0.102.8" +name = "rustls-platform-verifier" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" +checksum = "19787cda76408ec5404443dc8b31795c87cd8fec49762dc75fa727740d34acc1" dependencies = [ - "ring", - "rustls-pki-types", - "untrusted", + "core-foundation 0.10.1", + "core-foundation-sys", + "jni", + "log", + "once_cell", + "rustls", + "rustls-native-certs", + "rustls-platform-verifier-android", + "rustls-webpki", + "security-framework", + "security-framework-sys", + "webpki-root-certs 0.26.11", + "windows-sys 0.59.0", ] +[[package]] +name = "rustls-platform-verifier-android" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f" + [[package]] name = "rustls-webpki" version = "0.103.3" @@ -3696,6 +3663,15 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "schannel" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" +dependencies = [ + "windows-sys 0.59.0", +] + [[package]] name = "scoped-tls" version = "1.0.1" @@ -3722,6 +3698,29 @@ dependencies = [ "zeroize", ] +[[package]] +name = "security-framework" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271720403f46ca04f7ba6f55d438f8bd878d6b8ca0a1046e8228c4145bcbb316" +dependencies = [ + "bitflags 2.9.1", + "core-foundation 0.10.1", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "self_cell" version = "1.2.0" @@ -3758,15 +3757,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde-error" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "342110fb7a5d801060c885da03bf91bfa7c7ca936deafcc64bb6706375605d47" -dependencies = [ - "serde", -] - [[package]] name = "serde_bencode" version = "0.2.4" @@ -3938,6 +3928,7 @@ version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "320b01e011bf8d5d7a4a4a4be966d9160968935849c83b918827f6a435e7f627" dependencies = [ + "backtrace", "snafu-derive", ] @@ -4164,7 +4155,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ "bitflags 2.9.1", - "core-foundation", + "core-foundation 0.9.4", "system-configuration-sys", ] @@ -4197,6 +4188,15 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + [[package]] name = "thiserror" version = "1.0.69" @@ -4253,13 +4253,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40" dependencies = [ "deranged", - "itoa", "js-sys", "num-conv", "powerfmt", "serde", "time-core", - "time-macros", ] [[package]] @@ -4268,16 +4266,6 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c" -[[package]] -name = "time-macros" -version = "0.2.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3526739392ec93fd8b359c8e98514cb3e8e021beb4e5f597b00a0221f8ed8a49" -dependencies = [ - "num-conv", - "time-core", -] - [[package]] name = "tinystr" version = "0.8.1" @@ -4313,6 +4301,7 @@ dependencies = [ "bytes", "libc", "mio", + "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2", @@ -4361,9 +4350,10 @@ checksum = "66a539a9ad6d5d281510d5bd368c973d636c02dbf8a67300bfb6b950696ad7df" dependencies = [ "bytes", "futures-core", + "futures-io", "futures-sink", "futures-util", - "hashbrown 0.15.4", + "hashbrown", "pin-project-lite", "slab", "tokio", @@ -4515,13 +4505,13 @@ dependencies = [ ] [[package]] -name = "tracing-futures" -version = "0.2.5" +name = "tracing-error" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +checksum = "8b1581020d7a273442f5b45074a6a57d5757ad0a47dac0e9f0bd57b81936f3db" dependencies = [ - "pin-project", "tracing", + "tracing-subscriber", ] [[package]] @@ -4553,27 +4543,6 @@ dependencies = [ "tracing-log", ] -[[package]] -name = "tracing-test" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "557b891436fe0d5e0e363427fc7f217abf9ccd510d5136549847bdcbcd011d68" -dependencies = [ - "tracing-core", - "tracing-subscriber", - "tracing-test-macro", -] - -[[package]] -name = "tracing-test-macro" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04659ddb06c87d233c566112c1c9c5b9e98256d9af50ec3bc9c8327f873a7568" -dependencies = [ - "quote", - "syn 2.0.103", -] - [[package]] name = "try-lock" version = "0.2.5" @@ -4832,6 +4801,24 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webpki-root-certs" +version = "0.26.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75c7f0ef91146ebfb530314f5f1d24528d7f0767efbfd31dce919275413e393e" +dependencies = [ + "webpki-root-certs 1.0.1", +] + +[[package]] +name = "webpki-root-certs" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86138b15b2b7d561bc4469e77027b8dd005a43dc502e9031d1f5afc8ce1f280e" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "webpki-roots" version = "0.26.11" @@ -5032,6 +5019,15 @@ dependencies = [ "windows-link", ] +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -5059,6 +5055,21 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + [[package]] name = "windows-targets" version = "0.48.5" @@ -5115,6 +5126,12 @@ dependencies = [ "windows-link", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" @@ -5133,6 +5150,12 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" @@ -5151,6 +5174,12 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + [[package]] name = "windows_i686_gnu" version = "0.48.5" @@ -5181,6 +5210,12 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + [[package]] name = "windows_i686_msvc" version = "0.48.5" @@ -5199,6 +5234,12 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -5217,6 +5258,12 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" @@ -5235,6 +5282,12 @@ version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" @@ -5330,23 +5383,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "x509-parser" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcbc162f30700d6f3f82a24bf7cc62ffe7caea42c0b2cba8bf7f3ae50cf51f69" -dependencies = [ - "asn1-rs", - "data-encoding", - "der-parser", - "lazy_static", - "nom", - "oid-registry", - "rusticata-macros", - "thiserror 1.0.69", - "time", -] - [[package]] name = "xml-rs" version = "0.8.26" diff --git a/content-discovery/Cargo.toml b/content-discovery/Cargo.toml index abee634..fc71f23 100644 --- a/content-discovery/Cargo.toml +++ b/content-discovery/Cargo.toml @@ -26,9 +26,9 @@ missing_debug_implementations = "warn" unused-async = "warn" [workspace.dependencies] -iroh = { version ="0.35", features = ["discovery-pkarr-dht"] } -iroh-base = "0.35" -iroh-blobs = { version = "0.35", features = ["rpc"] } +iroh = { version ="0.90", features = ["discovery-pkarr-dht"] } +iroh-base = "0.90" +iroh-blobs = { version = "0.90" } # explicitly specified until iroh minimal crates issues are solved, see https://github.com/n0-computer/iroh/pull/3255 tokio = { version = "1.44.1" } tokio-stream = { version = "0.1.17" } diff --git a/content-discovery/iroh-content-discovery-cli/src/main.rs b/content-discovery/iroh-content-discovery-cli/src/main.rs index 358cd73..012689f 100644 --- a/content-discovery/iroh-content-discovery-cli/src/main.rs +++ b/content-discovery/iroh-content-discovery-cli/src/main.rs @@ -4,7 +4,7 @@ use std::str::FromStr; use anyhow::bail; use clap::Parser; -use iroh::endpoint; +use iroh::endpoint::{self, BindError}; use iroh_content_discovery::protocol::{ AbsoluteTime, Announce, AnnounceKind, Query, QueryFlags, SignedAnnounce, }; @@ -43,7 +43,7 @@ async fn announce(args: AnnounceArgs) -> anyhow::Result<()> { let signed_announce = SignedAnnounce::new(announce, &key)?; if !args.tracker.is_empty() { for tracker in args.tracker { - println!("announcing to {}: {}", tracker, content); + println!("announcing to {tracker}: {content}"); iroh_content_discovery::announce(&endpoint, tracker, signed_announce).await?; } } @@ -66,7 +66,7 @@ async fn query(args: QueryArgs) -> anyhow::Result<()> { match iroh_content_discovery::query(&ep, tracker, query).await { Ok(announces) => announces, Err(e) => { - eprintln!("failed to query tracker {}: {}", tracker, e); + eprintln!("failed to query tracker {tracker}: {e}"); continue; } }; @@ -83,13 +83,13 @@ async fn query(args: QueryArgs) -> anyhow::Result<()> { /// Create an endpoint that does look up discovery info via DNS or the DHT, but does not /// announce. The client node id is ephemeral and will not be dialed by anyone. -async fn create_client_endpoint() -> anyhow::Result { +async fn create_client_endpoint() -> Result { let discovery = iroh::discovery::pkarr::dht::DhtDiscovery::builder() .dht(true) .n0_dns_pkarr_relay() .build()?; endpoint::Endpoint::builder() - .discovery(Box::new(discovery)) + .discovery(discovery) .bind() .await } diff --git a/content-discovery/iroh-content-discovery/src/client.rs b/content-discovery/iroh-content-discovery/src/client.rs index 4169f76..8527da5 100644 --- a/content-discovery/iroh-content-discovery/src/client.rs +++ b/content-discovery/iroh-content-discovery/src/client.rs @@ -16,7 +16,7 @@ use crate::protocol::{ pub enum Error { #[snafu(display("Failed to connect to tracker: {}", source))] Connect { - source: anyhow::Error, + source: iroh::endpoint::ConnectWithOptsError, backtrace: snafu::Backtrace, }, @@ -64,7 +64,7 @@ pub enum Error { #[snafu(display("Failed to get remote node id: {}", source))] RemoteNodeId { - source: anyhow::Error, + source: iroh::endpoint::RemoteNodeIdError, backtrace: snafu::Backtrace, }, } diff --git a/content-discovery/iroh-content-tracker/Cargo.toml b/content-discovery/iroh-content-tracker/Cargo.toml index 3a189bf..c0973a1 100644 --- a/content-discovery/iroh-content-tracker/Cargo.toml +++ b/content-discovery/iroh-content-tracker/Cargo.toml @@ -37,6 +37,7 @@ iroh-content-discovery = { path = "../iroh-content-discovery", features = ["clie clap = { version = "4", features = ["derive"], optional = true } serde-big-array = "0.5.1" +ssh-key = { version = "0.6", features = ["ed25519"] } [features] cli = ["clap"] diff --git a/content-discovery/iroh-content-tracker/src/io.rs b/content-discovery/iroh-content-tracker/src/io.rs index a378b7b..a7bfc0b 100644 --- a/content-discovery/iroh-content-tracker/src/io.rs +++ b/content-discovery/iroh-content-tracker/src/io.rs @@ -91,7 +91,7 @@ pub fn log_connection_attempt( path: &Option, host: &NodeId, t0: Instant, - outcome: &anyhow::Result, + outcome: &Result, ) -> anyhow::Result<()> { if let Some(path) = path { let now = SystemTime::now() diff --git a/content-discovery/iroh-content-tracker/src/iroh_blobs_util.rs b/content-discovery/iroh-content-tracker/src/iroh_blobs_util.rs index f75b42e..ebc2201 100644 --- a/content-discovery/iroh-content-tracker/src/iroh_blobs_util.rs +++ b/content-discovery/iroh-content-tracker/src/iroh_blobs_util.rs @@ -5,11 +5,11 @@ use bao_tree::{ChunkNum, ChunkRanges}; use bytes::Bytes; use iroh_blobs::{ get::{ - fsm::{BlobContentNext, EndBlobNext}, + fsm::{BlobContentNext, EndBlobNext, RequestCounters}, Stats, }, hashseq::HashSeq, - protocol::{GetRequest, RangeSpecSeq}, + protocol::{ChunkRangesSeq, GetRequest}, Hash, HashAndFormat, }; use rand::Rng; @@ -22,11 +22,17 @@ pub async fn unverified_size( connection: &iroh::endpoint::Connection, hash: &Hash, ) -> anyhow::Result<(u64, Stats)> { - let request = iroh_blobs::protocol::GetRequest::new( - *hash, - RangeSpecSeq::from_ranges(vec![ChunkRanges::from(ChunkNum(u64::MAX)..)]), + let request = iroh_blobs::protocol::GetRequest::new(*hash, ChunkRangesSeq::all()); + let request = iroh_blobs::get::fsm::start( + connection.clone(), + request, + RequestCounters { + payload_bytes_written: 0, + other_bytes_written: 0, + payload_bytes_read: 0, + other_bytes_read: 0, + }, ); - let request = iroh_blobs::get::fsm::start(connection.clone(), request); let connected = request.next().await?; let iroh_blobs::get::fsm::ConnectedNext::StartRoot(start) = connected.next().await? else { unreachable!("expected start root"); @@ -46,11 +52,17 @@ pub async fn verified_size( hash: &Hash, ) -> anyhow::Result<(u64, Stats)> { tracing::debug!("Getting verified size of {}", hash.to_hex()); - let request = iroh_blobs::protocol::GetRequest::new( - *hash, - RangeSpecSeq::from_ranges(vec![ChunkRanges::from(ChunkNum(u64::MAX)..)]), + let request = iroh_blobs::protocol::GetRequest::new(*hash, ChunkRangesSeq::verified_size()); + let request = iroh_blobs::get::fsm::start( + connection.clone(), + request, + RequestCounters { + payload_bytes_written: 0, + other_bytes_written: 0, + payload_bytes_read: 0, + other_bytes_read: 0, + }, ); - let request = iroh_blobs::get::fsm::start(connection.clone(), request); let connected = request.next().await?; let iroh_blobs::get::fsm::ConnectedNext::StartRoot(start) = connected.next().await? else { unreachable!("expected start root"); @@ -89,12 +101,21 @@ pub async fn get_hash_seq_and_sizes( tracing::debug!("Getting hash seq and children sizes of {}", content); let request = iroh_blobs::protocol::GetRequest::new( *hash, - RangeSpecSeq::from_ranges_infinite([ + ChunkRangesSeq::from_ranges_infinite([ ChunkRanges::all(), ChunkRanges::from(ChunkNum(u64::MAX)..), ]), ); - let at_start = iroh_blobs::get::fsm::start(connection.clone(), request); + let at_start = iroh_blobs::get::fsm::start( + connection.clone(), + request, + RequestCounters { + payload_bytes_written: 0, + other_bytes_written: 0, + payload_bytes_read: 0, + other_bytes_read: 0, + }, + ); let at_connected = at_start.next().await?; let iroh_blobs::get::fsm::ConnectedNext::StartRoot(start) = at_connected.next().await? else { unreachable!("query includes root"); @@ -140,9 +161,18 @@ pub async fn chunk_probe( chunk: ChunkNum, ) -> anyhow::Result { let ranges = ChunkRanges::from(chunk..chunk + 1); - let ranges = RangeSpecSeq::from_ranges([ranges]); + let ranges = ChunkRangesSeq::from_ranges([ranges]); let request = GetRequest::new(*hash, ranges); - let request = iroh_blobs::get::fsm::start(connection.clone(), request); + let request = iroh_blobs::get::fsm::start( + connection.clone(), + request, + RequestCounters { + payload_bytes_written: 0, + other_bytes_written: 0, + payload_bytes_read: 0, + other_bytes_read: 0, + }, + ); let connected = request.next().await?; let iroh_blobs::get::fsm::ConnectedNext::StartRoot(start) = connected.next().await? else { unreachable!("query includes root"); @@ -172,7 +202,7 @@ pub async fn chunk_probe( /// /// The random chunk is chosen uniformly from the chunks of the children, so /// larger children are more likely to be selected. -pub fn random_hash_seq_ranges(sizes: &[u64], mut rng: impl Rng) -> RangeSpecSeq { +pub fn random_hash_seq_ranges(sizes: &[u64], mut rng: impl Rng) -> ChunkRangesSeq { let total_chunks = sizes .iter() .map(|size| ChunkNum::full_chunks(*size).0) @@ -193,5 +223,5 @@ pub fn random_hash_seq_ranges(sizes: &[u64], mut rng: impl Rng) -> RangeSpecSeq ranges.push(ChunkRanges::empty()); } } - RangeSpecSeq::from_ranges(ranges) + ChunkRangesSeq::from_ranges(ranges) } diff --git a/content-discovery/iroh-content-tracker/src/main.rs b/content-discovery/iroh-content-tracker/src/main.rs index c412bc9..94cf769 100644 --- a/content-discovery/iroh-content-tracker/src/main.rs +++ b/content-discovery/iroh-content-tracker/src/main.rs @@ -2,13 +2,13 @@ pub mod args; use std::{ net::{SocketAddrV4, SocketAddrV6}, + path::PathBuf, sync::atomic::{AtomicBool, Ordering}, time::{Duration, Instant}, }; use clap::Parser; -use iroh::Endpoint; -use iroh_blobs::util::fs::load_secret_key; +use iroh::{endpoint::BindError, Endpoint, Watcher}; use iroh_content_discovery::protocol::ALPN; use iroh_content_tracker::{ io::{ @@ -47,7 +47,7 @@ macro_rules! log { async fn await_relay_region(endpoint: &Endpoint) -> anyhow::Result<()> { let t0 = Instant::now(); loop { - let addr = endpoint.node_addr().await?; + let addr = endpoint.node_addr().initialized().await?; if addr.relay_url().is_some() { break; } @@ -63,7 +63,7 @@ async fn create_endpoint( key: iroh::SecretKey, ipv4_addr: Option, ipv6_addr: Option, -) -> anyhow::Result { +) -> Result { let mut builder = iroh::Endpoint::builder() .secret_key(key) .discovery_dht() @@ -113,7 +113,7 @@ async fn server(args: Args) -> anyhow::Result<()> { let db = Tracker::new(options, endpoint.clone())?; db.dump().await?; await_relay_region(&endpoint).await?; - let addr = endpoint.node_addr().await?; + let addr = endpoint.node_addr().initialized().await?; println!("tracker addr: {}\n", addr.node_id); info!("listening on {:?}", addr); // let db2 = db.clone(); @@ -153,3 +153,53 @@ async fn main() -> anyhow::Result<()> { let args = Args::parse(); server(args).await } + +pub async fn load_secret_key(key_path: PathBuf) -> anyhow::Result { + use anyhow::Context; + use iroh::SecretKey; + use tokio::io::AsyncWriteExt; + + if key_path.exists() { + let keystr = tokio::fs::read(key_path).await?; + + let ser_key = ssh_key::private::PrivateKey::from_openssh(keystr)?; + let ssh_key::private::KeypairData::Ed25519(kp) = ser_key.key_data() else { + anyhow::bail!("invalid key format"); + }; + let secret_key = SecretKey::from_bytes(&kp.private.to_bytes()); + Ok(secret_key) + } else { + let secret_key = SecretKey::generate(rand::rngs::OsRng); + let ckey = ssh_key::private::Ed25519Keypair { + public: secret_key.public().public().into(), + private: secret_key.secret().into(), + }; + let ser_key = + ssh_key::private::PrivateKey::from(ckey).to_openssh(ssh_key::LineEnding::default())?; + + // Try to canonicalize if possible + let key_path = key_path.canonicalize().unwrap_or(key_path); + let key_path_parent = key_path.parent().ok_or_else(|| { + anyhow::anyhow!("no parent directory found for '{}'", key_path.display()) + })?; + tokio::fs::create_dir_all(&key_path_parent).await?; + + // write to tempfile + let (file, temp_file_path) = tempfile::NamedTempFile::new_in(key_path_parent) + .context("unable to create tempfile")? + .into_parts(); + let mut file = tokio::fs::File::from_std(file); + file.write_all(ser_key.as_bytes()) + .await + .context("unable to write keyfile")?; + file.flush().await?; + drop(file); + + // move file + tokio::fs::rename(temp_file_path, key_path) + .await + .context("failed to rename keyfile")?; + + Ok(secret_key) + } +} diff --git a/content-discovery/iroh-content-tracker/src/tracker.rs b/content-discovery/iroh-content-tracker/src/tracker.rs index 6eab441..f6b4e35 100644 --- a/content-discovery/iroh-content-tracker/src/tracker.rs +++ b/content-discovery/iroh-content-tracker/src/tracker.rs @@ -9,7 +9,10 @@ use anyhow::{bail, Context}; use bao_tree::ChunkNum; use iroh::{endpoint::Connection, Endpoint, NodeId}; use iroh_blobs::{ - get::{fsm::EndBlobNext, Stats}, + get::{ + fsm::{EndBlobNext, RequestCounters}, + Stats, + }, hashseq::HashSeq, protocol::GetRequest, BlobFormat, Hash, HashAndFormat, @@ -1022,7 +1025,7 @@ impl Tracker { content: &HashAndFormat, probe_kind: ProbeKind, ) -> anyhow::Result { - let cap = format!("{} at {}", content, host); + let cap = format!("{content} at {host}"); let HashAndFormat { hash, format } = content; let mut rng = rand::thread_rng(); let stats = if probe_kind == ProbeKind::Incomplete { @@ -1054,23 +1057,30 @@ impl Tracker { let (hs, sizes) = self.get_or_insert_sizes(connection, hash).await?; let ranges = random_hash_seq_ranges(&sizes, rand::thread_rng()); let text = ranges - .iter_non_empty() - .map(|(index, ranges)| { - format!("child={}, ranges={:?}", index, ranges.to_chunk_ranges()) - }) + .iter_non_empty_infinite() + .map(|(index, ranges)| format!("child={index}, ranges={ranges:?}")) .collect::>() .join(", "); tracing::debug!("Seq probing {} using {}", cap, text); let request = GetRequest::new(*hash, ranges); - let request = iroh_blobs::get::fsm::start(connection.clone(), request); + let request = iroh_blobs::get::fsm::start( + connection.clone(), + request, + RequestCounters { + payload_bytes_written: 0, + payload_bytes_read: 0, + other_bytes_written: 0, + other_bytes_read: 0, + }, + ); + let connected = request.next().await?; let iroh_blobs::get::fsm::ConnectedNext::StartChild(child) = connected.next().await? else { unreachable!("request does not include root"); }; - let index = - usize::try_from(child.child_offset()).expect("child offset too large"); + let index = usize::try_from(child.offset()).expect("child offset too large"); let hash = hs.get(index).expect("request inconsistent with hash seq"); let at_blob_header = child.next(hash); let at_end_blob = at_blob_header.drain().await?; @@ -1166,7 +1176,7 @@ impl Tracker { Ok(connection) => connection, Err(cause) => { debug!("error dialing host {}: {}", host, cause); - return Err(cause); + return Err(cause.into()); } }; let mut results = Vec::new(); diff --git a/content-discovery/iroh-content-tracker/tests/smoke.rs b/content-discovery/iroh-content-tracker/tests/smoke.rs index 4d04e7a..062ac8b 100644 --- a/content-discovery/iroh-content-tracker/tests/smoke.rs +++ b/content-discovery/iroh-content-tracker/tests/smoke.rs @@ -1,7 +1,7 @@ use std::{time::Duration, vec}; use iroh::{protocol::RouterBuilder, Endpoint}; -use iroh_blobs::net_protocol::Blobs; +use iroh_blobs::{net_protocol::Blobs, store::mem::MemStore}; use iroh_content_discovery::{ announce, protocol::{AbsoluteTime, Announce, AnnounceKind, Query, QueryFlags, SignedAnnounce}, @@ -25,21 +25,19 @@ async fn smoke_test() -> anyhow::Result<()> { let tracker = Tracker::new(options, tracker_ep.clone())?; let accept_task = tokio::spawn(tracker.clone().accept_loop(tracker_ep.clone())); let tracker_id = tracker_ep.node_id(); - let blobs = Blobs::memory().build(&provider_ep); + let store = MemStore::new(); + let blobs = Blobs::new(&store, provider_ep.clone(), None); let provider_router = RouterBuilder::new(provider_ep.clone()) .accept(iroh_blobs::ALPN, blobs.clone()) .spawn(); let hash = blobs - .client() + .store() .add_bytes(b"some content".to_vec()) .await? .hash; - println!("added content with hash: {}", hash); + println!("added content with hash: {hash}"); tokio::time::sleep(Duration::from_secs(1)).await; // wait for the tracker to be ready - println!( - "querying tracker {} for content with hash: {}", - tracker_id, hash - ); + println!("querying tracker {tracker_id} for content with hash: {hash}"); let q = Query { content: hash.into(), flags: QueryFlags { @@ -48,10 +46,7 @@ async fn smoke_test() -> anyhow::Result<()> { }, }; let res = query(&client_ep, tracker_id, q).await?; - println!( - "query successful, content found on tracker {} {:?}", - tracker_id, res - ); + println!("query successful, content found on tracker {tracker_id} {res:?}"); assert!(res.is_empty(), "we have not published anything yet!"); let signed_announce = SignedAnnounce::new( Announce { @@ -62,21 +57,12 @@ async fn smoke_test() -> anyhow::Result<()> { }, provider_ep.secret_key(), )?; - println!( - "announcing content to tracker {}: {:?}", - tracker_id, signed_announce - ); + println!("announcing content to tracker {tracker_id}: {signed_announce:?}"); announce(&client_ep, tracker_id, signed_announce).await?; - println!( - "querying tracker {} for content with hash: {}", - tracker_id, hash - ); + println!("querying tracker {tracker_id} for content with hash: {hash}"); tokio::time::sleep(Duration::from_secs(1)).await; // give the tracker some time to do the probe let res = query(&client_ep, tracker_id, q).await?; - println!( - "query successful, content found on tracker {} {:?}", - tracker_id, res - ); + println!("query successful, content found on tracker {tracker_id} {res:?}"); assert_eq!(res.len(), 1, "we should have one announce for the content"); provider_router.shutdown().await?; accept_task.abort(); diff --git a/h3-iroh/Cargo.toml b/h3-iroh/Cargo.toml index c1622ef..9d1c1f5 100644 --- a/h3-iroh/Cargo.toml +++ b/h3-iroh/Cargo.toml @@ -15,8 +15,8 @@ http-body = { version = "1", optional = true } http-body-util = { version = "0.1", optional = true } hyper = { version = "1.5", optional = true } hyper-util = { version = "0.1", optional = true } -iroh = "0.35" -iroh-base = { version = "0.35", features = ["ticket"] } +iroh = "0.90" +iroh-base = { version = "0.90", features = ["ticket"] } tokio = { version = "1", features = ["io-util"], default-features = false} tokio-util = "0.7" tower = { version = "0.5", optional = true } diff --git a/h3-iroh/examples/server-axum.rs b/h3-iroh/examples/server-axum.rs index d815d6d..6777d8b 100644 --- a/h3-iroh/examples/server-axum.rs +++ b/h3-iroh/examples/server-axum.rs @@ -4,6 +4,7 @@ use anyhow::Result; use axum::{response::Html, routing::get, Router}; +use iroh::Watcher; use iroh_base::ticket::NodeTicket; use tracing::info; @@ -22,7 +23,7 @@ async fn main() -> Result<()> { // Wait for direct addresses and a RelayUrl before printing a NodeTicket. ep.direct_addresses().initialized().await?; ep.home_relay().initialized().await?; - let ticket = NodeTicket::new(ep.node_addr().await?); + let ticket = NodeTicket::new(ep.node_addr().initialized().await?); info!("node ticket: {ticket}"); info!("run: cargo run --example client -- iroh+h3://{ticket}/"); diff --git a/h3-iroh/examples/server.rs b/h3-iroh/examples/server.rs index e582762..b1a8100 100644 --- a/h3-iroh/examples/server.rs +++ b/h3-iroh/examples/server.rs @@ -9,7 +9,7 @@ use bytes::{Bytes, BytesMut}; use clap::Parser; use h3::{error::ErrorLevel, quic::BidiStream, server::RequestStream}; use http::{Request, StatusCode}; -use iroh::endpoint::Incoming; +use iroh::{endpoint::Incoming, Watcher}; use iroh_base::ticket::NodeTicket; use tokio::{fs::File, io::AsyncReadExt}; use tracing::{debug, error, field, info, info_span, Instrument, Span}; @@ -52,7 +52,7 @@ async fn main() -> Result<()> { // Wait for direct addresses and a RelayUrl before printing a NodeTicket. ep.direct_addresses().initialized().await?; ep.home_relay().initialized().await?; - let ticket = NodeTicket::new(ep.node_addr().await?); + let ticket = NodeTicket::new(ep.node_addr().initialized().await?); info!("node ticket: {ticket}"); info!("run e.g.: cargo run --example client -- iroh+h3://{ticket}/Cargo.toml"); diff --git a/h3-iroh/src/lib.rs b/h3-iroh/src/lib.rs index d50c2ef..3d5fb41 100644 --- a/h3-iroh/src/lib.rs +++ b/h3-iroh/src/lib.rs @@ -704,7 +704,7 @@ impl std::error::Error for SendStreamError {} impl Display for SendStreamError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self) + write!(f, "{self:?}") } } diff --git a/iroh-dag-sync/Cargo.toml b/iroh-dag-sync/Cargo.toml index c2c62cf..d5f5df7 100644 --- a/iroh-dag-sync/Cargo.toml +++ b/iroh-dag-sync/Cargo.toml @@ -4,10 +4,10 @@ version = "0.1.0" edition = "2021" [dependencies] -iroh-blobs = "0.35" -iroh-gossip = "0.35" -iroh = "0.35" -iroh-base = { version ="0.35", features = ["ticket"] } +iroh-blobs = "0.90" +iroh-gossip = "0.90" +iroh = "0.90" +iroh-base = { version ="0.90", features = ["ticket"] } iroh-car = "0.5.0" redb = "2.1.1" clap = { version = "4.5.7", features = ["derive"] } diff --git a/iroh-dag-sync/src/main.rs b/iroh-dag-sync/src/main.rs index cdbdabc..ea626a9 100644 --- a/iroh-dag-sync/src/main.rs +++ b/iroh-dag-sync/src/main.rs @@ -6,12 +6,9 @@ use clap::Parser; use futures_lite::StreamExt; use ipld_core::codec::Links; use iroh::discovery::{dns::DnsDiscovery, pkarr::PkarrPublisher, ConcurrentDiscovery}; -use iroh::NodeAddr; +use iroh::{NodeAddr, Watcher}; use iroh_base::ticket::NodeTicket; -use iroh_blobs::store::{Map, MapEntry}; -use iroh_blobs::{store::Store, BlobFormat}; use iroh_car::CarReader; -use iroh_io::AsyncSliceReaderExt; use protocol::{ron_parser, Cid, Request}; use serde::{Deserialize, Serialize}; use sync::{handle_request, handle_sync_response}; @@ -36,10 +33,10 @@ async fn create_endpoint( ipv6_addr: Option, ) -> anyhow::Result { let secret_key = util::get_or_create_secret()?; - let discovery = Box::new(ConcurrentDiscovery::from_services(vec![ - Box::new(DnsDiscovery::n0_dns()), - Box::new(PkarrPublisher::n0_dns(secret_key.clone())), - ])); + let discovery = ConcurrentDiscovery::from_services(vec![ + Box::new(DnsDiscovery::n0_dns().build()), + Box::new(PkarrPublisher::n0_dns().build(secret_key.clone())), + ]); let mut builder = iroh::Endpoint::builder() .secret_key(secret_key) @@ -68,7 +65,7 @@ fn init_mapping_db(db: &redb::Database) -> anyhow::Result<()> { async fn main() -> anyhow::Result<()> { tracing_subscriber::fmt::init(); let args = Args::parse(); - let store = iroh_blobs::store::fs::Store::load("blobs.db").await?; + let store = iroh_blobs::store::fs::FsStore::load("blobs.db").await?; let mapping_store = redb::Database::create("dag.db")?; init_mapping_db(&mapping_store)?; let rt = LocalPoolHandle::new(1); @@ -89,14 +86,14 @@ async fn main() -> anyhow::Result<()> { } let links: Vec<_> = serde_ipld_dagcbor::codec::DagCborCodec::links(&data)?.collect(); - let tag = store.import_bytes(data.into(), BlobFormat::Raw).await?; - let hash = tag.hash(); + let tag = store.add_bytes(data).with_tag().await?; + let hash = tag.hash; if !links.is_empty() { println!("{} {} {}", i, cid, links.len()); let links = serde_ipld_dagcbor::to_vec(&links)?; - tables.data_to_links.insert((cid.codec(), *hash), links)?; + tables.data_to_links.insert((cid.codec(), hash), links)?; } else { - println!("{} {}", i, cid); + println!("{i} {cid}"); } tables .hash_to_blake3 @@ -104,9 +101,9 @@ async fn main() -> anyhow::Result<()> { } drop(tables); tx.commit()?; - store.sync().await?; + store.sync_db().await?; if let Some(first) = first { - println!("root: {}", first); + println!("root: {first}"); } } args::SubCommand::Export(args) => { @@ -127,7 +124,7 @@ async fn main() -> anyhow::Result<()> { let endpoint = create_endpoint(args.net.iroh_ipv4_addr, args.net.iroh_ipv6_addr).await?; endpoint.home_relay().initialized().await?; - let addr = endpoint.node_addr().await?; + let addr = endpoint.node_addr().initialized().await?; println!("Node id:\n{}", addr.node_id); println!( "Listening on {:#?}, {:#?}", @@ -148,7 +145,7 @@ async fn main() -> anyhow::Result<()> { }); } _ => { - eprintln!("Unknown ALPN: {:?}", alpn); + eprintln!("Unknown ALPN: {alpn:?}"); } } } @@ -190,7 +187,7 @@ async fn main() -> anyhow::Result<()> { async fn print_traversal( traversal: T, - store: &iroh_blobs::store::fs::Store, + store: &iroh_blobs::store::fs::FsStore, ) -> anyhow::Result<()> where T: Traversal, @@ -207,20 +204,23 @@ where .db_mut() .blake3_hash(cid.hash())? .context("blake3 hash not found")?; - let data = store.get(&blake3_hash).await?.context("data not found")?; - println!("{} {:x} {} {}", cid, cid.codec(), data.size().value(), n); + let data = store + .get_bytes(blake3_hash) + .await + .context("data not found")?; + println!("{cid} {:x} {} {n}", cid.codec(), data.len()); n += 1; } if let Some(first) = first { - println!("root: {}", first); + println!("root: {first}"); } Ok(()) } async fn export_traversal( traversal: T, - store: &iroh_blobs::store::fs::Store, + store: &iroh_blobs::store::fs::FsStore, mut file: tokio::fs::File, ) -> anyhow::Result<()> where @@ -248,8 +248,10 @@ where .db_mut() .blake3_hash(cid.hash())? .context("blake3 hash not found")?; - let handle = store.get(&blake3_hash).await?.context("data not found")?; - let data = handle.data_reader().read_to_end().await?; + let data = store + .get_bytes(blake3_hash) + .await + .context("data not found")?; let mut block_bytes = cid.to_bytes(); // postcard::to_extend(&RawCidHeader::from_cid(&cid), Vec::new())?; // block_bytes.extend_from_slice(&cid.hash().digest()); // hash block_bytes.extend_from_slice(&data); diff --git a/iroh-dag-sync/src/protocol.rs b/iroh-dag-sync/src/protocol.rs index 83861c6..58b4937 100644 --- a/iroh-dag-sync/src/protocol.rs +++ b/iroh-dag-sync/src/protocol.rs @@ -224,7 +224,7 @@ pub fn ron_parser() -> ::ron::Options { impl Display for TraversalOpts { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let res = ron_parser().to_string(self).unwrap(); - write!(f, "{}", res) + write!(f, "{res}") } } diff --git a/iroh-dag-sync/src/sync.rs b/iroh-dag-sync/src/sync.rs index 47839a7..202b0d4 100644 --- a/iroh-dag-sync/src/sync.rs +++ b/iroh-dag-sync/src/sync.rs @@ -1,13 +1,8 @@ use anyhow::Context; use bao_tree::{io::outboard::EmptyOutboard, BaoTree, ChunkRanges}; use iroh::endpoint::{Connecting, RecvStream, SendStream}; -use iroh_blobs::{ - protocol::RangeSpec, - provider::{send_blob, EventSender}, - store::{fs::Store, Store as _}, - BlobFormat, IROH_BLOCK_SIZE, -}; -use iroh_io::{TokioStreamReader, TokioStreamWriter}; +use iroh_blobs::store::{fs::FsStore, IROH_BLOCK_SIZE}; +use iroh_io::TokioStreamReader; use multihash_codetable::MultihashDigest; use tokio::io::AsyncReadExt; @@ -22,7 +17,7 @@ const MAX_REQUEST_SIZE: usize = 1024 * 1024 * 16; pub async fn handle_request( mut connecting: Connecting, tables: &impl ReadableTables, - blobs: &Store, + blobs: &FsStore, ) -> anyhow::Result<()> { tracing::info!( "got connecting, {:?}", @@ -30,7 +25,7 @@ pub async fn handle_request( ); let connection = connecting.await?; tracing::info!("got connection, waiting for request"); - let (send, mut recv) = connection.accept_bi().await?; + let (mut send, mut recv) = connection.accept_bi().await?; tracing::info!("got request stream"); let request = recv.read_to_end(MAX_REQUEST_SIZE).await?; tracing::info!("got request message: {} bytes", request.len()); @@ -38,17 +33,17 @@ pub async fn handle_request( tracing::info!("got request: {:?}", request); match request { Request::Sync(args) => { - handle_sync_request(send, args, tables, blobs).await?; + handle_sync_request(&mut send, args, tables, blobs).await?; } } Ok(()) } pub async fn handle_sync_request( - send: SendStream, + send: &mut SendStream, request: SyncRequest, tables: &impl ReadableTables, - blobs: &Store, + blobs: &FsStore, ) -> anyhow::Result<()> { let traversal = get_traversal(request.traversal, tables)?; let inline = get_inline(request.inline)?; @@ -57,58 +52,41 @@ pub async fn handle_sync_request( } async fn write_sync_response( - send: SendStream, + send: &mut SendStream, traversal: T, - blobs: &Store, + blobs: &FsStore, inline: impl Fn(&Cid) -> bool, ) -> anyhow::Result<()> where T::Db: ReadableTables, { let mut traversal = traversal; - // wrap the send stream in a TokioStreamWriter so we can use it from send_blob - let mut send = TokioStreamWriter(send); while let Some(cid) = traversal.next().await? { let hash = traversal .db_mut() .blake3_hash(cid.hash())? .context("blake3 hash not found")?; if inline(&cid) { - send.0 - .write_all(&SyncResponseHeader::Data(hash).as_bytes()) + send.write_all(&SyncResponseHeader::Data(hash).as_bytes()) .await?; - // TODO(ramfox): not exactly sure what this should be - // Would be nice to have this be optional, or to have an empty Event - let mk_progress = |end_offset| iroh_blobs::provider::Event::TransferProgress { - connection_id: 0, - request_id: 0, - hash, - end_offset, - }; - send_blob::( - blobs, - hash, - &RangeSpec::all(), - &mut send, - EventSender::new(None), - mk_progress, - ) - .await?; + blobs + .export_bao(hash, ChunkRanges::all()) + .write_quinn(send) + .await?; } else { - send.0 - .write_all(&SyncResponseHeader::Hash(hash).as_bytes()) + send.write_all(&SyncResponseHeader::Hash(hash).as_bytes()) .await?; } } - send.0.finish()?; + send.finish()?; Ok(()) } pub async fn handle_sync_response( recv: RecvStream, tables: &mut Tables<'_>, - store: &Store, + store: &FsStore, traversal: TraversalOpts, ) -> anyhow::Result<()> { let mut reader = TokioStreamReader(recv); @@ -120,11 +98,11 @@ pub async fn handle_sync_response( let Some(header) = SyncResponseHeader::from_stream(&mut reader.0).await? else { break; }; - println!("{} {:?}", cid, header); + println!("{cid} {header:?}"); let blake3_hash = match header { SyncResponseHeader::Hash(blake3_hash) => { // todo: get the data via another request - println!("just got hash mapping {} {}", cid, blake3_hash); + println!("just got hash mapping {cid} {blake3_hash}"); continue; } SyncResponseHeader::Data(hash) => hash, @@ -143,8 +121,8 @@ pub async fn handle_sync_response( anyhow::bail!("user hash mismatch"); } let data = bytes::Bytes::from(buffer); - let tag = store.import_bytes(data.clone(), BlobFormat::Raw).await?; - if tag.hash() != &blake3_hash { + let tag = store.add_bytes(data.clone()).with_tag().await?; + if tag.hash != blake3_hash { anyhow::bail!("blake3 hash mismatch"); } traversal.db_mut().insert_links(&cid, blake3_hash, &data)?; diff --git a/iroh-pkarr-naming-system/Cargo.toml b/iroh-pkarr-naming-system/Cargo.toml index 0c436bb..f968ba2 100644 --- a/iroh-pkarr-naming-system/Cargo.toml +++ b/iroh-pkarr-naming-system/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iroh-pkarr-naming-system" -version = "0.1.0" +version = "0.2.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -8,8 +8,8 @@ edition = "2021" [dependencies] anyhow = "1.0.79" derive_more = "0.99.17" -iroh = "0.34" -iroh-blobs = "0.34" +iroh = "0.90" +iroh-blobs = "0.90" pkarr = { version = "2.3.1", features = ["async", "dht"] } tokio = "1.35.1" tokio-util = "0.7.12" diff --git a/iroh-s3-bao-store/src/main.rs b/iroh-s3-bao-store/src/main.rs index f39fb7d..fc46995 100644 --- a/iroh-s3-bao-store/src/main.rs +++ b/iroh-s3-bao-store/src/main.rs @@ -130,7 +130,7 @@ fn get_or_create_secret(print: bool) -> anyhow::Result { Err(_) => { let key = SecretKey::generate(rand::thread_rng()); if print { - eprintln!("using secret key {}", key); + eprintln!("using secret key {key}"); } Ok(key) } @@ -188,7 +188,7 @@ impl CustomEventSender for ClientStatus { tracing::info!("{:?}", event); let msg = match event { provider::Event::ClientConnected { connection_id } => { - Some(format!("{} got connection", connection_id)) + Some(format!("{connection_id} got connection")) } provider::Event::TransferBlobCompleted { connection_id, @@ -214,7 +214,7 @@ impl CustomEventSender for ClientStatus { HumanDuration(stats.send.write_bytes.stats.duration) )), provider::Event::TransferAborted { connection_id, .. } => { - Some(format!("{} transfer completed", connection_id)) + Some(format!("{connection_id} transfer completed")) } _ => None, }; @@ -299,7 +299,7 @@ async fn serve_s3(args: ServeS3Args) -> anyhow::Result<()> { |addr| { if let Some(hash) = last_hash { let ticket = BlobTicket::new(addr.clone(), hash, BlobFormat::HashSeq)?; - println!("collection: {}", ticket); + println!("collection: {ticket}"); } Ok(()) }, @@ -334,11 +334,11 @@ async fn serve_urls(args: ImportS3Args) -> anyhow::Result<()> { |addr| { for (name, hash) in &hashes { let ticket = BlobTicket::new(addr.clone(), *hash, BlobFormat::Raw)?; - println!("{} {}", name, ticket); + println!("{name} {ticket}"); } if let Some(hash) = last_hash { let ticket = BlobTicket::new(addr.clone(), hash, BlobFormat::HashSeq)?; - println!("collection: {}", ticket); + println!("collection: {ticket}"); } Ok(()) },