diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index d021e970b5..38620cad9e 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,9 +1,11 @@ --- name: Bug report about: Create a report to help us improve -title: 'bug: [description]' +title: '[description]' labels: bug +projects: ["n0-computer/1"] assignees: '' +type: bug --- @@ -11,7 +13,7 @@ assignees: '' **Relevant Logs** - + **Expected behavior** @@ -44,3 +46,12 @@ Smartphone: **Additional Context / Screenshots / GIFs** + +**lolwut** + + +- [ ] This issue was created by a human that thought critically about + the issue being reported and wrote this as concisely and clearly + as they could. Taking full responsibility for the issue being + accurate. +- [ ] This issue isn't slop. diff --git a/.github/ISSUE_TEMPLATE/default.md b/.github/ISSUE_TEMPLATE/default.md deleted file mode 100644 index 0b51f93d7f..0000000000 --- a/.github/ISSUE_TEMPLATE/default.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -name: Default -about: No issue template -title: '' -labels: '' -assignees: '' - ---- - - diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 661de20023..7df7de9f77 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -289,12 +289,11 @@ jobs: - name: Add wasm target run: rustup target add wasm32-unknown-unknown - - name: Install cargo-binstall - uses: cargo-bins/cargo-binstall@v1.18.1 - - name: Install wasm-bindgen-test-runner - # Match the version of wasm-bindgen used in Cargo.lock - run: cargo binstall wasm-bindgen-cli@0.2.122 --locked --no-confirm + uses: taiki-e/install-action@v2 + with: + # Match the version of wasm-bindgen used in Cargo.lock + tool: wasm-bindgen-cli@0.2.122 - name: Install wasm-tools uses: bytecodealliance/actions/wasm-tools/setup@v1 @@ -382,13 +381,12 @@ jobs: - name: Install sccache uses: mozilla-actions/sccache-action@v0.0.9 - - name: Install cargo-binstall - uses: cargo-bins/cargo-binstall@v1.18.1 - - - uses: taiki-e/install-action@cargo-make - - name: Install cargo-check-external-types - run: cargo binstall cargo-check-external-types@${{ env.CARGO_CHECK_EXTERNAL_TYPES_VERSION }} --locked --no-confirm + uses: taiki-e/install-action@v2 + with: + tool: | + cargo-make + cargo-check-external-types@${{ env.CARGO_CHECK_EXTERNAL_TYPES_VERSION }} - name: Check external types run: cargo make check-external-types diff --git a/CHANGELOG.md b/CHANGELOG.md index 73d6acce20..76f36e9490 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,55 @@ All notable changes to iroh will be documented in this file. +## [1.0.0](https://github.com/n0-computer/iroh/compare/v1.0.0-rc.1..1.0.0) - 2026-06-15 + +### โ›ฐ๏ธ Features + +- *(iroh-relay)* [**breaking**] Allow setting a custom ServerCertVerifier and rename CaRootsConfig to CaTlsConfig ([#4300](https://github.com/n0-computer/iroh/issues/4300)) - ([b1e91e3](https://github.com/n0-computer/iroh/commit/b1e91e3d3939c06fd7ee1331e86527f525ff5a34)) +- *(iroh-relay)* Add Bearer token access control without an external service ([#4326](https://github.com/n0-computer/iroh/issues/4326)) - ([400264e](https://github.com/n0-computer/iroh/commit/400264e31904673a755faa77b92833dfb60d7d8a)) +- *(iroh-relay)* Allow multiple hostnames with Let's encrypt TLS ([#4337](https://github.com/n0-computer/iroh/issues/4337)) - ([9afd2bc](https://github.com/n0-computer/iroh/commit/9afd2bc1985d80b9afea9900ac26290c84f1f6a6)) +- Allow configuring NetReport ([#4020](https://github.com/n0-computer/iroh/issues/4020)) - ([6406e07](https://github.com/n0-computer/iroh/commit/6406e077a998f048dbb124ef22126e75394e928b)) +- Update relay urls to 1.0 stable ([#4341](https://github.com/n0-computer/iroh/issues/4341)) - ([8e25ecb](https://github.com/n0-computer/iroh/commit/8e25ecb30f3833e4a4a7dda7b17e95b655bd9f63)) +- [**breaking**] Update to 1.0 dependencies ([#4343](https://github.com/n0-computer/iroh/issues/4343)) - ([b193191](https://github.com/n0-computer/iroh/commit/b193191c928835e46935d2d7e5418f6c31dc62fa)) + +### ๐Ÿ› Bug Fixes + +- *(iroh)* Correctly abandon paths when new are opened with worse RTT ([#4296](https://github.com/n0-computer/iroh/issues/4296)) - ([295a715](https://github.com/n0-computer/iroh/commit/295a7158abf6e8dd44242fdfcbf2895fb29cbdaf)) +- *(iroh)* Don't kill noq endpoint on first transport recv error ([#4314](https://github.com/n0-computer/iroh/issues/4314)) - ([0a5ce75](https://github.com/n0-computer/iroh/commit/0a5ce758a710d827dc71b8bff1487f9dd399d230)) +- *(iroh)* Add global address validation token store ([#4317](https://github.com/n0-computer/iroh/issues/4317)) - ([ba81a72](https://github.com/n0-computer/iroh/commit/ba81a72535af1e093e670ea0fa76a380a7015dfc)) +- *(iroh)* Add missing export for `unstable-custom-transport` and improve docs ([#4335](https://github.com/n0-computer/iroh/issues/4335)) - ([5791244](https://github.com/n0-computer/iroh/commit/5791244385b31d8be334e7cb144aacbf3e6952bc)) +- *(iroh-dns)* Use portable_atomic::AtomicU64 for 32-bit targets ([#4320](https://github.com/n0-computer/iroh/issues/4320)) - ([1903740](https://github.com/n0-computer/iroh/commit/190374094f70eb08b417bf5114d0b2e2fca18912)) +- *(iroh-relay)* Connect IPv4 and IPv6 concurrently (happy eyeballs) ([#4299](https://github.com/n0-computer/iroh/issues/4299)) - ([bab6a43](https://github.com/n0-computer/iroh/commit/bab6a43a2a1c4d3e98d76f15235dca2ea6edc7c4)) +- Fix condition for retry warning. ([#4307](https://github.com/n0-computer/iroh/issues/4307)) - ([64b9316](https://github.com/n0-computer/iroh/commit/64b9316bf33d332e9e908ecf5785f7dc393a6e58)) + +### ๐Ÿšœ Refactor + +- *(iroh)* Use n0_future::MaybeFuture instead of own version ([#4310](https://github.com/n0-computer/iroh/issues/4310)) - ([07f1d1a](https://github.com/n0-computer/iroh/commit/07f1d1ae4a1da38d5965d558f88d340b07bef1b1)) +- *(iroh)* Minor cleanups to reqwest setup ([#4311](https://github.com/n0-computer/iroh/issues/4311)) - ([3cbc1a6](https://github.com/n0-computer/iroh/commit/3cbc1a69cdf4b3b19acce2b8fb994cc9c5ec186f)) +- *(iroh)* Improve tracing logs ([#4313](https://github.com/n0-computer/iroh/issues/4313)) - ([9a79782](https://github.com/n0-computer/iroh/commit/9a79782eec54273b34cf0a04c4d627a27a9a2df3)) +- *(iroh)* Don't log at warn level if the address lookup isn't configured. ([#4318](https://github.com/n0-computer/iroh/issues/4318)) - ([94f4b2f](https://github.com/n0-computer/iroh/commit/94f4b2f68c9731059194c9af19b2d57b4187cc94)) +- *(iroh)* Gate net_report API behind unstable-net-report feature ([#4338](https://github.com/n0-computer/iroh/issues/4338)) - ([7e95ae7](https://github.com/n0-computer/iroh/commit/7e95ae751f62f42fc6a312245b2b3ac548bbed0d)) + +### ๐Ÿ“š Documentation + +- *(iroh)* Improve readme ([#4329](https://github.com/n0-computer/iroh/issues/4329)) - ([710d03a](https://github.com/n0-computer/iroh/commit/710d03a634c9b220811cddb3c300e70290d754cc)) +- General cleanup and fixes ([#4328](https://github.com/n0-computer/iroh/issues/4328)) - ([01e74bc](https://github.com/n0-computer/iroh/commit/01e74bc1ec78a8a96ae507b4a3ecca99f166599f)) + +### ๐Ÿงช Testing + +- Mark a patchbay test as flaky ([#4322](https://github.com/n0-computer/iroh/issues/4322)) - ([a24e6a7](https://github.com/n0-computer/iroh/commit/a24e6a7fbcab92a70c2d1bc58de891bebee16ed1)) + +### โš™๏ธ Miscellaneous Tasks + +- *(iroh)* Update to latest noq main ([#4333](https://github.com/n0-computer/iroh/issues/4333)) - ([2f41f40](https://github.com/n0-computer/iroh/commit/2f41f406e89b9f5f6f93935dee549fbb453bae31)) +- Update check-external-types ([#4323](https://github.com/n0-computer/iroh/issues/4323)) - ([95111f0](https://github.com/n0-computer/iroh/commit/95111f0c8887e5e5bae6d4c5383dcf6edd9feeb9)) +- Update the issue templates a little ([#4340](https://github.com/n0-computer/iroh/issues/4340)) - ([a134dd8](https://github.com/n0-computer/iroh/commit/a134dd8e4766c622c9ab42db4d64cb19fae216ee)) +- Use install-action instead of binstall directly ([#4342](https://github.com/n0-computer/iroh/issues/4342)) - ([0e7e976](https://github.com/n0-computer/iroh/commit/0e7e976e033b209841912ea6e1709b1215d16abc)) + +### Deps + +- Update ed25519-dalek and curve25519-dalek ([#4324](https://github.com/n0-computer/iroh/issues/4324)) - ([33a92f1](https://github.com/n0-computer/iroh/commit/33a92f13cff3967d54a58d3a4515969b0f2daed0)) + ## [1.0.0-rc.1](https://github.com/n0-computer/iroh/compare/v1.0.0-rc.0..1.0.0-rc.1) - 2026-05-27 ### โ›ฐ๏ธ Features diff --git a/Cargo.lock b/Cargo.lock index 09584680ea..9cea47e14a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -52,19 +52,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "ahash" -version = "0.8.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" -dependencies = [ - "cfg-if", - "getrandom 0.3.4", - "once_cell", - "version_check", - "zerocopy", -] - [[package]] name = "aho-corasick" version = "1.1.4" @@ -426,9 +413,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64-url" -version = "3.0.3" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3b761ea69df72d0cc9591ea39adfb0e3b922a27dc535227d7ffbed5702e8809" +checksum = "261c4eaab63106ddf34d377f47e5428aa863b61e4a647c872778d9caf8e2c819" dependencies = [ "base64", ] @@ -465,9 +452,9 @@ dependencies = [ [[package]] name = "bitflags" -version = "2.11.1" +version = "2.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3" +checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8" [[package]] name = "blake3" @@ -494,9 +481,9 @@ dependencies = [ [[package]] name = "block-buffer" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdd35008169921d80bc60d3d0ab416eecb028c4cd653352907921d95084790be" +checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa" dependencies = [ "hybrid-array", ] @@ -569,9 +556,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.2.62" +version = "1.2.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1dce859f0832a7d088c4f1119888ab94ef4b5d6795d1ce05afb7fe159d79f98" +checksum = "dad887fd958be91b5098c0248def011f4523ab786cd411be668777e55063501f" dependencies = [ "find-msvc-tools", "jobserver", @@ -579,6 +566,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.4" @@ -604,9 +597,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.44" +version = "0.4.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" dependencies = [ "iana-time-zone", "js-sys", @@ -704,9 +697,9 @@ dependencies = [ [[package]] name = "cmov" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f88a43d011fc4a6876cb7344703e297c71dda42494fee094d5f7c76bf13f746" +checksum = "0c9ea0ac24bc397ab3c98583a3c9ba74fa56b09a4449bbe172b9b1ddb016027a" [[package]] name = "cobs" @@ -947,9 +940,9 @@ dependencies = [ [[package]] name = "ctor" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d765eb1c0bda10d31e0ea185f5ee15da532d60b0912d2bd1441783439e749c5" +checksum = "01334b89b69ff726750c5ce5073fc8bd860e99aa9a8fc5ca11b04730e3aee97a" dependencies = [ "link-section", "linktime-proc-macro", @@ -1141,9 +1134,6 @@ name = "deranged" version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" -dependencies = [ - "powerfmt", -] [[package]] name = "derive_builder" @@ -1227,7 +1217,7 @@ version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" dependencies = [ - "block-buffer 0.12.0", + "block-buffer 0.12.1", "const-oid", "crypto-common 0.2.2", ] @@ -1267,9 +1257,9 @@ dependencies = [ [[package]] name = "displaydoc" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +checksum = "1ac70aa55017e108007fbaf5aa0f54b021c98f92ff8af59d42eda9da96e3dd4f" dependencies = [ "proc-macro2", "quote", @@ -1376,15 +1366,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" -[[package]] -name = "erased-serde" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c138974f9d5e7fe373eb04df7cae98833802ae4b11c24ac7039a21d5af4b26c" -dependencies = [ - "serde", -] - [[package]] name = "errno" version = "0.3.14" @@ -1621,9 +1602,9 @@ dependencies = [ [[package]] name = "generator" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52f04ae4152da20c76fe800fa48659201d5cf627c5149ca0b707b69d7eef6cf9" +checksum = "b3b854b0e584ead1a33f18b2fcad7cf7be18b3875c78816b753639aa501513ae" dependencies = [ "cc", "cfg-if", @@ -1862,7 +1843,7 @@ dependencies = [ "http", "idna", "ipnet", - "jni", + "jni 0.22.4", "rand 0.10.1", "rustls", "thiserror 2.0.18", @@ -1882,7 +1863,7 @@ dependencies = [ "data-encoding", "idna", "ipnet", - "jni", + "jni 0.22.4", "once_cell", "prefix-trie", "rand 0.10.1", @@ -1906,7 +1887,7 @@ dependencies = [ "hickory-proto", "ipconfig", "ipnet", - "jni", + "jni 0.22.4", "moka", "ndk-context", "once_cell", @@ -1953,9 +1934,9 @@ dependencies = [ [[package]] name = "http" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8be7462df143984c4598a256ef469b251d7d7f9e271135073e78fc535414f3d0" +checksum = "6970f50e31d6fc17d3fa27329444bfa74e196cf62e95052a3f6fee181dba6425" dependencies = [ "bytes", "itoa", @@ -2023,9 +2004,9 @@ dependencies = [ [[package]] name = "hyper" -version = "1.9.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6299f016b246a94207e63da54dbe807655bf9e00044f73ded42c3ac5305fbcca" +checksum = "55281c53a1894c864990125767da440a4e630446785086f52523b20033b74498" dependencies = [ "atomic-waker", "bytes", @@ -2228,9 +2209,9 @@ dependencies = [ [[package]] name = "igd-next" -version = "0.17.0" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bac9a3c8278f43b4cd8463380f4a25653ac843e5b177e1d3eaf849cc9ba10d4d" +checksum = "de7238d487a9aff61f81b5ab41c0a841532a115a398b5fa92a2fadd0885e2581" dependencies = [ "attohttpc", "bytes", @@ -2305,7 +2286,7 @@ dependencies = [ [[package]] name = "iroh" -version = "1.0.0-rc.1" +version = "1.0.0" dependencies = [ "axum", "backon", @@ -2352,7 +2333,6 @@ dependencies = [ "rustc-hash", "rustls", "rustls-pki-types", - "rustls-webpki", "serde", "serde_json", "simple-dns 0.9.3", @@ -2369,18 +2349,16 @@ dependencies = [ "wasm-bindgen-futures", "wasm-bindgen-test", "wasm-tracing", - "webpki-roots", ] [[package]] name = "iroh-base" -version = "1.0.0-rc.1" +version = "1.0.0" dependencies = [ "curve25519-dalek", "data-encoding", "data-encoding-macro", "derive_more", - "digest 0.11.3", "ed25519-dalek", "getrandom 0.4.2", "n0-error", @@ -2391,16 +2369,13 @@ dependencies = [ "serde", "serde_json", "serde_test", - "sha1 0.11.0", - "sha2", "url", "zeroize", - "zeroize_derive", ] [[package]] name = "iroh-bench" -version = "1.0.0-rc.1" +version = "1.0.0" dependencies = [ "bytes", "clap", @@ -2410,7 +2385,6 @@ dependencies = [ "n0-error", "n0-future", "noq", - "rand 0.10.1", "rcgen", "rustls", "tokio", @@ -2420,14 +2394,14 @@ dependencies = [ [[package]] name = "iroh-dns" -version = "1.0.0-rc.1" +version = "1.0.0" dependencies = [ "arc-swap", "cfg_aliases", "derive_more", "ipconfig", "iroh-base", - "jni", + "jni 0.22.4", "lru 0.18.0", "n0-error", "n0-future", @@ -2449,7 +2423,7 @@ dependencies = [ [[package]] name = "iroh-dns-server" -version = "1.0.0-rc.1" +version = "1.0.0" dependencies = [ "async-trait", "axum", @@ -2486,7 +2460,6 @@ dependencies = [ "serde", "serde_json", "simple-dns 0.11.3", - "struct_iterable", "strum", "tempfile", "tokio", @@ -2506,9 +2479,9 @@ dependencies = [ [[package]] name = "iroh-metrics" -version = "1.0.0-rc.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d102597d0ee523f17fdb672c532395e634dbe945429284c811430d63bacc0d8a" +checksum = "291065721ad7c477b972e581bbc528df031dc8eb5e39fe1ff3300ae5dfb157ef" dependencies = [ "http-body-util", "hyper", @@ -2529,9 +2502,9 @@ dependencies = [ [[package]] name = "iroh-metrics-derive" -version = "1.0.0-rc.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91c8e0c97f1dc787107f388433c349397c565572fe6406d600ff7bb7b7fe3b30" +checksum = "1ae5f0c4405d1fbc9fb16ff422ca40620e93dc36c30ecaba0c2aee3992b7bd48" dependencies = [ "heck", "proc-macro2", @@ -2541,9 +2514,8 @@ dependencies = [ [[package]] name = "iroh-relay" -version = "1.0.0-rc.1" +version = "1.0.0" dependencies = [ - "ahash", "axum", "blake3", "bytes", @@ -2623,6 +2595,22 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" +[[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 0.3.1", + "log", + "thiserror 1.0.69", + "walkdir", + "windows-sys 0.45.0", +] + [[package]] name = "jni" version = "0.22.4" @@ -2632,7 +2620,7 @@ dependencies = [ "cfg-if", "combine", "jni-macros", - "jni-sys", + "jni-sys 0.4.1", "log", "simd_cesu8", "thiserror 2.0.18", @@ -2653,6 +2641,15 @@ dependencies = [ "syn", ] +[[package]] +name = "jni-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" +dependencies = [ + "jni-sys 0.4.1", +] + [[package]] name = "jni-sys" version = "0.4.1" @@ -2684,13 +2681,12 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.99" +version = "0.3.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "142bc4740e452c1e57ade0cbc129f139c9093e354346f0872ef985f4f5cf5f11" +checksum = "03d04c30968dffe80775bd4d7fb676131cd04a1fb46d2686dbffbaec2d9dfd31" dependencies = [ "cfg-if", "futures-util", - "once_cell", "wasm-bindgen", ] @@ -2720,18 +2716,18 @@ checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" [[package]] name = "libredox" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e02f3bb43d335493c96bf3fd3a321600bf6bd07ed34bc64118e9293bdffea46c" +checksum = "f02ab6bace2054fb888a3c16f990117b579d14a3088e472d63c6011fa185c9d3" dependencies = [ "libc", ] [[package]] name = "link-section" -version = "0.17.2" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d1e908a416d6e9f725743b84a36feea40c4c131e805fbc26d61f9f451f36080" +checksum = "c2b1dd6fe32e55c0fc0ea9493aa57459ca3cf4ff3c857c7d0302290150da6e4f" [[package]] name = "linked-hash-map" @@ -2741,9 +2737,9 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "linktime-proc-macro" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44cd706ff0d503ee32b2071166510ca27e281228de10cd3aa8d35ff94560f81" +checksum = "8c7b0a3383c2a1002d11349c92c85a666a5fb679e96c79d782cf0dbe557fd6ee" [[package]] name = "linux-raw-sys" @@ -2774,9 +2770,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.30" +version = "0.4.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "616ec5685824bcc94416c6d4a7a446eea774a31efd7062c8480ba6fd06d7a6e5" +checksum = "953f07c43838f8e6f9758cab68bf5bed85465e7587ebe0b823f1bcd81978ad3a" [[package]] name = "loom" @@ -2820,9 +2816,9 @@ checksum = "d3d25b0e0b648a86960ac23b7ad4abb9717601dec6f66c165f5b037f3f03065f" [[package]] name = "mainline" -version = "6.2.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25fd96e1eb0cff23f7048801d1561336c2e3c9f2b468d0271f27ad3463f583bf" +checksum = "6dfad9601b9117218868271c05403853593d4817e7abeab5c95e11eee16382bb" dependencies = [ "crc", "document-features", @@ -2857,9 +2853,9 @@ checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" [[package]] name = "memchr" -version = "2.8.0" +version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" +checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4" [[package]] name = "mime" @@ -2894,9 +2890,9 @@ dependencies = [ [[package]] name = "mio" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1" +checksum = "02bd0af71c67b473010cbbc60715ee815645a4dc942899111f494b4b737d6fda" dependencies = [ "libc", "wasi 0.11.1+wasi-snapshot-preview1", @@ -2922,9 +2918,9 @@ dependencies = [ [[package]] name = "n0-error" -version = "1.0.0-rc.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "223e946a84aa91644507a6b7865cfebbb9a231ace499041c747ab0fd30408212" +checksum = "c37e81176a83a77d2514528b91bdafc70ef88aab428f0e1b91aebb8d99888895" dependencies = [ "anyhow", "n0-error-macros", @@ -2933,9 +2929,9 @@ dependencies = [ [[package]] name = "n0-error-macros" -version = "1.0.0-rc.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "565305a21e6b3bf26640ad98f05a0fda12d3ab4315394566b52a7bddb8b34828" +checksum = "e2acd8b070213b0299282f884b4beba4e7b52d624fdcd504a3ad3665390c11e1" dependencies = [ "proc-macro2", "quote", @@ -2965,14 +2961,14 @@ dependencies = [ [[package]] name = "n0-qlog" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04fd2af7d4c68cd5c31fa69e64644e0a778bd1656bb8dfb86f9852f7d02a112e" +checksum = "bb1c2fc610d1facce51b0bf5d8245b309c91996a933defdf7742c92ac78a58cb" dependencies = [ + "humantime", "serde", "serde_json", "serde_with", - "smallvec", "strum", ] @@ -2999,9 +2995,9 @@ dependencies = [ [[package]] name = "n0-watcher" -version = "1.0.0-rc.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "928d8039a66cce5efcfd35e88b32d3defc8eba630b3ac451522997f563956a52" +checksum = "bbc618745ad0b7414b149d0517ad8b5573b2fb4d4e2717add3d2446ce1fdd826" dependencies = [ "derive_more", "n0-error", @@ -3016,19 +3012,22 @@ checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" [[package]] name = "netdev" -version = "0.43.0" +version = "0.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bacaf873ee4eab5646f99b381b271ec75e716902a67cf962c0f328c5eb5bfb" +checksum = "9d31e7286c21ceaf0ddb1d881964011214555ea0b317cc2eb1a1d68d861386fc" dependencies = [ "block2", "dispatch2", "dlopen2", "ipnet", + "jni 0.21.1", "libc", "mac-addr", + "ndk-context", "netlink-packet-core", "netlink-packet-route 0.29.0", "netlink-sys", + "objc2", "objc2-core-foundation", "objc2-core-wlan", "objc2-foundation", @@ -3071,6 +3070,18 @@ dependencies = [ "netlink-packet-core", ] +[[package]] +name = "netlink-packet-route" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2288fcb784eb3defd5fb16f4c4160d5f477de192eac730f43e1d11c24d9a007" +dependencies = [ + "bitflags", + "libc", + "log", + "netlink-packet-core", +] + [[package]] name = "netlink-proto" version = "0.12.0" @@ -3100,14 +3111,15 @@ dependencies = [ [[package]] name = "netwatch" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2071e0c2b5b229622c459096b84f1ad51afa150cdeeefdad491ef3704e581d91" +checksum = "8487d26d691cd98d5c17b2adb4b1fd4b31cccc820da1eac827d483295d7bb94a" dependencies = [ "atomic-waker", "bytes", "cfg_aliases", "derive_more", + "ipnet", "js-sys", "libc", "n0-error", @@ -3115,7 +3127,7 @@ dependencies = [ "n0-watcher", "netdev", "netlink-packet-core", - "netlink-packet-route 0.30.0", + "netlink-packet-route 0.31.0", "netlink-proto", "netlink-sys", "noq-udp", @@ -3182,9 +3194,9 @@ checksum = "38bf9645c8b145698bb0b18a4637dcacbc421ea49bef2317e4fd8065a387cf21" [[package]] name = "noq" -version = "1.0.0-rc.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "198b99fc085a5db1f7d259edb5ede8311e59f28cdd2687920b4313613d21a73f" +checksum = "11f0c73794bfde94db01379c46990b9a773993fca2b61a66184ce148b7c7a187" dependencies = [ "bytes", "cfg_aliases", @@ -3204,9 +3216,9 @@ dependencies = [ [[package]] name = "noq-proto" -version = "1.0.0-rc.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ab0ac774795ce1e42a7e61266e71f3be8110210630441169ac8dda403dd23f1" +checksum = "775be06b8d66c2c64db60140bf54dee8410f67b73c81cc1e1e32f11dfdaae501" dependencies = [ "aes-gcm", "aws-lc-rs", @@ -3235,9 +3247,9 @@ dependencies = [ [[package]] name = "noq-udp" -version = "1.0.0-rc.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3c1520eacd33fd6b009e2e70116b05508ade51db5e0d315ff8bf6b702148c2b" +checksum = "cd5a37756f168cf350d68a97c4f0158bdf3c76f10175123941569b09ab51f011" dependencies = [ "cfg_aliases", "libc", @@ -3545,9 +3557,9 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "patchbay" -version = "0.5.2" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d376bb9a5ce9816d86726877840df3a5113329390d4c9241c178707b14b5485" +checksum = "543b9acbe630f7745965d8243d3af809370cfad7b12d801b63e085e606349852" dependencies = [ "anyhow", "chrono", @@ -3705,9 +3717,9 @@ dependencies = [ [[package]] name = "portmapper" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64959cbabf952c8ffcbaea13745308508f1f825922f4068353f3de08d42cf214" +checksum = "ccc716c56a0a50f7e4e25f41446419599d47c6197cc5c9858174220e97c272e6" dependencies = [ "base64", "bytes", @@ -4048,9 +4060,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.12.3" +version = "1.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" +checksum = "f1292b7759ae1cb9ec195452d1390a074f0cd8541ab7a5a8c31cd6db45d4a6ba" dependencies = [ "aho-corasick", "memchr", @@ -4071,9 +4083,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" [[package]] name = "reloadable-core" @@ -4265,9 +4277,9 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "612460d5f7bea540c490b2b6395d8e34a953e52b491accd6c86c8164c5932a63" +checksum = "dab5152771c58876a2146916e53e35057e1a4dfa2b9df0f0305b07f611fdea4d" dependencies = [ "openssl-probe", "rustls-pki-types", @@ -4293,7 +4305,7 @@ checksum = "26d1e2536ce4f35f4846aa13bff16bd0ff40157cdb14cc056c7b14ba41233ba0" dependencies = [ "core-foundation 0.10.1", "core-foundation-sys", - "jni", + "jni 0.22.4", "log", "once_cell", "rustls", @@ -4534,9 +4546,9 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.20.0" +version = "3.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e72c1c2cb7b223fafb600a619537a871c2818583d619401b785e7c0b746ccde2" +checksum = "76a5c54c7310e7b8b9577c286d7e399ddd876c3e12b3ed917a8aabc4b96e9e8c" dependencies = [ "serde_core", "serde_with_macros", @@ -4544,9 +4556,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.20.0" +version = "3.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b90c488738ecb4fb0262f41f43bc40efc5868d9fb744319ddf5f5317f417bfac" +checksum = "84d57bc0c8b9a17920c178daa6bb924850d54a9c97ab45194bb8c17ad66bb660" dependencies = [ "darling 0.23.0", "proc-macro2", @@ -4614,9 +4626,9 @@ dependencies = [ [[package]] name = "shlex" -version = "1.3.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" [[package]] name = "signal-hook-registry" @@ -4682,18 +4694,15 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" [[package]] name = "smallvec" -version = "1.15.1" +version = "1.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" -dependencies = [ - "serde", -] +checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90" [[package]] name = "socket2" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" +checksum = "52d1cfed4120b4d927bf7c0f86d2087a4a7d6027c906d9f9d525a80573b9be51" dependencies = [ "libc", "windows-sys 0.61.2", @@ -4762,35 +4771,6 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" -[[package]] -name = "struct_iterable" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "849a064c6470a650b72e41fa6c057879b68f804d113af92900f27574828e7712" -dependencies = [ - "struct_iterable_derive", - "struct_iterable_internal", -] - -[[package]] -name = "struct_iterable_derive" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bb939ce88a43ea4e9d012f2f6b4cc789deb2db9d47bad697952a85d6978662c" -dependencies = [ - "erased-serde", - "proc-macro2", - "quote", - "struct_iterable_internal", - "syn", -] - -[[package]] -name = "struct_iterable_internal" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9426b2a0c03e6cc2ea8dbc0168dbbf943f88755e409fb91bcb8f6a268305f4a" - [[package]] name = "strum" version = "0.28.0" @@ -4969,12 +4949,11 @@ dependencies = [ [[package]] name = "time" -version = "0.3.47" +version = "0.3.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c" +checksum = "711a53c2d47bbd818258c498c8dbfe186a2526c631495cfe7e078567f86b8469" dependencies = [ "deranged", - "itoa", "js-sys", "libc", "num-conv", @@ -4987,15 +4966,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" +checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" [[package]] name = "time-macros" -version = "0.2.27" +version = "0.2.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e70e4c5a0e0a8a4823ad65dfe1a6930e4f4d756dcd9dd7939022b5e8c501215" +checksum = "71c652a3727a9cbb9a02f707f530b618ce00d0ccd762009c8c23bd191df3c17d" dependencies = [ "num-conv", "time-core", @@ -5191,9 +5170,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.25.11+spec-1.1.0" +version = "0.25.12+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b59c4d22ed448339746c59b905d24568fcbb3ab65a500494f7b8c3e97739f2b" +checksum = "d2153edc6955a6c354fad8f5efd38b6a8769bdccf9fe50f8e1329f81b0baa5d7" dependencies = [ "indexmap", "toml_datetime", @@ -5375,9 +5354,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.20.0" +version = "1.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ce102ab67701b8526c123c1bab5cbe42d7040ccfd0f64af1a385808d2f43de" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" [[package]] name = "unarray" @@ -5393,9 +5372,9 @@ checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" [[package]] name = "unicode-segmentation" -version = "1.13.2" +version = "1.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9629274872b2bfaf8d66f5f15725007f635594914870f65218920345aa11aa8c" +checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" [[package]] name = "unicode-width" @@ -5458,9 +5437,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.23.1" +version = "1.23.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddd74a9687298c6858e9b88ec8935ec45d22e8fd5e6394fa1bd4e99a87789c76" +checksum = "144d6b123cef80b301b8f72a9e2ca4370ddec21950d0a103dd22c437006d2db7" dependencies = [ "getrandom 0.4.2", "js-sys", @@ -5561,9 +5540,9 @@ dependencies = [ [[package]] name = "wasip2" -version = "1.0.3+wasi-0.2.9" +version = "1.0.4+wasi-0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" dependencies = [ "wit-bindgen 0.57.1", ] @@ -5588,9 +5567,9 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.122" +version = "0.2.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed04576f974d2b2fba0f38c51dbc5518011e38c36bf1143164be765528fd409" +checksum = "8ddb3f79143bced6de84270411622a2699cee572fc0875aeaf1e7867cf9fca1a" dependencies = [ "cfg-if", "once_cell", @@ -5601,9 +5580,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.72" +version = "0.4.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9473dbd2991ae90b6291c3c32c30c6187ac49aa32f9905d1cce280ec1e110b0f" +checksum = "503b14d284f2c8dac03b819967e155ea753f573586193b2b2c95990cb5d69280" dependencies = [ "js-sys", "wasm-bindgen", @@ -5611,9 +5590,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.122" +version = "0.2.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "916151b09da36bd82f6615cbf3a419e2f0ba23a03c6160e8e92eb6bd4aa1dec6" +checksum = "4e21a184b13fb19e157296e2c46056aec9092264fab83e4ba59e68c61b323c3d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -5621,9 +5600,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.122" +version = "0.2.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "299047362ccbfce148b67ab7e73349f77748e00c8296f9542adfad2ad82c5c5e" +checksum = "fecefd9c35bd935a20fc3fc344b5f29138961e4f47fb03297d88f2587afb5ebd" dependencies = [ "bumpalo", "proc-macro2", @@ -5634,18 +5613,18 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.122" +version = "0.2.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a929b2c61f11ba3e9bc35b50c1f25cb38e0e892c0c231ae2b8cf78d5dad4437" +checksum = "23939e44bb9a5d7576fa2b563dc2e136628f1224e88a8deed09e04858b77871f" dependencies = [ "unicode-ident", ] [[package]] name = "wasm-bindgen-test" -version = "0.3.72" +version = "0.3.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74fde991ccdc895cb7fbaa14b137d62af74d9011be67b71c694bfc40edd3119c" +checksum = "d16931d57bcdd6a0dcc11254bdd1388827690c1b6807f0d2836f59a4f9eb30ac" dependencies = [ "async-trait", "cast", @@ -5665,9 +5644,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-test-macro" -version = "0.3.72" +version = "0.3.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e925354648d2a4d1bf205412e36d520a800280622eef4719678d268e5d40e978" +checksum = "fccaddcb2cd722baa7453b4c3d2cb2a3071597bb91f7a4373e8775bdb151778c" dependencies = [ "proc-macro2", "quote", @@ -5676,9 +5655,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-test-shared" -version = "0.2.122" +version = "0.2.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "684365b586a9a6256c1cc3544eee8680de48d6041142f581776ec7b139622ae9" +checksum = "3746ad029217960123cf2ebf939dda51eb931ba9f8f09c117e39c820b96aa794" [[package]] name = "wasm-encoder" @@ -5740,9 +5719,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.99" +version = "0.3.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621441cfc37b84979402712047321980c178f299193a3589d05b99e8763436" +checksum = "a6430a72df5eb332242960fe84b3002a241163998241eb596d4f739b9757061d" dependencies = [ "js-sys", "wasm-bindgen", @@ -5938,13 +5917,22 @@ 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.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -5956,20 +5944,35 @@ dependencies = [ "windows-link", ] +[[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.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -5981,18 +5984,36 @@ 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.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[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.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[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.52.6" @@ -6005,24 +6026,48 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[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.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[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.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[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.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[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.52.6" @@ -6223,9 +6268,9 @@ dependencies = [ [[package]] name = "yoke" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abe8c5fda708d9ca3df187cae8bfb9ceda00dd96231bed36e445a1a48e66f9ca" +checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" dependencies = [ "stable_deref_trait", "yoke-derive", @@ -6246,18 +6291,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.48" +version = "0.8.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9" +checksum = "ce1022995ff5ff5d841ad7d994facc23098cd40152f2c1d11cd607c6f530653f" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.48" +version = "0.8.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4" +checksum = "1ae7f38b72ec2a254e2b87ef277cf2cd4fb97cbebf944faa6f33354da0867930" dependencies = [ "proc-macro2", "quote", @@ -6287,18 +6332,18 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.8.2" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" +checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e" dependencies = [ "zeroize_derive", ] [[package]] name = "zeroize_derive" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85a5b4158499876c763cb03bc4e49185d3cccbabb15b33c627f7884f43db852e" +checksum = "3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328" dependencies = [ "proc-macro2", "quote", diff --git a/README.md b/README.md index b8d08793d2..bbcde16aa0 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,6 @@ Use pre-existing protocols built on iroh instead of writing your own: - [iroh-blobs] for [BLAKE3]-based content-addressed blob transfer scaling from kilobytes to terabytes - [iroh-gossip] for establishing publish-subscribe overlay networks that scale, requiring only resources that your average phone can handle - [iroh-docs] for an eventually-consistent key-value store of [iroh-blobs] blobs -- [iroh-willow] for an (in-construction) implementation of the [willow protocol] ## Getting Started @@ -130,10 +129,9 @@ If you want to use iroh from other languages, make sure to check out [iroh-ffi], This repository contains a workspace of crates: - `iroh`: The core library for hole-punching & communicating with relays. -- `iroh-relay`: The relay server implementation. This is the code we run in production (and you can, too!). -- `iroh-base`: Common types like `Hash`, key types or `RelayUrl`. -- `iroh-dns-server`: DNS server implementation powering the `n0_discovery` for EndpointIds, running at dns.iroh.link. -- `iroh-net-report`: Analyzes your host's networking ability & NAT. +- `iroh-relay`: The relay client and server implementation. This is the code we run in production for the public relays (and you can, too!). +- `iroh-base`: Common types like `EndpointId` or `RelayUrl`. +- `iroh-dns-server`: DNS server implementation powering the DNS/Pkarr address lookup for EndpointIds, running at dns.iroh.link. ## License @@ -158,7 +156,6 @@ Unless you explicitly state otherwise, any contribution intentionally submitted [iroh-blobs]: https://github.com/n0-computer/iroh-blobs [iroh-gossip]: https://github.com/n0-computer/iroh-gossip [iroh-docs]: https://github.com/n0-computer/iroh-docs -[iroh-willow]: https://github.com/n0-computer/iroh-willow [iroh-doctor]: https://github.com/n0-computer/iroh-doctor [willow protocol]: https://willowprotocol.org [iroh-ffi]: https://github.com/n0-computer/iroh-ffi @@ -167,4 +164,4 @@ Unless you explicitly state otherwise, any contribution intentionally submitted [Iroh Experiments]: https://github.com/n0-computer/iroh-experiments [echo-rs]: /iroh/examples/echo.rs [iroh-perf]: https://perf.iroh.computer -[docs]: https://iroh.computer/docs +[docs]: https://docs.iroh.computer diff --git a/iroh-base/Cargo.toml b/iroh-base/Cargo.toml index f937cec51f..5578a3722e 100644 --- a/iroh-base/Cargo.toml +++ b/iroh-base/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iroh-base" -version = "1.0.0-rc.1" +version = "1.0.0" edition = "2024" readme = "README.md" description = "base type and utilities for Iroh" @@ -18,18 +18,13 @@ workspace = true curve25519-dalek = { version = "=5.0.0-rc.0", features = ["serde", "rand_core", "zeroize"], optional = true } data-encoding = { version = "2.6.0", optional = true } data-encoding-macro = { version = "0.1.19", optional = true } -digest = { version = "0.11", optional = true } -# Pin sha2 & sha1 to fix version incompatibility -sha2 = { version = "0.11.0", optional = true } -sha1 = { version = "0.11.0", optional = true } ed25519-dalek = { version = "=3.0.0-rc.0", features = ["serde", "rand_core", "zeroize"], optional = true } derive_more = { version = "2.0.1", features = ["debug", "display"], optional = true } url = { version = "2.5.3", features = ["serde"], optional = true } rand = { version = "0.10", optional = true } serde = { version = "1", features = ["derive", "rc"] } -n0-error = "=1.0.0-rc.0" -zeroize = { version = "1.8.2", optional = true, features = ["derive"] } -zeroize_derive = { version = "1.4.2", optional = true } # needed for minimal versions +n0-error = "1.0.0" +zeroize = { version = "1.9", optional = true, features = ["derive"] } # wasm-in-browser dependencies [target.'cfg(all(target_family = "wasm", target_os = "unknown"))'.dependencies] @@ -47,9 +42,7 @@ serde_test = "1" default = ["relay"] key = [ "dep:curve25519-dalek", - "dep:digest", "dep:ed25519-dalek", - "dep:sha2", "dep:url", "dep:derive_more", "dep:data-encoding", @@ -57,7 +50,6 @@ key = [ "dep:rand", "dep:getrandom", "dep:zeroize", - "dep:zeroize_derive", "relay", ] relay = [ diff --git a/iroh-base/src/endpoint_addr.rs b/iroh-base/src/endpoint_addr.rs index 619b435f69..a42ea9d7f8 100644 --- a/iroh-base/src/endpoint_addr.rs +++ b/iroh-base/src/endpoint_addr.rs @@ -20,7 +20,7 @@ use crate::{EndpointId, PublicKey, RelayUrl}; /// contact the endpoint. /// /// To establish a network connection to an endpoint both the [`EndpointId`] and one or more network -/// paths are needed. The network paths can come from various sources, current sources can come from +/// paths are needed. The network paths can come from various sources: /// /// - An [Address Lookup] service which can provide routing information for a given [`EndpointId`]. /// @@ -42,7 +42,7 @@ use crate::{EndpointId, PublicKey, RelayUrl}; pub struct EndpointAddr { /// The endpoint's identifier. pub id: EndpointId, - /// The endpoint's addresses + /// The endpoint's addresses. pub addrs: BTreeSet, } @@ -52,10 +52,10 @@ pub struct EndpointAddr { )] #[non_exhaustive] pub enum TransportAddr { - /// Relays + /// A relay server address. #[debug("Relay({_0})")] Relay(RelayUrl), - /// IP based addresses + /// An IP based address. Ip(SocketAddr), /// Custom transport address Custom(CustomAddr), @@ -128,12 +128,12 @@ impl EndpointAddr { self } - /// Returns true, if only a [`EndpointId`] is present. + /// Returns true if only an [`EndpointId`] is present. pub fn is_empty(&self) -> bool { self.addrs.is_empty() } - /// Returns a list of IP addresses of this peer. + /// Returns an iterator over the IP addresses of this endpoint address. pub fn ip_addrs(&self) -> impl Iterator { self.addrs.iter().filter_map(|addr| match addr { TransportAddr::Ip(addr) => Some(addr), @@ -141,7 +141,7 @@ impl EndpointAddr { }) } - /// Returns a list of relay urls of this peer. + /// Returns an iterator over the relay URLs of this endpoint address. /// /// In practice this is expected to be zero or one home relay for all known cases currently. pub fn relay_urls(&self) -> impl Iterator { diff --git a/iroh-base/src/key.rs b/iroh-base/src/key.rs index 895bc5e5ac..4a2db966ba 100644 --- a/iroh-base/src/key.rs +++ b/iroh-base/src/key.rs @@ -23,7 +23,7 @@ const Z_BASE_32: Encoding = new_encoding! { /// A public key. /// -/// The key itself is stored as the `CompressedEdwards` y coordinate of the public key +/// The key itself is stored as the `CompressedEdwards` y-coordinate of the public key. /// It is verified to decompress into a valid key when created. #[derive(Clone, Copy, PartialEq, Eq)] #[repr(transparent)] @@ -126,7 +126,7 @@ impl PublicKey { Ok(Self(y)) } - /// Verify a signature on a message with this secret key's public key. + /// Verify a signature on a message with this public key. /// /// # Return /// @@ -224,7 +224,7 @@ impl Display for PublicKey { } } -/// Error when deserialising a [`PublicKey`] or a [`SecretKey`]. +/// Error returned when parsing a [`PublicKey`] or a [`SecretKey`]. #[stack_error(derive, add_meta, from_sources, std_sources)] #[allow(missing_docs)] #[non_exhaustive] @@ -238,14 +238,14 @@ pub enum KeyParsingError { /// The input has invalid length. #[error("invalid length")] InvalidLength, - /// The decoded data is not a valid Ed25591 public key. + /// The decoded data is not a valid Ed25519 public key. #[error("data is not a valid public key")] InvalidKeyData, } -/// Deserialises the [`PublicKey`] from it's base32 encoding. +/// Parses a [`PublicKey`] from its hex or base32 encoding. /// -/// [`Display`] is capable of serialising this format. +/// [`Display`] produces the hex encoding. impl FromStr for PublicKey { type Err = KeyParsingError; diff --git a/iroh-dns-server/Cargo.toml b/iroh-dns-server/Cargo.toml index b18a36a5e6..b7ac775a66 100644 --- a/iroh-dns-server/Cargo.toml +++ b/iroh-dns-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iroh-dns-server" -version = "1.0.0-rc.1" +version = "1.0.0" edition = "2024" description = "A pkarr relay and DNS server" license = "MIT OR Apache-2.0" @@ -28,20 +28,18 @@ hickory-server = { version = "0.26.0", features = ["https-ring"] } http = "1.0.0" humantime = "2.2.0" humantime-serde = "1.1.1" -iroh-base = { version = "1.0.0-rc.1", path = "../iroh-base", features = ["key"] } -iroh-metrics = { version = "=1.0.0-rc.0", features = ["service"] } -iroh-dns = { version = "1.0.0-rc.1", path = "../iroh-dns" } +iroh-base = { version = "1.0.0", path = "../iroh-base", features = ["key"] } +iroh-metrics = { version = "1.0.1", features = ["service"] } +iroh-dns = { version = "1.0.0", path = "../iroh-dns" } lru = "0.18.0" -mainline = "6" +mainline = "7" n0-future = "0.3" rcgen = "0.14" redb = "4.1.0" regex = "1.10.3" rustls = { version = "0.23.33", default-features = false } serde = { version = "1", features = ["derive"] } -serde_json = "1" -struct_iterable = "0.1.1" -n0-error = "=1.0.0-rc.0" +n0-error = "1.0.0" strum = { version = "0.28", features = ["derive"] } tokio = { version = "1", features = ["full"] } tokio-rustls = { version = "0.26", default-features = false, features = ["logging"] } @@ -60,7 +58,7 @@ url = "2.5.3" criterion = "0.8.0" data-encoding = "2.3.3" hickory-resolver = { version = "0.26.0", features = ["tls-ring", "https-ring"] } -iroh = { version = "1.0.0-rc.1", path = "../iroh" } +iroh = { version = "1.0.0", path = "../iroh" } n0-tracing-test = "0.3" rand = "0.10" simple-dns = "0.11" diff --git a/iroh-dns-server/src/metrics.rs b/iroh-dns-server/src/metrics.rs index a3e734bc61..ddab0d9cce 100644 --- a/iroh-dns-server/src/metrics.rs +++ b/iroh-dns-server/src/metrics.rs @@ -13,7 +13,7 @@ pub struct Metrics { pub pkarr_publish_noop: Counter, /// Total number of DNS requests across all transports. pub dns_requests: Counter, - /// Number of DNS requests received over UDP or TCP. + /// Number of DNS requests received over UDP. pub dns_requests_udp: Counter, /// Number of DNS requests received over HTTPS (DoH). pub dns_requests_https: Counter, @@ -34,6 +34,8 @@ pub struct Metrics { /// Number of signed packets newly inserted into the store. pub store_packets_inserted: Counter, /// Number of signed packets removed from the store. + /// + /// Currently always at 0 because the removal API is not used. pub store_packets_removed: Counter, /// Number of times an existing signed packet was replaced by a newer one. pub store_packets_updated: Counter, diff --git a/iroh-dns/Cargo.toml b/iroh-dns/Cargo.toml index 9dfbab8039..c83f2a9e77 100644 --- a/iroh-dns/Cargo.toml +++ b/iroh-dns/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iroh-dns" -version = "1.0.0-rc.1" +version = "1.0.0" edition = "2024" description = "DNS-based endpoint discovery for iroh" license = "MIT OR Apache-2.0" @@ -15,9 +15,9 @@ workspace = true [dependencies] arc-swap = "1.9.1" derive_more = { version = "2.0.1", features = ["debug"] } -iroh-base = { version = "1.0.0-rc.1", path = "../iroh-base", default-features = false, features = ["key", "relay"] } +iroh-base = { version = "1.0.0", path = "../iroh-base", default-features = false, features = ["key", "relay"] } lru = "0.18.0" -n0-error = "=1.0.0-rc.0" +n0-error = "1.0.0" n0-future = "0.3" portable-atomic = "1" rand = "0.10" diff --git a/iroh-dns/src/dns.rs b/iroh-dns/src/dns.rs index f311e755cc..911d6cdbe3 100644 --- a/iroh-dns/src/dns.rs +++ b/iroh-dns/src/dns.rs @@ -394,7 +394,7 @@ impl DnsResolver { /// /// We first try to read the system's resolver from `/etc/resolv.conf`. /// This does not work at least on some Androids, therefore we fallback - /// to the default `ResolverConfig` which uses eg. to google's `8.8.8.8` or `8.8.4.4`. + /// to the default `ResolverConfig` which uses e.g. Google's `8.8.8.8` or `8.8.4.4`. pub fn new() -> Self { Builder::default().with_system_defaults().build() } diff --git a/iroh-dns/src/endpoint_info.rs b/iroh-dns/src/endpoint_info.rs index bbf7c7ef12..b28ca8e4ee 100644 --- a/iroh-dns/src/endpoint_info.rs +++ b/iroh-dns/src/endpoint_info.rs @@ -3,12 +3,12 @@ //! Dialing by [`EndpointId`] is supported by iroh endpoints publishing [Pkarr] records to DNS //! servers or the Mainline DHT. This module supports creating and parsing these records. //! -//! [`EndpointInfo`] combines an [`iroh_base::EndpointId`] with [`EndpointData`] โ€” +//! [`EndpointInfo`] combines an [`iroh_base::EndpointId`] with [`EndpointData`]: //! the addressing and metadata that discovery services publish and resolve. //! Discovery services use [`AddrFilter`] to control which addresses are published. //! //! This module also provides serialization to and from pkarr signed packets and -//! DNS TXT records. See the [`crate::attrs`] module for the on-the-wire format. +//! DNS TXT records. //! //! DNS records are published under the following names: //! @@ -120,7 +120,7 @@ impl EndpointData { self.add_addrs(addresses.into_iter().map(TransportAddr::Ip)) } - /// Adds addresses to the endpoint data in the given ordered, but with duplicates filtered. + /// Adds addresses to the endpoint data in the given order, but with duplicates filtered. pub fn add_addrs(&mut self, addrs: impl IntoIterator) { let mut addr_set = dedup(&mut self.addrs); for addr in addrs.into_iter() { @@ -131,7 +131,7 @@ impl EndpointData { } } - /// Sets the user-defined data and returns the updated endpoint data. + /// Sets the user-defined data. pub fn set_user_data(&mut self, user_data: Option) { self.user_data = user_data; } @@ -142,7 +142,7 @@ impl EndpointData { .retain(|addr| !matches!(addr, TransportAddr::Ip(_))); } - /// Removes all direct addresses from the endpoint data. + /// Removes all relay URLs from the endpoint data. pub fn clear_relay_urls(&mut self) { self.addrs .retain(|addr| !matches!(addr, TransportAddr::Relay(_))); @@ -169,12 +169,12 @@ impl EndpointData { }) } - /// Returns the full list of all known addresses + /// Returns the full list of all known addresses. pub fn addrs(&self) -> impl Iterator { self.addrs.iter() } - /// Does this have any addresses? + /// Returns whether this has any addresses. pub fn has_addrs(&self) -> bool { !self.addrs.is_empty() } @@ -294,9 +294,9 @@ impl From for EndpointData { } } -// User-defined data that can be published and resolved through endpoint discovery. +/// User-defined data that can be published and resolved through endpoint discovery. /// -/// Under the hood this is a UTF-8 String is no longer than [`UserData::MAX_LENGTH`] bytes. +/// Under the hood this is a UTF-8 string no longer than [`UserData::MAX_LENGTH`] bytes. /// /// Iroh does not keep track of or examine the user-defined data. /// diff --git a/iroh-relay/Cargo.toml b/iroh-relay/Cargo.toml index 7ac1c38bd8..9efdaaf349 100644 --- a/iroh-relay/Cargo.toml +++ b/iroh-relay/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iroh-relay" -version = "1.0.0-rc.1" +version = "1.0.0" edition = "2024" readme = "README.md" description = "Iroh's relay server and client" @@ -33,11 +33,11 @@ http = "1" http-body-util = "0.1.0" hyper = { version = "1", features = ["server", "client", "http1"] } hyper-util = "0.1.1" -iroh-base = { version = "1.0.0-rc.1", path = "../iroh-base", default-features = false, features = ["key", "relay"] } -iroh-dns = { version = "1.0.0-rc.1", path = "../iroh-dns" } -iroh-metrics = { version = "=1.0.0-rc.0", default-features = false } +iroh-base = { version = "1.0.0", path = "../iroh-base", default-features = false, features = ["key", "relay"] } +iroh-dns = { version = "1.0.0", path = "../iroh-dns" } +iroh-metrics = { version = "1.0.1", default-features = false } lru = "0.18.0" -n0-error = "=1.0.0-rc.0" +n0-error = "1.0.0" n0-future = "0.3" num_enum = "0.7" pin-project = "1" @@ -46,8 +46,8 @@ postcard = { version = "1", default-features = false, features = [ "use-std", "experimental-derive", ] } -noq = { version = "=1.0.0-rc.1", default-features = false, features = ["rustls"] } -noq-proto = { version = "=1.0.0-rc.1", default-features = false } +noq = { version = "1.0.0", default-features = false, features = ["rustls"] } +noq-proto = { version = "1.0.0", default-features = false } rand = "0.10" reqwest = { version = "0.13", default-features = false, features = ["rustls-no-provider"] } rustls = { version = "0.23.33", default-features = false } @@ -71,7 +71,6 @@ webpki_types = { package = "rustls-pki-types", version = "1.12" } # server feature clap = { version = "4", features = ["derive"], optional = true } dashmap = { version = "6.1.0", optional = true } -ahash = { version = "0.8.11", optional = true } # minimal version fix rcgen = { version = "0.14", optional = true } reloadable-state = { version = "0.1", optional = true } rustls-cert-reloadable-resolver = { version = "0.7.1", optional = true } @@ -141,7 +140,6 @@ server = [ "tokio/rt-multi-thread", "dep:clap", "dep:dashmap", - "dep:ahash", "dep:rcgen", "dep:reloadable-state", "dep:rustls-cert-file-reader", diff --git a/iroh-relay/src/http.rs b/iroh-relay/src/http.rs index 5922aae05a..cf2c3eb4dc 100644 --- a/iroh-relay/src/http.rs +++ b/iroh-relay/src/http.rs @@ -77,7 +77,7 @@ impl ProtocolVersion { Self::all().collect::>().join(", ") } - /// Returns all supported protocol versions in a comma-seperated string as an HTTP header value. + /// Returns all supported protocol versions in a comma-separated string as an HTTP header value. pub fn all_as_header_value() -> HeaderValue { HeaderValue::from_bytes(Self::all_joined().as_bytes()).expect("valid header name") } diff --git a/iroh-relay/src/lib.rs b/iroh-relay/src/lib.rs index eb4f186b2d..a35c7ea5c8 100644 --- a/iroh-relay/src/lib.rs +++ b/iroh-relay/src/lib.rs @@ -51,15 +51,13 @@ pub use crate::{ relay_map::{RelayConfig, RelayMap, RelayQuicConfig}, }; -/// This trait allows anything that ends up potentially -/// wrapping a TLS stream use the underlying [`export_keying_material`] -/// function. -/// -/// [`export_keying_material`]: rustls::ConnectionCommon::export_keying_material /// Trait for extracting keying material from a TLS connection. /// -/// This is used during the relay handshake to establish a shared secret -/// between the client and server for authentication purposes. +/// This allows anything that ends up potentially wrapping a TLS stream to use the +/// underlying [`export_keying_material`] function. It is used during the relay handshake +/// to establish a shared secret between the client and server for authentication purposes. +/// +/// [`export_keying_material`]: rustls::ConnectionCommon::export_keying_material pub trait ExportKeyingMaterial { /// If this type ends up wrapping a TLS stream, then this tries /// to export keying material by calling the underlying [`export_keying_material`] diff --git a/iroh-relay/src/main.rs b/iroh-relay/src/main.rs index 17fa821952..0fd5da35f8 100644 --- a/iroh-relay/src/main.rs +++ b/iroh-relay/src/main.rs @@ -21,6 +21,7 @@ use iroh_relay::{ self as relay, Access, AccessControl, AcmeConfig, ClientRateLimit, ClientRequest, DEFAULT_CERT_RELOAD_INTERVAL, QuicConfig, reloading_resolver, }, + tls::CaTlsConfig, }; use n0_error::{AnyError, Result, StdResultExt, bail_any}; use serde::{Deserialize, Serialize}; @@ -37,6 +38,10 @@ const X_IROH_ENDPOINT_ID: &str = "X-Iroh-NodeId"; const ENV_HTTP_BEARER_TOKEN: &str = "IROH_RELAY_HTTP_BEARER_TOKEN"; /// Environment variable to verify relay access (without an external auth service) const ENV_RELAY_ACCESS_TOKEN: &str = "IROH_RELAY_ACCESS_TOKEN"; +/// Environment variable to override the ACME directory URL. +const ENV_ACME_URL: &str = "IROH_RELAY_ACME_URL"; +/// Environment variable to trust an additional CA for the ACME server's TLS certificate. +const ENV_ACME_CA: &str = "IROH_RELAY_ACME_CA"; /// A relay server for iroh. #[derive(Parser, Debug, Clone)] @@ -400,7 +405,8 @@ struct TlsConfig { /// port set to [`iroh_relay::defaults::DEFAULT_RELAY_QUIC_PORT`] quic_bind_addr: Option, /// Certificate hostname when using LetsEncrypt. - hostname: Option, + #[serde(default, deserialize_with = "string_or_seq")] + hostname: Vec, /// Mode for getting a cert. /// /// Possible options: 'Manual', 'LetsEncrypt'. @@ -479,6 +485,23 @@ impl TlsConfig { } } +fn string_or_seq<'de, D>(deserializer: D) -> Result, D::Error> +where + D: serde::Deserializer<'de>, +{ + #[derive(Deserialize)] + #[serde(untagged)] + enum StringOrVec { + One(String), + Many(Vec), + } + + Ok(match StringOrVec::deserialize(deserializer)? { + StringOrVec::One(s) => vec![s], + StringOrVec::Many(v) => v, + }) +} + #[derive(Debug, Clone, Default, Serialize, Deserialize)] struct Limits { /// Rate limit for accepting new connection. Unlimited if not set. @@ -614,18 +637,34 @@ async fn load_cert_config(tls: &TlsConfig) -> Result { relay::CertConfig::Manual { server_config } } CertMode::LetsEncrypt => { - let hostname = tls - .hostname - .clone() - .std_context("LetsEncrypt needs a hostname")?; + let domains = tls.hostname.clone(); + if domains.is_empty() { + bail_any!("LetsEncrypt needs at least one hostname"); + } let contact = tls .contact .clone() .std_context("LetsEncrypt needs a contact email")?; - let acme_config = AcmeConfig::letsencrypt(tls.prod_tls) - .domains(vec![hostname]) + let acme_config = if let Ok(url) = std::env::var(ENV_ACME_URL) { + AcmeConfig::new(url) + } else { + AcmeConfig::letsencrypt(tls.prod_tls) + }; + let mut acme_config = acme_config + .domains(domains) .contact(vec![format!("mailto:{contact}")]) .cache_path(tls.cert_dir()); + // Trust an additional CA for the ACME server's TLS certificate. Useful for testing + // against a local ACME server such as pebble, whose certificate is not signed by a + // publicly trusted CA. + if let Ok(ca_path) = std::env::var(ENV_ACME_CA) { + let extra_roots = CertificateDer::pem_file_iter(&ca_path) + .std_context("failed to read IROH_RELAY_ACME_CA")? + .collect::, _>>() + .std_context("failed to parse IROH_RELAY_ACME_CA")?; + acme_config = + acme_config.tls_config(CaTlsConfig::default().with_extra_roots(extra_roots)); + } relay::CertConfig::LetsEncrypt { acme_config, server_config_builder: server_config, diff --git a/iroh-relay/src/protos/common.rs b/iroh-relay/src/protos/common.rs index 9dfccabadc..e25f43c9fa 100644 --- a/iroh-relay/src/protos/common.rs +++ b/iroh-relay/src/protos/common.rs @@ -39,8 +39,7 @@ pub enum FrameType { /// /// 32B pub key of peer that's gone EndpointGone = 8, - /// Messages with these frames will be ignored. - /// 8 byte ping payload, to be echoed back in FrameType::Pong + /// 8 byte ping payload, to be echoed back in a [`FrameType::Pong`]. Ping = 9, /// 8 byte payload, the contents of ping being replied to Pong = 10, diff --git a/iroh-relay/src/protos/handshake.rs b/iroh-relay/src/protos/handshake.rs index f7a254ec9b..4104a10955 100644 --- a/iroh-relay/src/protos/handshake.rs +++ b/iroh-relay/src/protos/handshake.rs @@ -377,16 +377,12 @@ pub(crate) async fn clientside( } } -/// This represents successful authentication for the client with the `client_key` public key -/// via the authentication [`Mechanism`] `mechanism`. -/// -/// You must call [`SuccessfulAuthentication::authorize_if`] to finish the protocol. -#[cfg(feature = "server")] /// Result of a successful authentication handshake. /// /// This struct represents a client that has successfully authenticated itself to the relay /// server. The authorization must still be confirmed by calling [`Self::authorize_if`] to /// complete the protocol and notify the client of success or failure. +#[cfg(feature = "server")] #[derive(Debug)] #[must_use = "the protocol is not finished unless `authorize_if` is called"] pub struct SuccessfulAuthentication { diff --git a/iroh-relay/src/server.rs b/iroh-relay/src/server.rs index 430387c11d..8e607271a5 100644 --- a/iroh-relay/src/server.rs +++ b/iroh-relay/src/server.rs @@ -58,6 +58,7 @@ use crate::{ defaults::DEFAULT_KEY_CACHE_CAPACITY, http::{AUTH_TOKEN_URL_QUERY_PARAM, ProtocolVersion, RELAY_PROBE_PATH}, quic::server::{QuicServer, QuicSpawnError, ServerHandle as QuicServerHandle}, + tls::CaTlsConfig, }; pub mod client; @@ -465,7 +466,7 @@ pub struct TlsConfig { /// the main relay server this has to be on a different port. When TLS is not enabled /// this is served on the [`RelayConfig::http_bind_addr`] socket address. /// - /// Normally you'd choose port `80`. + /// Normally you'd choose port `443`. pub https_bind_addr: SocketAddr, /// Mode for getting a cert. pub cert: CertConfig, @@ -486,12 +487,16 @@ impl TlsConfig { #[derive(Debug, Default)] #[non_exhaustive] pub struct Limits { - /// Rate limit for accepting new connection. Unlimited if not set. - pub accept_conn_limit: Option, - /// Burst limit for accepting new connection. Unlimited if not set. - pub accept_conn_burst: Option, /// Rate limits for incoming traffic from a client connection. pub client_rx: Option, + /// Rate limit for accepting new connections. Unlimited if not set. + /// + /// Not currently implemented, setting this has no effect. + pub accept_conn_limit: Option, + /// Burst limit for accepting new connections. Unlimited if not set. + /// + /// Not currently implemented, setting this has no effect. + pub accept_conn_burst: Option, } /// Per-client rate limit configuration. @@ -545,6 +550,7 @@ pub struct AcmeConfig { pub(crate) domains: Vec, pub(crate) contact: Vec, pub(crate) cache_path: Option, + pub(crate) tls_config: CaTlsConfig, } impl AcmeConfig { @@ -555,6 +561,7 @@ impl AcmeConfig { domains: Vec::new(), contact: Vec::new(), cache_path: None, + tls_config: CaTlsConfig::default(), } } @@ -589,6 +596,16 @@ impl AcmeConfig { self.cache_path = Some(path); self } + + /// Sets the [`CaTlsConfig`] used to verify the ACME server's TLS certificate. + /// + /// Defaults to [`CaTlsConfig::embedded`]. Set a config with extra roots when targeting + /// an ACME server whose certificate is not signed by a publicly trusted CA, such as a + /// local test server. + pub fn tls_config(mut self, tls_config: CaTlsConfig) -> Self { + self.tls_config = tls_config; + self + } } /// A running Relay + QAD server. @@ -632,6 +649,11 @@ pub enum SpawnError { TlsHeaderParse { source: InvalidHeaderValue }, #[error("Failed to bind TcpListener")] BindTlsListener { source: std::io::Error }, + #[error("Failed to build ACME client TLS config")] + AcmeClientTlsConfig { + #[error(std_err)] + source: std::io::Error, + }, #[error("No local address")] NoLocalAddr { source: std::io::Error }, #[error("Failed to bind server socket to {addr}")] @@ -727,11 +749,20 @@ impl Server { server_config_builder, } => { let cache = acme_config.cache_path.map(DirCache::new); + let crypto_provider = + server_config_builder.crypto_provider().clone(); + let client_tls_config = acme_config + .tls_config + .client_config(crypto_provider) + .map_err(|err| e!(SpawnError::AcmeClientTlsConfig, err))?; let config = - tokio_rustls_acme::AcmeConfig::new(acme_config.domains) - .contact(acme_config.contact) - .directory(acme_config.directory_url) - .cache_option(cache); + tokio_rustls_acme::AcmeConfig::new_with_client_tls_config( + acme_config.domains, + Arc::new(client_tls_config), + ) + .contact(acme_config.contact) + .directory(acme_config.directory_url) + .cache_option(cache); let mut state = config.state(); let resolver = state.resolver().clone(); let server_config = diff --git a/iroh-relay/src/server/client.rs b/iroh-relay/src/server/client.rs index aa0df70e4d..7d59088516 100644 --- a/iroh-relay/src/server/client.rs +++ b/iroh-relay/src/server/client.rs @@ -42,7 +42,7 @@ pub(super) struct Packet { data: Datagrams, } -/// Configuration for a [`Client`]. +/// Configuration for a client connection. /// /// Generic over the stream type to support different WebSocket implementations. #[derive(Debug)] diff --git a/iroh-relay/src/server/clients.rs b/iroh-relay/src/server/clients.rs index bc791ee252..13a9d90abd 100644 --- a/iroh-relay/src/server/clients.rs +++ b/iroh-relay/src/server/clients.rs @@ -21,12 +21,11 @@ use crate::{ server::{client::SendError, metrics::Metrics}, }; -/// Manages the connections to all currently connected clients. -#[derive(Debug, Clone, Default)] /// Registry of connected relay clients. /// /// This type manages the collection of active client connections and /// handles routing messages between them. +#[derive(Debug, Clone, Default)] pub struct Clients(Arc); #[derive(Debug, Default)] diff --git a/iroh-relay/src/server/metrics.rs b/iroh-relay/src/server/metrics.rs index d6c8da5166..bfdbb1e1df 100644 --- a/iroh-relay/src/server/metrics.rs +++ b/iroh-relay/src/server/metrics.rs @@ -10,40 +10,60 @@ pub struct Metrics { /* * Metrics about packets */ - /// Bytes sent from a `FrameType::SendPacket` + /// Bytes sent to a client in [`RelayToClientDatagram`] or [`RelayToClientDatagramBatch`] frames. + /// + /// [`RelayToClientDatagram`]: crate::protos::common::FrameType::RelayToClientDatagram + /// [`RelayToClientDatagramBatch`]: crate::protos::common::FrameType::RelayToClientDatagramBatch #[metrics(help = "Number of bytes sent.")] pub bytes_sent: Counter, - /// Bytes received from a `FrameType::SendPacket` + /// Bytes received from a client in [`ClientToRelayDatagram`] or [`ClientToRelayDatagramBatch`] frames. + /// + /// [`ClientToRelayDatagram`]: crate::protos::common::FrameType::ClientToRelayDatagram + /// [`ClientToRelayDatagramBatch`]: crate::protos::common::FrameType::ClientToRelayDatagramBatch #[metrics(help = "Number of bytes received.")] pub bytes_recv: Counter, - /// `FrameType::SendPacket` sent + /// [`RelayToClientDatagram`] or [`RelayToClientDatagramBatch`] frames sent to a client. + /// + /// [`RelayToClientDatagram`]: crate::protos::common::FrameType::RelayToClientDatagram + /// [`RelayToClientDatagramBatch`]: crate::protos::common::FrameType::RelayToClientDatagramBatch #[metrics(help = "Number of 'send' packets relayed.")] pub send_packets_sent: Counter, - /// `FrameType::SendPacket` received + /// [`ClientToRelayDatagram`] or [`ClientToRelayDatagramBatch`] frames received from a client. + /// + /// [`ClientToRelayDatagram`]: crate::protos::common::FrameType::ClientToRelayDatagram + /// [`ClientToRelayDatagramBatch`]: crate::protos::common::FrameType::ClientToRelayDatagramBatch #[metrics(help = "Number of 'send' packets received.")] pub send_packets_recv: Counter, - /// `FrameType::SendPacket` dropped + /// [`RelayToClientDatagram`] or [`RelayToClientDatagramBatch`] frames dropped instead of being + /// delivered to a client, because the recipient is not connected or writing to its stream failed. + /// + /// Note that frames dropped because the recipient's send queue is full or closed are not counted + /// here. + /// + /// [`RelayToClientDatagram`]: crate::protos::common::FrameType::RelayToClientDatagram + /// [`RelayToClientDatagramBatch`]: crate::protos::common::FrameType::RelayToClientDatagramBatch #[metrics(help = "Number of 'send' packets dropped.")] pub send_packets_dropped: Counter, - /// Packets of other `FrameType`s sent + /// Intended to count sent frames other than datagrams, but currently unused (never incremented). #[metrics(help = "Number of packets sent that were not 'send' packets")] pub other_packets_sent: Counter, - /// Packets of other `FrameType`s received + /// Intended to count received frames other than datagrams, but currently unused (never incremented). #[metrics(help = "Number of packets received that were not 'send' packets")] pub other_packets_recv: Counter, - /// Packets of other `FrameType`s dropped + /// Intended to count dropped frames other than datagrams, but currently unused (never incremented). #[metrics(help = "Number of times, non-send packet was dropped.")] pub other_packets_dropped: Counter, - /// Number of `FrameType::Ping`s received + /// Number of [`FrameType::Ping`](crate::protos::common::FrameType::Ping) frames received from a client. #[metrics(help = "Number of times the server has received a Ping from a client.")] pub got_ping: Counter, - /// Number of `FrameType::Pong`s sent + /// Number of [`FrameType::Pong`](crate::protos::common::FrameType::Pong) frames sent to a client. #[metrics(help = "Number of times the server has sent a Pong to a client.")] pub sent_pong: Counter, - /// Number of `FrameType::Unknown` received + /// Intended to count received frames with an unrecognized [`FrameType`](crate::protos::common::FrameType), + /// but currently unused (never incremented). #[metrics(help = "Number of unknown frames sent to this server.")] pub unknown_frames: Counter, @@ -57,7 +77,9 @@ pub struct Metrics { */ /// Number of times this server has accepted a connection. pub accepts: Counter, - /// Number of connections we have removed because of an error + /// Number of times a client connection was disconnected. + /// + /// Incremented once per connection, paired with [`Self::accepts`]. #[metrics(help = "Number of clients that have then disconnected.")] pub disconnects: Counter, diff --git a/iroh-relay/src/server/streams.rs b/iroh-relay/src/server/streams.rs index 32718e0648..395ed5dea6 100644 --- a/iroh-relay/src/server/streams.rs +++ b/iroh-relay/src/server/streams.rs @@ -324,8 +324,8 @@ impl AsyncWrite for MaybeTlsStream { /// /// The writes to the sink are not rate limited. /// -/// This potentially buffers one frame if the rate limiter does not allows this frame. -/// While the frame is buffered the undernlying stream is no longer polled. +/// This potentially buffers one frame if the rate limiter does not allow this frame. +/// While the frame is buffered the underlying stream is no longer polled. #[derive(Debug)] pub(crate) struct RateLimited { inner: S, diff --git a/iroh-relay/src/tls.rs b/iroh-relay/src/tls.rs index 80e317ddbb..2b3f254970 100644 --- a/iroh-relay/src/tls.rs +++ b/iroh-relay/src/tls.rs @@ -217,7 +217,7 @@ impl CaTlsConfig { /// Function to build a [`ServerCertVerifier`] from a [`CryptoProvider`]. /// -/// See [`CaTlsConfig::custom_server_cert_verifier]. +/// See [`CaTlsConfig::custom_server_cert_verifier`]. pub type ServerCertVerifierBuilder = Arc< dyn Fn(Arc) -> io::Result> + Send + Sync + 'static, >; diff --git a/iroh-relay/tests/multiple-hostnames-pebble.sh b/iroh-relay/tests/multiple-hostnames-pebble.sh new file mode 100755 index 0000000000..5271eccb99 --- /dev/null +++ b/iroh-relay/tests/multiple-hostnames-pebble.sh @@ -0,0 +1,164 @@ +#!/usr/bin/env bash +# +# End-to-end test for iroh-relay multi-hostname ACME support against a local +# pebble ACME server, exercising real TLS-ALPN-01 challenge validation. +# +# Starts pebble, then iroh-relay in LetsEncrypt cert mode pointed at pebble via +# IROH_RELAY_ACME_URL / IROH_RELAY_ACME_CA, and checks with curl that: +# - every configured hostname is served a cert signed by pebble's CA, +# - an unconfigured hostname is refused at the TLS handshake, and +# - pebble actually completed a challenge (no PEBBLE_VA_ALWAYS_VALID). +# +# pebble's validation authority resolves each hostname and connects back to the +# relay's TLS-ALPN-01 responder. Two things make that callback reach the relay: +# pebble's validation TLS port is set to the relay's HTTPS port, and an +# /etc/hosts mounted into the pebble container maps each hostname to 127.0.0.1 +# (pebble reads it through its system resolver, so no separate DNS server is +# needed). Host networking lets pebble's loopback reach the relay's listener. +# +# Exits 0 if all checks pass, 1 otherwise. +# +# Requirements: docker (Linux host networking), curl, jq, the iroh-relay sources. + +set -euo pipefail + +PEBBLE_IMAGE="${PEBBLE_IMAGE:-ghcr.io/letsencrypt/pebble:latest}" +RELAY_HTTP_PORT="${RELAY_HTTP_PORT:-8080}" +RELAY_HTTPS_PORT="${RELAY_HTTPS_PORT:-8443}" + +# The workdir is always a fresh mktemp directory, never taken from the +# environment. This is what keeps cleanup safe: nothing here can ever delete a +# path the user supplied, no matter how the environment is set. The pebble +# container name is derived from it, so a run never force-removes a container it +# did not create. +WORK="$(mktemp -d "${TMPDIR:-/tmp}/iroh-relay-pebble.XXXXXXXX")" +PEBBLE_NAME="${PEBBLE_NAME:-$(basename "$WORK")}" + +# Reject non-numeric ports so a bad value cannot leak into the generated config +# or the jq program further down. +case "${RELAY_HTTP_PORT}:${RELAY_HTTPS_PORT}" in + *[!0-9:]*) echo "RELAY_HTTP_PORT and RELAY_HTTPS_PORT must be numeric" >&2; exit 1 ;; +esac + +# Hostnames the relay is configured to serve, plus one it is not. +HOSTS=(relay-a.localhost relay-b.localhost) +HOST_BAD=relay-evil.localhost + +PEBBLE_DIR_URL="https://localhost:14000/dir" +PEBBLE_MGMT_URL="https://localhost:15000" + +log() { printf '\n=== %s ===\n' "$*"; } +ok() { printf ' [ ok ] %s\n' "$*"; } +fail() { + printf '\n [FAIL] %s\n' "$*" >&2 + [ -f "$WORK/relay.log" ] && { echo "--- relay.log (tail) ---" >&2; tail -n 30 "$WORK/relay.log" >&2; } + docker logs "$PEBBLE_NAME" >/dev/null 2>&1 && { echo "--- pebble.log (tail) ---" >&2; docker logs "$PEBBLE_NAME" 2>&1 | tail -20 >&2; } + exit 1 +} + +RELAY_PID="" +cleanup() { + set +e + [ -n "$RELAY_PID" ] && kill "$RELAY_PID" 2>/dev/null + docker rm -f "$PEBBLE_NAME" >/dev/null 2>&1 +} +trap cleanup EXIT + +# curl the relay over HTTPS for a given hostname. --fail turns a non-2xx or TLS +# error into a non-zero exit; --resolve pins the SNI hostname to loopback. +curl_relay() { + curl -s --fail --max-time 5 -o /dev/null \ + --cacert "$WORK/pebble-issuer-root.pem" \ + --resolve "$1:${RELAY_HTTPS_PORT}:127.0.0.1" \ + "https://$1:${RELAY_HTTPS_PORT}/healthz" +} + +# --- start pebble ------------------------------------------------------------ + +mkdir -p "$WORK/certs" + +{ echo "127.0.0.1 localhost"; echo "::1 localhost" + for host in "${HOSTS[@]}"; do echo "127.0.0.1 $host"; done; } > "$WORK/hosts" + +log "starting pebble ($PEBBLE_IMAGE)" +# Derive pebble's config from the image default, setting its TLS-ALPN-01 +# validation port to the relay's HTTPS port so the callback lands on the relay. +cid=$(docker create "$PEBBLE_IMAGE") +docker cp "$cid:/test/config/pebble-config.json" "$WORK/pebble-config.in.json" >/dev/null +docker rm "$cid" >/dev/null +jq ".pebble.tlsPort = ${RELAY_HTTPS_PORT}" "$WORK/pebble-config.in.json" > "$WORK/pebble-config.json" + +docker run -d --rm --name "$PEBBLE_NAME" --network host \ + -e PEBBLE_VA_NOSLEEP=1 -e PEBBLE_WFE_NONCEREJECT=0 \ + -v "$WORK/pebble-config.json:/pebble-config.json:ro" \ + -v "$WORK/hosts:/etc/hosts:ro" \ + "$PEBBLE_IMAGE" -config /pebble-config.json >/dev/null + +for i in $(seq 1 30); do + curl -sk -o /dev/null "$PEBBLE_DIR_URL" && break + [ "$i" = 30 ] && fail "pebble did not come up" + sleep 0.5 +done +ok "pebble up (validation port = ${RELAY_HTTPS_PORT})" + +# pebble.minica.pem signs pebble's own ACME/management TLS, so the relay must +# trust it (IROH_RELAY_ACME_CA). The certs pebble *issues* chain to a separate +# root served by the management interface, which curl needs to verify the relay. +docker cp "$PEBBLE_NAME:/test/certs/pebble.minica.pem" "$WORK/pebble.minica.pem" >/dev/null +curl -s --cacert "$WORK/pebble.minica.pem" "$PEBBLE_MGMT_URL/roots/0" -o "$WORK/pebble-issuer-root.pem" +ok "fetched pebble CAs" + +# --- start relay ------------------------------------------------------------- + +hostnames=$(printf '"%s", ' "${HOSTS[@]}") +cat > "$WORK/relay.toml" < "$WORK/relay.log" 2>&1 & +RELAY_PID=$! + +# --- checks ------------------------------------------------------------------ + +log "waiting for the relay to pass validation and provision a cert" +for i in $(seq 1 90); do + kill -0 "$RELAY_PID" 2>/dev/null || fail "relay exited early" + curl_relay "${HOSTS[0]}" 2>/dev/null && break + [ "$i" = 90 ] && fail "relay did not provision a cert in time" + sleep 1 +done +ok "relay provisioned a cert" + +log "every configured hostname serves a pebble-signed cert" +for host in "${HOSTS[@]}"; do + curl_relay "$host" || fail "$host: expected a valid pebble-signed cert" + ok "$host: served a pebble-signed cert, verified by curl" +done + +log "an unconfigured hostname is refused" +curl_relay "$HOST_BAD" 2>/dev/null && fail "$HOST_BAD: handshake unexpectedly succeeded" +ok "$HOST_BAD: TLS handshake refused, as expected" + +log "pebble ran a real challenge validation" +docker logs "$PEBBLE_NAME" 2>&1 | grep -q "set VALID by completed challenge" \ + || fail "pebble recorded no completed challenge (was validation skipped?)" +docker logs "$PEBBLE_NAME" 2>&1 | grep -E "set VALID by completed challenge|Issued certificate" | tail -4 +ok "pebble validated the TLS-ALPN-01 challenge and issued the cert" + +log "ALL CHECKS PASSED" +echo "artifacts (logs, certs, config) left in $WORK" diff --git a/iroh/Cargo.toml b/iroh/Cargo.toml index beebeb6bb5..71656e402a 100644 --- a/iroh/Cargo.toml +++ b/iroh/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iroh" -version = "1.0.0-rc.1" +version = "1.0.0" edition = "2024" readme = "README.md" description = "p2p quic connections dialed by public key" @@ -31,19 +31,19 @@ derive_more = { version = "2.0.1", features = ["debug", "display", "from", "try_ ed25519-dalek = { version = "=3.0.0-rc.0", features = ["serde", "rand_core", "zeroize", "pkcs8", "pem"] } http = "1" ipnet = "2" -iroh-base = { version = "1.0.0-rc.1", default-features = false, features = ["key", "relay"], path = "../iroh-base" } -iroh-dns = { version = "1.0.0-rc.1", path = "../iroh-dns" } -iroh-relay = { version = "1.0.0-rc.1", path = "../iroh-relay", default-features = false } +iroh-base = { version = "1.0.0", default-features = false, features = ["key", "relay"], path = "../iroh-base" } +iroh-dns = { version = "1.0.0", path = "../iroh-dns" } +iroh-relay = { version = "1.0.0", path = "../iroh-relay", default-features = false } n0-future = "0.3" -n0-error = "=1.0.0-rc.0" -n0-watcher = "=1.0.0-rc.0" -netwatch = "0.18" +n0-error = "1.0.0" +n0-watcher = "1.0.0" +netwatch = "0.19" papaya = { version = "0.2.3", default-features = false } pin-project = "1" portable-atomic = "1" -noq = { version = "=1.0.0-rc.1", default-features = false, features = ["rustls"] } -noq-proto = { version = "=1.0.0-rc.1", default-features = false } -noq-udp = { version = "=1.0.0-rc.1", default-features = false } +noq = { version = "1.0.0", default-features = false, features = ["rustls"] } +noq-proto = { version = "1.0.0", default-features = false } +noq-udp = { version = "1.0.0", default-features = false } rand = "0.10" reqwest = { version = "0.13", default-features = false, features = ["rustls-no-provider", "stream"] } rustc-hash = "2" @@ -61,12 +61,10 @@ tokio-stream = { version = "0.1.15", features = ["sync"] } tokio-util = { version = "0.7", features = ["io-util", "io", "rt"] } tracing = "0.1" url = { version = "2.5", features = ["serde"] } -webpki = { package = "rustls-webpki", version = "0.103.7", default-features = false, features = ["std"] } webpki_types = { package = "rustls-pki-types", version = "1.12" } -webpki-roots = "1.0.3" # metrics -iroh-metrics = { version = "=1.0.0-rc.0", default-features = false } +iroh-metrics = { version = "1.0.1", default-features = false } futures-util = "0.3" @@ -75,8 +73,8 @@ axum = { version = "0.8", optional = true } # non-wasm-in-browser dependencies [target.'cfg(not(all(target_family = "wasm", target_os = "unknown")))'.dependencies] -portmapper = { version = "0.18", optional = true, default-features = false } -noq = { version = "=1.0.0-rc.1", default-features = false, features = ["runtime-tokio", "rustls"] } +portmapper = { version = "0.19", optional = true, default-features = false } +noq = { version = "1.0.0", default-features = false, features = ["runtime-tokio", "rustls"] } tokio = { version = "1", features = [ "io-util", "macros", @@ -98,7 +96,7 @@ getrandom = { version = "0.4", features = ["wasm_js"] } # target-common test/dev dependencies [dev-dependencies] console_error_panic_hook = "0.1" -n0-error = { version = "=1.0.0-rc.0", features = ["anyhow"] } +n0-error = { version = "1.0.0", features = ["anyhow"] } postcard = { version = "1.1.1", features = ["use-std"] } tracing-subscriber = { version = "0.3", features = ["env-filter"] } rand_chacha = "0.10" @@ -121,7 +119,7 @@ tokio = { version = "1", features = [ "test-util", ] } serde_json = "1" -iroh-relay = { version = "1.0.0-rc.1", path = "../iroh-relay", default-features = false, features = ["test-utils", "server"] } +iroh-relay = { version = "1.0.0", path = "../iroh-relay", default-features = false, features = ["test-utils", "server"] } n0-tracing-test = "0.3" clap = { version = "4", features = ["derive"] } tracing-subscriber = { version = "0.3", features = [ @@ -129,7 +127,7 @@ tracing-subscriber = { version = "0.3", features = [ ] } indicatif = { version = "0.18", features = ["tokio"] } parse-size = { version = "1.1.0", features = ['std'] } -iroh-base = { version = "1.0.0-rc.1", default-features = false, features = ["key", "relay"], path = "../iroh-base" } +iroh-base = { version = "1.0.0", default-features = false, features = ["key", "relay"], path = "../iroh-base" } console = { version = "0.16" } # wasm-in-browser test/dev dependencies @@ -140,7 +138,7 @@ wasm-bindgen-test = "0.3.62" # patchbay netsim test dependencies (linux only) [target.'cfg(target_os = "linux")'.dev-dependencies] ctor = "1.0" -patchbay = { version = "0.5", features = ["iroh-metrics"] } +patchbay = { version = "0.6", features = ["iroh-metrics"] } testdir = "0.10" [build-dependencies] @@ -157,11 +155,13 @@ qlog = ["noq/qlog"] # Use private Apple APIs to send multiple packets in a single syscall. fast-apple-datapath = ["noq/fast-apple-datapath"] # Use ring as the crypto backend. -tls-ring = ["noq/ring", "iroh-relay/tls-ring", "iroh-dns/tls-ring", "webpki/ring"] +tls-ring = ["noq/ring", "iroh-relay/tls-ring", "iroh-dns/tls-ring"] # Use aws-lc-rs as the crypto backend, unless `ring` is also enabled. -tls-aws-lc-rs = ["noq/aws-lc-rs", "iroh-relay/tls-aws-lc-rs", "iroh-dns/tls-aws-lc-rs", "webpki/aws-lc-rs"] +tls-aws-lc-rs = ["noq/aws-lc-rs", "iroh-relay/tls-aws-lc-rs", "iroh-dns/tls-aws-lc-rs"] # Unstable: Custom transport API (may change without notice) unstable-custom-transports = [] +# Unstable: API to access an endpoint's NetReport (may change without notice) +unstable-net-report = [] [package.metadata.docs.rs] all-features = true diff --git a/iroh/DEVELOPMENT.md b/iroh/DEVELOPMENT.md new file mode 100644 index 0000000000..77d030c511 --- /dev/null +++ b/iroh/DEVELOPMENT.md @@ -0,0 +1,49 @@ +# Developing iroh + +## Structured events + +The library uses [tracing] both for logging and for *structured events*. +Events differ from normal logging by convention: + +- The [target] is prefixed with `iroh::_events::`, with `::`-separated names. +- There is **no message**; the unique target indicates the meaning. +- The [fields] carry exclusively structured data. +- The [Level] is always `DEBUG`. + +This lets automated tooling process events through custom subscribers while +still producing distinct output under the default tracing formatters, and makes +them unlikely to conflict with real modules. + +An application can subscribe to the `iroh::_events` target separately. With the +default file logging it is also easy to grep for all events: + +```sh +rg 'events::[a-z_\-:]+' path/to/iroh/logs/iroh.YYYY-MM-DD-NN.log +``` + +When adding events, aim for a high signal-to-noise ratio and design them to be +extracted automatically. To keep them distinct from normal logging, write them +with the `event!()` macro: + +```rust,ignore +event!( + target: "iroh::_events::subject", + Level::DEBUG, + field = value, +); +``` + +## Building documentation + +Building the documentation is only supported with `--all-features`. To also +document the cargo features required for certain APIs, pass the `iroh_docsrs` +cfg to rustdoc, which requires nightly Rust: + +```sh +RUSTDOCFLAGS="--cfg iroh_docsrs" cargo +nightly doc --workspace --no-deps --all-features +``` + +[target]: https://docs.rs/tracing/latest/tracing/struct.Metadata.html#method.target +[fields]: https://docs.rs/tracing/latest/tracing/#recording-fields +[Level]: https://docs.rs/tracing/latest/tracing/struct.Level.html +[tracing]: https://docs.rs/tracing diff --git a/iroh/README.md b/iroh/README.md index 751e705d54..35fa7cee65 100644 --- a/iroh/README.md +++ b/iroh/README.md @@ -1,91 +1,153 @@ -# iroh +

+ +iroh + +

-Iroh is a library to establish direct connectivity between peers. -It's built on peer-to-peer [QUIC](https://en.wikipedia.org/wiki/QUIC) using both relays and holepunching. -The main structure for connection is the `Endpoint` entrypoint. +

+less net work for networks +

-Peer to peer connectivity is established with the help of a _relay server_. The relay server provides [QUIC Address Discovery](https://www.ietf.org/archive/id/draft-ietf-quic-address-discovery-00.html) (QAD) and hole-punching assistance for the peers. If no direct connection can be established, the connection is relayed via the server. +[![Documentation](https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square)](https://docs.rs/iroh/) +[![Crates.io](https://img.shields.io/crates/v/iroh.svg?style=flat-square)](https://crates.io/crates/iroh) +[![Chat](https://img.shields.io/discord/1161119546170687619?logo=discord&style=flat-square)](https://discord.com/invite/DpmJgtU7cW) +[![Youtube](https://img.shields.io/badge/YouTube-red?logo=youtube&logoColor=white&style=flat-square)](https://www.youtube.com/@n0computer) +[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](LICENSE-MIT) +[![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=flat-square)](LICENSE-APACHE) -Peers must know and do verify the PeerID of each other before they can connect. When using a relay server to aid the connection establishment they will register with a home relay server using their PublicKey. Other peers which can not establish a direct connection can then establish connection via this relay server. This will try to assist establishing a direct connection using QAD and holepunching but continue relaying if not possible. + +
-Peers can also connect directly without using a relay server. For this, however the listening peer must be directly reachable by the connecting peer via one of it's addresses. +Iroh is a Rust library to establish direct connections between endpoints. +It gives you an API for dialing by public key. You say "connect to that +endpoint", and iroh finds and maintains the best connection for you. -## Examples +Under the hood iroh establishes peer-to-peer [QUIC] connections between +endpoints. The fastest route is a direct connection, so iroh tries to +[hole-punch] one whenever it can. If that fails it falls back to using +relay servers. -Examples for `iroh` are in `iroh/examples`, run them with `cargo run --example $NAME`. Details for each example are in the file/directory itself. +Because iroh is built on [QUIC], all connections are end-to-end encrypted and may +carry any number of concurrent streams. Dialing by public key also makes them mutually +authenticated, because each endpoint's public key is its TLS identity. -## Structured Events +## Overview -The library uses [tracing](https://docs.rs/tracing) to for logging as -well as for **structured events**. Events are different from normal -logging by convention: +An iroh endpoint is created and controlled by the [`Endpoint`]. Each endpoint +has a unique [`SecretKey`], whose public key is the endpoint's identity, the +[`EndpointId`]. Connections are authenticated against this key, which means an +[`EndpointId`] can't be impersonated. -- The [target] has a prefix of `$crate_name::_events` and target names - are `::` separated. +A connection is usually established with the help of a *relay server*. When an +endpoint is created it connects to the closest relay and designates it as its +*home relay*. Other endpoints reach it first through this relay, then both +sides use QUIC NAT traversal to establish a direct connection. In the rare +cases where a direct connection is not possible, traffic keeps flowing over the +relay. - For this library the target will always start with `iroh::_events::`. +Relay servers only forward encrypted packets addressed to Endpoint IDs, they +cannot read any traffic between endpoints. -- There is **no message**. +Endpoints can also connect directly without a relay, as long as the accepting +endpoint is directly reachable at one of its addresses. - Each event has a unique [target] which indicates the meaning. +To discover addressing information for an endpoint, iroh uses +[address lookup services]. With address lookup, you can connect to other +endpoints with only their [`EndpointId`]. Addressing information will then +be resolved on-demand. -- The event [fields] are exclusively used for structured data. +The [`N0` preset] installs the DNS/Pkarr address lookup service, which uses +servers hosted by [n0] to provide global lookup for endpoints. -- The [Level] is always `DEBUG`. +## Example -This is a compromise between being able to process events using -automated tooling using custom subscribers and them still producing -distinguishing output in logs when using the default tracing -subscriber formatters. While still being unlikely to conflict with -real modules. - -[target]: https://docs.rs/tracing/latest/tracing/struct.Metadata.html#method.target -[fields]: https://docs.rs/tracing/latest/tracing/#recording-fields -[Level]: https://docs.rs/tracing/latest/tracing/struct.Level.html - -### Using events - -If desired an application can use the `$crate_name::_events` target to -handle events by a different subscriber. However with the default -file logging it is already easy to search for all events, e.g. using -ripgrep: - -`rg 'events::[a-z_\-:]+' path/to/iroh/logs/iroh.YYYY-MM-DD-NN.log` - -Which will also highlight the full target name by default on a colour -supporting terminal. - -### Development - -Be cautious about adding new events. Events aim for a high -signal-to-noise ratio. Events should be designed to be able to -extract in an automated way. If multiple events need to be related, -fields with special values can be used. - -To make events distinct from normal logging in the code it is -recommended to write them using the `event!()` macro: +This is an echo protocol: the accepting side copies back whatever it receives. +The full, commented version is in [`echo.rs`](examples/echo.rs). ```rust -event!( - target: "iroh::_event::subject", - Level::DEBUG, - field = value, -); +use iroh::{ + Endpoint, + endpoint::{Connection, presets}, + protocol::{AcceptError, ProtocolHandler, Router}, +}; + +/// Each protocol is identified by its ALPN, exchanged during the handshake. +const ALPN: &[u8] = b"iroh-example/echo/0"; + +#[tokio::main] +async fn main() -> anyhow::Result<()> { + // The accepting side: bind an endpoint and route the ALPN to a handler. + let endpoint = Endpoint::bind(presets::N0).await?; + let router = Router::builder(endpoint.clone()).accept(ALPN, Echo).spawn(); + endpoint.online().await; + // Get the endpoint's address so that we can connect to it. + let addr = endpoint.addr(); + + // The connecting side: dial the accepting endpoint by its address. + { + let other_endpoint = Endpoint::bind(presets::N0).await?; + + let conn = other_endpoint.connect(addr, ALPN).await?; + let (mut send, mut recv) = conn.open_bi().await?; + send.write_all(b"Hello, world!").await?; + send.finish()?; + let response = recv.read_to_end(1000).await?; + assert_eq!(&response, b"Hello, world!"); + conn.close(0u32.into(), b"bye!"); + + other_endpoint.close().await; + } + + router.shutdown().await?; + Ok(()) +} + +#[derive(Debug, Clone)] +struct Echo; + +impl ProtocolHandler for Echo { + async fn accept(&self, connection: Connection) -> Result<(), AcceptError> { + let (mut send, mut recv) = connection.accept_bi().await?; + // Echo bytes back until the sender signals the end of data. + tokio::io::copy(&mut recv, &mut send).await?; + send.finish()?; + // Wait until the other endpoint closes the connection. + connection.closed().await; + Ok(()) + } +} ``` -## Building documentation +More examples live in [`iroh/examples`](examples). Run them with +`cargo run --example NAME`. Details for each are in the file itself. -Building the documentation is only supported when using -`--all-features`. +## Compose protocols -Additionally you might want to enable documenting the cargo features -required for certain APIs, which is done by also passing the `--cfg -iroh_docsrs` flag to rustdoc when building the documentation. This -also requires using nightly rust, e.g.: +Instead of writing your own, you can build on protocols that already exist on +top of iroh: -```sh -RUSTDOCFLAGS="--cfg iroh_docsrs" cargo +nightly doc --workspace --no-deps --all-features -``` +- [iroh-blobs] for [BLAKE3]-based content-addressed blob transfer, scaling from + kilobytes to terabytes. +- [iroh-gossip] for publish-subscribe overlay networks that scale down to what + an average phone can handle. +- and many more. + +To use iroh from other languages, see [iroh-ffi]. + +## Development + +For notes on iroh's structured events and how to build the documentation, see +[DEVELOPMENT.md](DEVELOPMENT.md). # License @@ -100,6 +162,22 @@ at your option. ### Contribution +See [CONTRIBUTING.md](https://github.com/n0-computer/iroh/blob/main/CONTRIBUTING.md) +for how to get involved. + Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. + +[QUIC]: https://en.wikipedia.org/wiki/QUIC +[hole-punch]: https://en.wikipedia.org/wiki/Hole_punching_(networking) +[BLAKE3]: https://github.com/BLAKE3-team/BLAKE3 +[`Endpoint`]: https://docs.rs/iroh/latest/iroh/struct.Endpoint.html +[`SecretKey`]: https://docs.rs/iroh/latest/iroh/struct.SecretKey.html +[`EndpointId`]: https://docs.rs/iroh/latest/iroh/struct.EndpointId.html +[address lookup services]: https://docs.rs/iroh/latest/iroh/address_lookup/index.html +[`N0` preset]: https://docs.rs/iroh/latest/iroh/endpoint/presets/struct.N0.html +[iroh-blobs]: https://github.com/n0-computer/iroh-blobs +[iroh-gossip]: https://github.com/n0-computer/iroh-gossip +[iroh-ffi]: https://github.com/n0-computer/iroh-ffi +[n0]: https://n0.computer diff --git a/iroh/bench/Cargo.toml b/iroh/bench/Cargo.toml index 5b9089c236..1e1cd06e82 100644 --- a/iroh/bench/Cargo.toml +++ b/iroh/bench/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "iroh-bench" -version = "1.0.0-rc.1" +version = "1.0.0" edition = "2024" license = "MIT OR Apache-2.0" publish = false @@ -8,12 +8,11 @@ publish = false [dependencies] bytes = "1.11" hdrhistogram = { version = "7.2", default-features = false } -iroh = { version = "1.0.0-rc.1", path = "..", default-features = false } -iroh-metrics = { version = "=1.0.0-rc.0", optional = true } +iroh = { version = "1.0.0", path = "..", default-features = false } +iroh-metrics = { version = "1.0.1", optional = true } n0-future = "0.3" -n0-error = "=1.0.0-rc.0" -noq = "=1.0.0-rc.1" -rand = "0.10" +n0-error = "1.0.0" +noq = "1.0.0" rcgen = "0.14" rustls = { version = "0.23.33", default-features = false } clap = { version = "4", features = ["derive"] } diff --git a/iroh/examples/echo-no-router.rs b/iroh/examples/echo-no-router.rs index 6dd6247629..c5c9796693 100644 --- a/iroh/examples/echo-no-router.rs +++ b/iroh/examples/echo-no-router.rs @@ -5,7 +5,7 @@ //! //! ## Running the Example //! -//! cargo run --example echo-no-router --features=examples +//! cargo run --example echo-no-router use iroh::{Endpoint, EndpointAddr, endpoint::presets}; use n0_error::{AnyError as Error, Result, StdResultExt}; diff --git a/iroh/examples/echo.rs b/iroh/examples/echo.rs index 24c47c2fbd..dd6b2cb34d 100644 --- a/iroh/examples/echo.rs +++ b/iroh/examples/echo.rs @@ -4,7 +4,7 @@ //! //! ## Usage //! -//! cargo run --example echo --features=examples +//! cargo run --example echo use iroh::{ Endpoint, EndpointAddr, diff --git a/iroh/examples/screening-connection.rs b/iroh/examples/screening-connection.rs index 3257f7365e..076c51d602 100644 --- a/iroh/examples/screening-connection.rs +++ b/iroh/examples/screening-connection.rs @@ -6,7 +6,7 @@ //! //! ## Usage //! -//! cargo run --example screening-connection --features=examples +//! cargo run --example screening-connection use std::sync::{ Arc, atomic::{AtomicU64, Ordering}, diff --git a/iroh/examples/search.rs b/iroh/examples/search.rs index 2af768e834..b89e26831f 100644 --- a/iroh/examples/search.rs +++ b/iroh/examples/search.rs @@ -11,13 +11,13 @@ //! //! In one terminal, run //! -//! cargo run --example search --features=examples -- listen "hello-world" "foo-bar" "hello-moon" +//! cargo run --example search -- listen "hello-world" "foo-bar" "hello-moon" //! //! This spawns an iroh endpoint with three blobs. It will print the endpoint's endpoint id. //! //! In another terminal, run //! -//! cargo run --example search --features=examples -- query hello +//! cargo run --example search -- query hello //! //! Replace with the endpoint id from above. This will connect to the listening endpoint with our //! protocol and query for the string `hello`. The listening endpoint will return a number of how many diff --git a/iroh/src/address_lookup.rs b/iroh/src/address_lookup.rs index 94cf330e24..394e919e2c 100644 --- a/iroh/src/address_lookup.rs +++ b/iroh/src/address_lookup.rs @@ -3,10 +3,10 @@ //! To connect to an iroh endpoint a [`EndpointAddr`] is needed, which may contain a //! [`RelayUrl`] or one or more *direct addresses* in addition to the [`EndpointId`]. //! -//! Since there is a conversion from [`EndpointId`] to [`EndpointAddr`], you can also use +//! Since there is a conversion from [`EndpointId`] to [`EndpointAddr`], you can also //! connect directly with a [`EndpointId`]. //! -//! For this to work however, the endpoint has to get the addressing information by +//! For this to work however, the endpoint has to get the addressing information by //! other means. //! //! [`AddressLookup`] is an automated system for an [`Endpoint`] to retrieve this addressing @@ -50,9 +50,9 @@ //! [`iroh-mdns-address-lookup`]: https://docs.rs/iroh-mdns-address-lookup //! [`iroh-mainline-address-lookup`]: https://docs.rs/iroh-mainline-address-lookup //! -//! To use multiple Address Lookup'ssimultaneously you can call [`Builder::address_lookup`]. +//! To use multiple Address Lookups simultaneously you can call [`Builder::address_lookup`]. //! This will use [`AddressLookupServices`] under the hood, which performs lookups to all -//! Address Lookupsystems at the same time. +//! Address Lookup systems at the same time. //! //! [`Builder::address_lookup`] takes any type that implements [`AddressLookupBuilder`]. You can //! implement that trait on a builder struct if your Address Lookup needs information @@ -60,8 +60,8 @@ //! is built by calling [`AddressLookupBuilder::into_address_lookup`], passing the finished [`Endpoint`] to your //! builder. //! -//! If your Address Lookupdoes not need any information from its endpoint, you can -//! pass the Address Lookupservice directly to [`Builder::address_lookup`]: All types that +//! If your Address Lookup does not need any information from its endpoint, you can +//! pass the Address Lookup service directly to [`Builder::address_lookup`]: All types that //! implement [`AddressLookup`] also have a blanket implementation of [`AddressLookupBuilder`]. //! //! # Examples @@ -334,7 +334,7 @@ pub trait AddressLookup: std::fmt::Debug + Send + Sync + 'static { /// Publishes the given [`EndpointData`] to the Address Lookup mechanism. /// /// This is fire and forget, since the [`Endpoint`] can not wait for successful - /// publishing. If publishing is async, the implementation should start it's own task. + /// publishing. If publishing is async, the implementation should start its own task. /// /// This will be called from a tokio task, so it is safe to spawn new tasks. /// These tasks will be run on the runtime of the [`super::Endpoint`]. @@ -369,7 +369,7 @@ impl AddressLookup for Arc { /// directly from [`Item`]. #[derive(Debug, Clone, Eq, PartialEq)] pub struct Item { - /// The endpoint info for the endpoint, as discovered by the the Address Lookup. + /// The endpoint info for the endpoint, as discovered by the Address Lookup. endpoint_info: EndpointInfo, /// A static string to identify the Address Lookup source. /// @@ -421,12 +421,12 @@ impl Item { self.last_updated } - /// Converts into a [`EndpointAddr`] by cloning the needed fields. + /// Returns an [`EndpointAddr`] by cloning the needed fields. pub fn to_endpoint_addr(&self) -> EndpointAddr { self.endpoint_info.to_endpoint_addr() } - /// Converts into a [`EndpointAddr`] without cloning. + /// Converts into an [`EndpointAddr`] without cloning. pub fn into_endpoint_addr(self) -> EndpointAddr { self.endpoint_info.into_endpoint_addr() } @@ -457,7 +457,7 @@ impl From for EndpointInfo { /// /// See [`AddressLookup`] and [`Self::resolve`] for details. /// -/// [`Endpoint]: crate::Endpoint +/// [`Endpoint`]: crate::Endpoint #[derive(Debug, Default, Clone)] pub struct AddressLookupServices { services: Arc>>>, diff --git a/iroh/src/address_lookup/dns.rs b/iroh/src/address_lookup/dns.rs index 34c2d0d96f..786efae9e9 100644 --- a/iroh/src/address_lookup/dns.rs +++ b/iroh/src/address_lookup/dns.rs @@ -82,15 +82,13 @@ impl DnsAddressLookup { } } - /// Creates a new DNS discovery using the `iroh.link` domain. + /// Creates a new DNS address lookup using the `iroh.link` domain. /// /// This uses the [`N0_DNS_ENDPOINT_ORIGIN_PROD`] domain. /// - /// # Usage during tests - /// - /// For testing it is possible to use the [`N0_DNS_ENDPOINT_ORIGIN_STAGING`] domain - /// with [`DnsAddressLookup::builder`]. This would then use a hosted staging discovery - /// service for testing purposes. + /// When running with the environment variable `IROH_FORCE_STAGING_RELAYS` + /// set to any non empty value the [`N0_DNS_ENDPOINT_ORIGIN_STAGING`] domain + /// is used instead. pub fn n0_dns() -> DnsAddressLookupBuilder { if force_staging_infra() { Self::builder(N0_DNS_ENDPOINT_ORIGIN_STAGING.to_string()) diff --git a/iroh/src/address_lookup/memory.rs b/iroh/src/address_lookup/memory.rs index 2321cbae3b..6587e3def8 100644 --- a/iroh/src/address_lookup/memory.rs +++ b/iroh/src/address_lookup/memory.rs @@ -3,7 +3,7 @@ //! Often an application might get endpoint addressing information out-of-band in an //! application-specific way. [`EndpointTicket`]'s are one common way used to achieve this. //! This addressing information is often only usable for a limited time so needs to -//! be able to be removed again once know it is no longer useful. +//! be able to be removed again once you know it is no longer useful. //! //! This is where the [`MemoryLookup`] is useful: it allows applications to add and //! retract endpoint addressing information that is otherwise out-of-band to iroh. @@ -29,10 +29,11 @@ use super::{AddressLookup, EndpointData, EndpointInfo, Error, Item}; /// Often an application might get endpoint addressing information out-of-band in an /// application-specific way. [`EndpointTicket`]'s are one common way used to achieve this. /// This addressing information is often only usable for a limited time so needs to -/// be able to be removed again once know it is no longer useful. +/// be able to be removed again once you know it is no longer useful. /// /// This is where the [`MemoryLookup`] is useful: it allows applications to add and /// retract endpoint addressing information that is otherwise out-of-band to iroh. +/// /// # Examples /// /// ```no_run @@ -100,7 +101,7 @@ impl MemoryLookup { /// [`Endpoint`]: crate::Endpoint pub const PROVENANCE: &'static str = "memory_lookup"; - /// Creates a new static Address Lookup instance. + /// Creates a new empty Memory Lookup instance. pub fn new() -> Self { Self::default() } diff --git a/iroh/src/address_lookup/pkarr.rs b/iroh/src/address_lookup/pkarr.rs index bb62735752..e0d9d4ab50 100644 --- a/iroh/src/address_lookup/pkarr.rs +++ b/iroh/src/address_lookup/pkarr.rs @@ -259,7 +259,9 @@ impl AddressLookupBuilder for PkarrPublisherBuilder { /// that it only publishes address lookup information, for the corresponding resolver use /// the [`PkarrResolver`] together with [`AddressLookupServices`]. /// -/// This publisher will **only** publish the [`RelayUrl`] if it is set, otherwise the *direct addresses* are published instead. +/// By default this publisher only publishes the [`RelayUrl`], to avoid leaking IP addresses to +/// the public pkarr server. Which addresses are published is controlled by the [`AddrFilter`] +/// set via [`PkarrPublisherBuilder::addr_filter`]. /// /// [pkarr]: https://pkarr.org /// [module docs]: crate::address_lookup::pkarr @@ -276,7 +278,7 @@ pub struct PkarrPublisher { impl PkarrPublisher { /// Returns a [`PkarrPublisherBuilder`] that publishes endpoint info to a [pkarr] relay at `pkarr_relay`. /// - /// If no further options are set, the pkarr publisher will use [`DEFAULT_PKARR_TTL`] as the + /// If no further options are set, the pkarr publisher will use [`DEFAULT_PKARR_TTL`] as the /// time-to-live value for the published packets, and it will republish Address Lookup information /// every [`DEFAULT_REPUBLISH_INTERVAL`], even if the information is unchanged. /// diff --git a/iroh/src/defaults.rs b/iroh/src/defaults.rs index d929c85df8..7763cdbc43 100644 --- a/iroh/src/defaults.rs +++ b/iroh/src/defaults.rs @@ -24,13 +24,13 @@ pub mod prod { use crate::RelayUrl; /// Hostname of the default NA east relay. - pub const NA_EAST_RELAY_HOSTNAME: &str = "use1-1.relay.n0.iroh-canary.iroh.link."; + pub const NA_EAST_RELAY_HOSTNAME: &str = "use1-1.relay.n0.iroh.link."; /// Hostname of the default NA west relay. - pub const NA_WEST_RELAY_HOSTNAME: &str = "usw1-1.relay.n0.iroh-canary.iroh.link."; + pub const NA_WEST_RELAY_HOSTNAME: &str = "usw1-1.relay.n0.iroh.link."; /// Hostname of the default EU relay. - pub const EU_RELAY_HOSTNAME: &str = "euc1-1.relay.n0.iroh-canary.iroh.link."; + pub const EU_RELAY_HOSTNAME: &str = "euc1-1.relay.n0.iroh.link."; /// Hostname of the default Asia-Pacific relay. - pub const AP_RELAY_HOSTNAME: &str = "aps1-1.relay.n0.iroh-canary.iroh.link."; + pub const AP_RELAY_HOSTNAME: &str = "aps1-1.relay.n0.iroh.link."; /// Get the default [`RelayMap`]. pub fn default_relay_map() -> RelayMap { @@ -69,7 +69,7 @@ pub mod prod { RelayConfig::from(RelayUrl::from(url)) } - /// Get the default [`RelayConfig`] for Asia-Pacific + /// Get the default [`RelayConfig`] for Asia-Pacific. pub fn default_ap_relay() -> RelayConfig { // The default Asia-Pacific relay server run by number0. let url: Url = format!("https://{AP_RELAY_HOSTNAME}") @@ -91,9 +91,9 @@ pub mod staging { use crate::RelayUrl; /// Hostname of the default NA relay. - pub const NA_EAST_RELAY_HOSTNAME: &str = "staging-use1-1.relay.iroh.network."; + pub const NA_EAST_RELAY_HOSTNAME: &str = "use1-1.staging-relay.n0.iroh.link."; /// Hostname of the default EU relay. - pub const EU_RELAY_HOSTNAME: &str = "staging-euw1-1.relay.iroh.network."; + pub const EU_RELAY_HOSTNAME: &str = "euc1-1.staging-relay.n0.iroh.link."; /// Get the default [`RelayMap`]. pub fn default_relay_map() -> RelayMap { diff --git a/iroh/src/endpoint.rs b/iroh/src/endpoint.rs index 6fb606d42a..fc0d58f098 100644 --- a/iroh/src/endpoint.rs +++ b/iroh/src/endpoint.rs @@ -26,13 +26,22 @@ use tokio_util::sync::WaitForCancellationFutureOwned; use tracing::{Instrument, Span, debug, event, info_span, instrument, warn}; use url::Url; -/// Types for defining custom transports #[cfg(feature = "unstable-custom-transports")] pub mod transports { + //! Types for defining custom transports and path selectors. + //! + //!
+ //! + //! These items are unstable and gated behind the `unstable-custom-transport` feature. + //! They are not covered by semantic versioning guarantees and may change in any release + //! without a major version bump. + //! + //!
+ pub use super::socket::{ remote_map::{PathSelection, PathSelectionContext, PathSelectionData, PathSelector}, transports::{ - Addr, AddrKind, RecvInfo, Transmit, + Addr, AddrKind, FourTuple, RecvInfo, Transmit, custom::{CustomEndpoint, CustomSender, CustomTransport}, }, }; @@ -53,9 +62,10 @@ use crate::address_lookup::PkarrResolver; use crate::dns::DnsResolver; #[cfg(feature = "unstable-custom-transports")] use crate::endpoint::transports::CustomTransport; +#[cfg(feature = "unstable-net-report")] +use crate::net_report::Report as NetReport; pub use crate::tls::TlsConfigError; use crate::{ - NetReport, address_lookup::{ AddrFilter, AddressLookupBuilder, AddressLookupFailed, AddressLookupServices, DynAddressLookupBuilder, UserData, @@ -400,7 +410,7 @@ impl Builder { /// socket should be bound or the routing will be non-deterministic. /// /// To use a subnet with a non-zero prefix length as the default route in addition to - /// being routed when its prefix matches, use [`BindOpts::set_is_default_route]. + /// being routed when its prefix matches, use [`BindOpts::set_is_default_route`]. /// Subnets with a prefix length of zero are always marked as default routes. /// /// Finally note that most outgoing datagrams are part of an existing network flow. That @@ -601,7 +611,7 @@ impl Builder { /// /// This filter is applied once, at the [`AddressLookupServices`] level, before /// distributing data to any individual address lookup service. This ensures - /// consistent filtering regardless of how the services configured. + /// consistent filtering regardless of how the services are configured. /// /// [`AddressLookupServices`]: crate::address_lookup::AddressLookupServices pub fn addr_filter(mut self, filter: AddrFilter) -> Self { @@ -788,7 +798,15 @@ impl Builder { self } - /// Adds a custom transport + /// Adds a custom transport to the endpoint. + /// + ///
+ /// + /// This API is unstable and gated behind the `unstable-custom-transport` feature. + /// It is not covered by semantic versioning guarantees and may change in any release + /// without a major version bump. + /// + ///
#[cfg(feature = "unstable-custom-transports")] pub fn add_custom_transport(mut self, factory: Arc) -> Self { self.transports.push(TransportConfig::Custom(factory)); @@ -807,6 +825,14 @@ impl Builder { /// across multiple endpoints if desired. See `examples/custom-transport.rs` for /// an example implementation. /// + ///
+ /// + /// This API is unstable and gated behind the `unstable-custom-transport` feature. + /// It is not covered by semantic versioning guarantees and may change in any release + /// without a major version bump. + /// + ///
+ /// /// [`PathSelector`]: socket::remote_map::PathSelector #[cfg(feature = "unstable-custom-transports")] pub fn path_selector(mut self, selector: Arc) -> Self { @@ -842,7 +868,7 @@ pub enum EndpointError { /// [`Endpoint::connect`] and [`Endpoint::accept`] methods. Once established, the /// [`Connection`] gives access to most [QUIC] features. Individual streams to send data to /// the peer are created using the [`Connection::open_bi`], [`Connection::accept_bi`], -/// [`Connection::open_uni`] and [`Connection::open_bi`] functions. +/// [`Connection::open_uni`] and [`Connection::accept_uni`] functions. /// /// Note that due to the light-weight properties of streams a stream will only be accepted /// once the initiating peer has sent some data on it. @@ -1186,8 +1212,8 @@ impl Endpoint { /// understand if the endpoint has ever been considered "online". But after /// that initial call to [`Endpoint::online`], to understand if your /// endpoint is no longer able to be connected to by endpoints outside - /// of the private or local network, watch for changes in it's [`EndpointAddr`]. - /// If there are no `addrs`in the [`EndpointAddr`], you may not be dialable by other endpoints + /// of the private or local network, watch for changes in its [`EndpointAddr`]. + /// If there are no `addrs` in the [`EndpointAddr`], you may not be dialable by other endpoints /// on the internet. /// /// The `EndpointAddr` will change as: @@ -1280,7 +1306,7 @@ impl Endpoint { /// This has no timeout, so if that is needed, you need to wrap it in a /// timeout. We recommend using a timeout close to /// [`crate::NET_REPORT_TIMEOUT`]s, so you can be sure that at least one - /// [`crate::NetReport`] has been attempted. + /// net report has been attempted. /// /// To understand if the endpoint has gone back "offline", /// you must use the [`Endpoint::watch_addr`] method, to @@ -1299,20 +1325,22 @@ impl Endpoint { /// /// # Examples /// - /// ```no run - /// use iroh::Endpoint; - /// - /// #[tokio::main] - /// async fn main() { + /// ```no_run + /// # #[cfg(with_crypto_provider)] + /// # { + /// # #[tokio::main] + /// # async fn main() -> n0_error::Result<()> { + /// # use iroh::{Endpoint, endpoint::presets}; /// // After this await returns, the endpoint is bound to a local socket. /// // It can be dialed, but almost certainly hasn't finished picking a /// // relay. - /// let endpoint = Endpoint::bind().await; + /// let endpoint = Endpoint::bind(presets::N0).await?; /// /// // After this await returns we have a connection to at least one relay /// // and holepunching should work as expected. /// endpoint.online().await; - /// } + /// # Ok(()) } + /// # } /// ``` pub async fn online(&self) { let mut watcher = self.inner.home_relay_status(); @@ -1335,7 +1363,7 @@ impl Endpoint { /// /// The watched value has one entry per home relay whose URL is known, /// and is empty when no relays are configured or before the endpoint has - /// selected one the home relay from the list of configured relays. + /// selected a home relay from the list of configured relays. /// The watcher updates whenever any home relay's connection status changes. /// See [`RelayStatus`] for the information available on each entry. /// @@ -1347,21 +1375,29 @@ impl Endpoint { self.inner.home_relay_status() } - /// Returns a [`Watcher`] for any net-reports run from this [`Endpoint`]. + /// Returns a [`Watcher`] for any net report runs from this [`Endpoint`]. /// - /// A `net-report` checks the network conditions of the [`Endpoint`], such as - /// whether it is connected to the internet via Ipv4 and/or Ipv6, its NAT + ///
+ /// + /// This API is unstable and gated behind the `unstable-net-report` feature. + /// It is not covered by semantic versioning guarantees and may change in any release + /// without a major version bump. + /// + ///
+ /// + /// A net report checks the network conditions of the [`Endpoint`], such as + /// whether it is connected to the internet via IPv4 and/or IPv6, its NAT /// status, its latency to the relay servers, and its public addresses. /// - /// The [`Endpoint`] continuously runs `net-reports` to monitor if network - /// conditions have changed. This [`Watcher`] will return the latest result - /// of the `net-report`. + /// The [`Endpoint`] continuously runs net reports to monitor if network + /// conditions have changed. This [`Watcher`] will return the latest + /// net report. /// /// When issuing the first call to this method the first report might /// still be underway, in this case the [`Watcher`] might not be initialized - /// with [`Some`] value yet. Once the net-report has been successfully - /// run, the [`Watcher`] will always return [`Some`] report immediately, which - /// is the most recently run `net-report`. + /// with [`Some`] value yet. Once the net report has been successfully + /// run, the [`Watcher`] will always return [`Some`] immediately, which + /// is the most recently run net report. /// /// The returned watcher only becomes disconnected once the last clone of the [`Endpoint`] /// is dropped. Closing the endpoint does not disconnect the watcher. Thus, a stream created @@ -1383,21 +1419,11 @@ impl Endpoint { /// # }); /// # } /// ``` - #[doc(hidden)] + #[cfg(feature = "unstable-net-report")] pub fn net_report(&self) -> impl Watcher> + use<> { self.inner.net_report() } - /// Returns the last [`NetReport`] generated by this endpoint. - /// - /// Returns `None` if no net report was ever generated. - /// - /// This method is hidden in the docs because it is not part of the public api - #[doc(hidden)] - pub fn last_net_report(&self) -> Option { - self.inner.net_report().get() - } - /// Returns the local socket addresses on which the underlying sockets are bound. /// /// The [`Endpoint`] always binds on an IPv4 address and also tries to bind on an IPv6 @@ -1663,7 +1689,7 @@ impl Endpoint { /// kernel during the "Time-Wait" period of the TCP socket. /// /// Be aware however that the underlying UDP sockets are only closed once all clones of - /// the the respective [`Endpoint`] are dropped. + /// the respective [`Endpoint`] are dropped. pub async fn close(&self) { self.inner.close().await; } @@ -1916,8 +1942,8 @@ impl RelayMode { /// # fn main() -> n0_error::Result<()> { /// # use iroh::RelayMode; /// RelayMode::custom([ - /// "https://use1-1.relay.n0.iroh-canary.iroh.link.".parse()?, - /// "https://euw-1.relay.n0.iroh-canary.iroh.link.".parse()?, + /// "https://use1-1.relay.n0.iroh.link.".parse()?, + /// "https://euw-1.relay.n0.iroh.link.".parse()?, /// ]); /// # Ok(()) } /// ``` @@ -3151,6 +3177,7 @@ mod tests { #[tokio::test] #[traced_test] + #[cfg(feature = "unstable-net-report")] async fn watch_net_report() -> Result { let endpoint = Endpoint::builder(presets::Minimal) .relay_mode(RelayMode::Staging) @@ -3237,14 +3264,14 @@ mod tests { async fn test_custom_relay() -> Result { let _ep = Endpoint::builder(presets::Minimal) .relay_mode(RelayMode::custom([RelayUrl::from_str( - "https://use1-1.relay.n0.iroh-canary.iroh.link.", + "https://use1-1.relay.n0.iroh.link.", )?])) .bind() .await?; let relays = RelayMap::try_from_iter([ - "https://use1-1.relay.n0.iroh.iroh.link/", - "https://euc1-1.relay.n0.iroh.iroh.link/", + "https://use1-1.relay.n0.iroh.link/", + "https://euc1-1.relay.n0.iroh.link/", ])?; let _ep = Endpoint::builder(presets::Minimal) .relay_mode(RelayMode::Custom(relays)) @@ -3783,11 +3810,16 @@ mod tests { // create watchers to verify they terminate after the endpoint is dropped. let mut addrs = ep.watch_addr().stream(); - let mut net_reports = ep.net_report().stream(); - // returns None - let net_report = ep.last_net_report(); - info!("last Net report {net_report:?}"); + #[cfg(feature = "unstable-net-report")] + let mut net_reports = { + let net_reports = ep.net_report().stream(); + + // returns None + let net_report = ep.net_report().get(); + info!("last Net report {net_report:?}"); + net_reports + }; // this should work let sockets = ep.bound_sockets(); @@ -3820,6 +3852,8 @@ mod tests { while let Some(addr) = addrs.next().await { info!("Addrs stream: {addr:?}"); } + + #[cfg(feature = "unstable-net-report")] while let Some(net_report) = net_reports.next().await { info!("Net report stream: {net_report:?}"); } diff --git a/iroh/src/endpoint/bind.rs b/iroh/src/endpoint/bind.rs index d0cdea92f4..b8f579e672 100644 --- a/iroh/src/endpoint/bind.rs +++ b/iroh/src/endpoint/bind.rs @@ -111,7 +111,7 @@ impl BindOpts { /// Returns whether this is a default route. /// /// If [`Self::set_is_default_route`] has been called then that value is returned. - /// Otherwise, returns `true` if the [`prefix_len`][`Self::prefix_len] is `0` and + /// Otherwise, returns `true` if the [`prefix_len`][`Self::prefix_len`] is `0` and /// `false` otherwise. pub fn is_default_route(&self) -> bool { match self.is_default_route { diff --git a/iroh/src/endpoint/connection.rs b/iroh/src/endpoint/connection.rs index ebe0772f32..3b7a1a45c7 100644 --- a/iroh/src/endpoint/connection.rs +++ b/iroh/src/endpoint/connection.rs @@ -214,7 +214,7 @@ impl Incoming { self.inner.remote_address_validated() } - /// Decrypt the Initial packet payload + /// Decrypts the Initial packet payload. /// /// This clones and decrypts the packet payload (~1200 bytes). /// Can be used to extract information from the TLS ClientHello without completing the handshake. @@ -840,7 +840,7 @@ impl Connection { self.inner.accept_uni() } - /// Accept the next incoming bidirectional stream. + /// Accepts the next incoming bidirectional stream. /// /// **Important Note**: The peer that calls [`open_bi`] must write to its [`SendStream`] /// before the peer `Connection` is able to accept the stream using @@ -861,7 +861,7 @@ impl Connection { self.inner.read_datagram() } - /// Wait for the connection to be closed for any reason. + /// Waits for the connection to be closed for any reason. /// /// Despite the return type's name, closed connections are often not an error condition /// at the application layer. Cases that might be routine include @@ -1043,6 +1043,8 @@ impl Connection { self.inner.set_max_concurrent_uni_streams(count) } + /// Sets the connection-level flow control receive window. + /// /// See [`noq_proto::TransportConfig::receive_window`]. #[inline] pub fn set_receive_window(&self, receive_window: VarInt) { @@ -1188,10 +1190,10 @@ impl Connection { /// Waits until the full handshake occurs and returns a [`ZeroRttStatus`]. /// - /// If `ZeroRttStatus::Accepted` is returned, than any streams created before + /// If `ZeroRttStatus::Accepted` is returned, then any streams created before /// the handshake has completed can still be used. /// - /// If `ZeroRttStatus::Rejected` is returned, than any streams created before + /// If `ZeroRttStatus::Rejected` is returned, then any streams created before /// the handshake will error and any data sent should be re-sent on a /// new stream. /// diff --git a/iroh/src/endpoint/hooks.rs b/iroh/src/endpoint/hooks.rs index 4050446683..9c818257eb 100644 --- a/iroh/src/endpoint/hooks.rs +++ b/iroh/src/endpoint/hooks.rs @@ -55,7 +55,7 @@ impl AfterHandshakeOutcome { /// For each hook, all installed hooks are invoked in the order they were installed on /// the endpoint builder. If a hook returns `Accept`, processing continues with the next /// hook. If a hook returns `Reject`, processing is aborted and further hooks -/// are not invoked for this hook. +/// are not invoked for this hook point. /// /// ## Notes to implementers /// diff --git a/iroh/src/endpoint/presets.rs b/iroh/src/endpoint/presets.rs index 3760c7d749..6295a84b3d 100644 --- a/iroh/src/endpoint/presets.rs +++ b/iroh/src/endpoint/presets.rs @@ -17,7 +17,7 @@ use crate::endpoint::Builder; -/// Defines a preset +/// A reusable bundle of endpoint [`Builder`] configuration. pub trait Preset { /// Applies the configuration to the passed in [`Builder`]. fn apply(self, builder: Builder) -> Builder; @@ -86,8 +86,8 @@ impl Preset for Minimal { /// - setting the [`rustls::crypto::CryptoProvider`] to [ring] or [aws-lc-rs], depending /// on which feature is enabled in iroh (preferring ring if both are enabled). /// -/// Due to the last point, this preset is only available with the `ring` or -/// `aws-lc-rs` preset installed. +/// Due to the last point, this preset is only available with the `tls-ring` or +/// `tls-aws-lc-rs` feature enabled. /// If you want to set your own crypto provider, we recommend copying the /// implementation of this preset into your own and setting the appropriate crypto /// provider there. @@ -148,8 +148,8 @@ impl Preset for N0 { /// - setting the [`rustls::crypto::CryptoProvider`] to [ring] or [aws-lc-rs], depending /// on which feature is enabled in iroh (preferring ring if both are enabled). /// -/// Due to the last point, this preset is only available with the `ring` or -/// `aws-lc-rs` preset installed. +/// Due to the last point, this preset is only available with the `tls-ring` or +/// `tls-aws-lc-rs` feature enabled. /// If you want to set your own crypto provider, we recommend copying the /// implementation of this preset into your own and setting the appropriate crypto /// provider there. diff --git a/iroh/src/endpoint/quic.rs b/iroh/src/endpoint/quic.rs index 344b1f65bb..e5fcb0dd04 100644 --- a/iroh/src/endpoint/quic.rs +++ b/iroh/src/endpoint/quic.rs @@ -487,7 +487,7 @@ impl QuicTransportConfigBuilder { /// interact with the [`QuicTransportConfigBuilder::max_idle_timeout`], if the last path is /// abandoned the entire connection will be closed. /// - /// Note: values higher than [`PATH_MAX_IDLE_TIMEOUT`] are clamped and a warning is logged. + /// Note: values higher than `PATH_MAX_IDLE_TIMEOUT` (15 seconds) are clamped and a warning is logged. pub fn default_path_max_idle_timeout(mut self, timeout: Duration) -> Self { if timeout > PATH_MAX_IDLE_TIMEOUT { warn!( diff --git a/iroh/src/lib.rs b/iroh/src/lib.rs index a84535c54c..8dc8b3d03b 100644 --- a/iroh/src/lib.rs +++ b/iroh/src/lib.rs @@ -1,6 +1,6 @@ //! Peer-to-peer QUIC connections. //! -//! iroh is a library to establish direct connectivity between peers. It exposes an +//! iroh is a library to establish direct connectivity between peers. It exposes an //! interface to [QUIC] connections and streams to the user, while implementing direct //! connectivity using [hole punching] complemented by relay servers under the hood. //! @@ -73,7 +73,7 @@ //! //! If one of the iroh endpoints can be reached directly, connectivity can also be //! established without involving a Relay server. This is done by using the endpoint's -//! listening addresses in the connection establishement instead of the [`RelayUrl`] which +//! listening addresses in the connection establishment instead of the [`RelayUrl`] which //! is used to identify a Relay server. Of course it is also possible to use both a //! [`RelayUrl`] and direct addresses at the same time to connect. //! @@ -289,7 +289,16 @@ pub use iroh_dns::dns; pub use iroh_dns::endpoint_info; pub use iroh_relay::{RelayConfig, RelayMap}; pub use n0_watcher::Watcher; -pub use net_report::{NetReportConfig, Report as NetReport, TIMEOUT as NET_REPORT_TIMEOUT}; +pub use net_report::{NetReportConfig, TIMEOUT as NET_REPORT_TIMEOUT}; + +#[cfg(feature = "unstable-net-report")] +pub mod unstable_net_report { + //! Exports of net report types reachable via [`crate::endpoint::Endpoint::net_report`]. + /// This API is unstable and gated behind the `unstable-net-report` feature. + /// It is not covered by semantic versioning guarantees and may change in any release + /// without a major version bump. + pub use crate::net_report::{Probe, RelayLatencies, Report as NetReport}; +} #[cfg(any(test, feature = "test-utils"))] pub mod test_utils; diff --git a/iroh/src/net_report.rs b/iroh/src/net_report.rs index c9b2989e1a..05f0dd1e54 100644 --- a/iroh/src/net_report.rs +++ b/iroh/src/net_report.rs @@ -5,9 +5,6 @@ //! etc and reachability to the configured relays. // Based on -#![cfg_attr(iroh_docsrs, feature(doc_cfg))] -#![deny(missing_docs, rustdoc::broken_intra_doc_links)] -#![cfg_attr(not(test), deny(clippy::unwrap_used))] #![cfg_attr(wasm_browser, allow(unused))] use std::{ @@ -18,15 +15,11 @@ use std::{ }; use defaults::timeouts::PROBES_TIMEOUT; -// exported primarily for use in documentation -pub use defaults::timeouts::TIMEOUT; use iroh_base::RelayUrl; #[cfg(not(wasm_browser))] use iroh_dns::dns::DnsResolver; #[cfg(not(wasm_browser))] -use iroh_relay::RelayConfig; -#[cfg(not(wasm_browser))] -use iroh_relay::quic::QuicClient; +use iroh_relay::{RelayConfig, quic::QuicClient}; use iroh_relay::{ RelayMap, quic::{QUIC_ADDR_DISC_CLOSE_CODE, QUIC_ADDR_DISC_CLOSE_REASON}, @@ -46,19 +39,29 @@ use tokio::task::JoinSet; use tokio_util::sync::CancellationToken; use tracing::{debug, trace, warn}; -#[cfg(not(wasm_browser))] -use self::reportgen::QadProbeReport; use self::reportgen::{ProbeFinished, ProbeReport}; +#[cfg(not(wasm_browser))] +use self::reportgen::{QadProbeReport, SocketState}; +#[cfg_attr(not(feature = "unstable-net-report"), allow(unreachable_pub))] +pub use self::{ + // exported primarily for use in documentation + defaults::timeouts::TIMEOUT, + metrics::Metrics, + probes::Probe, + report::{RelayLatencies, Report}, +}; +pub(crate) use self::{ + options::Options, + reportgen::{IfStateDetails, QuicConfig}, +}; mod defaults; mod metrics; +mod options; mod probes; mod report; mod reportgen; -mod options; - -pub(crate) use self::reportgen::IfStateDetails; #[cfg(not(wasm_browser))] #[allow(missing_docs)] #[stack_error(derive, add_meta)] @@ -76,13 +79,6 @@ enum QadProbeError { ReceiverDropped, } -#[cfg(not(wasm_browser))] -use self::reportgen::SocketState; -pub use self::{metrics::Metrics, report::Report}; -pub(crate) use self::{ - options::Options, probes::Probe, report::RelayLatencies, reportgen::QuicConfig, -}; - /// Configuration for the net report component. /// /// Controls which probes and checks are performed when generating network reports. diff --git a/iroh/src/net_report/probes.rs b/iroh/src/net_report/probes.rs index 92884ca3ec..ecf507eaf8 100644 --- a/iroh/src/net_report/probes.rs +++ b/iroh/src/net_report/probes.rs @@ -20,6 +20,8 @@ const HTTPS_OFFSET: Duration = Duration::from_millis(200); /// The protocol used to time an endpoint's latency. #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, derive_more::Display)] #[repr(u8)] +#[cfg_attr(not(feature = "unstable-net-report"), allow(unreachable_pub))] +#[non_exhaustive] pub enum Probe { /// HTTPS Https, diff --git a/iroh/src/net_report/report.rs b/iroh/src/net_report/report.rs index 004a140dc6..4810cab34d 100644 --- a/iroh/src/net_report/report.rs +++ b/iroh/src/net_report/report.rs @@ -13,6 +13,8 @@ use super::{ProbeReport, probes::Probe}; /// A net_report report. #[derive(Default, Debug, PartialEq, Eq, Clone, Serialize, Deserialize)] +#[cfg_attr(not(feature = "unstable-net-report"), allow(unreachable_pub))] +#[non_exhaustive] pub struct Report { /// A QAD IPv4 round trip completed. pub udp_v4: bool, @@ -22,14 +24,13 @@ pub struct Report { pub mapping_varies_by_dest_ipv4: Option, /// Whether the reported public address differs when probing different servers (on IPv6). pub mapping_varies_by_dest_ipv6: Option, - /// Probe indicating the presence of port mapping protocols on the LAN. - /// `None` for unknown + /// The relay server with the lowest latency, if any. pub preferred_relay: Option, - /// keyed by relay Url + /// The measured latency to each relay, keyed by relay URL. pub relay_latency: RelayLatencies, - /// ip:port of global IPv4 + /// The discovered global IPv4 address and port, if any. pub global_v4: Option, - /// `[ip]:port` of global IPv6 + /// The discovered global IPv6 address and port, if any. pub global_v6: Option, /// CaptivePortal is set when we think there's a captive portal that is /// intercepting HTTP traffic. @@ -44,11 +45,13 @@ impl fmt::Display for Report { impl Report { /// Do we have any indication that UDP is working? + #[cfg_attr(not(feature = "unstable-net-report"), allow(unreachable_pub))] pub fn has_udp(&self) -> bool { self.udp_v4 || self.udp_v6 } /// Whether the reported public address differs when probing different servers. + #[cfg_attr(not(feature = "unstable-net-report"), allow(unreachable_pub))] pub fn mapping_varies_by_dest(&self) -> Option { match ( self.mapping_varies_by_dest_ipv4, @@ -129,6 +132,7 @@ impl Report { /// Latencies per relay endpoint. #[derive(Debug, Default, PartialEq, Eq, Clone, Serialize, Deserialize)] +#[cfg_attr(not(feature = "unstable-net-report"), allow(unreachable_pub))] pub struct RelayLatencies { #[cfg(not(wasm_browser))] ipv4: BTreeMap, @@ -172,6 +176,7 @@ impl RelayLatencies { /// Returns an iterator over all the relays and their latencies. #[cfg(not(wasm_browser))] + #[cfg_attr(not(feature = "unstable-net-report"), allow(unreachable_pub))] pub fn iter(&self) -> impl Iterator + '_ { self.https .iter() @@ -182,6 +187,7 @@ impl RelayLatencies { /// Returns an iterator over all the relays and their latencies. #[cfg(wasm_browser)] + #[cfg_attr(not(feature = "unstable-net-report"), allow(unreachable_pub))] pub fn iter(&self) -> impl Iterator + '_ { self.https.iter().map(|(k, v)| (Probe::Https, k, *v)) } diff --git a/iroh/src/protocol.rs b/iroh/src/protocol.rs index c2d40edff4..fc51261353 100644 --- a/iroh/src/protocol.rs +++ b/iroh/src/protocol.rs @@ -174,7 +174,7 @@ pub enum IncomingFilterOutcome { /// /// What this does depends on the connection type: /// - /// - **Direct (UDP) connections** : this is QUIC source address + /// - **Direct (UDP) connections**: this is QUIC source address /// validation. If the socket address was spoofed, the retry token is /// sent to the spoofed address, so we never hear from the attacker /// again. If the address was real, the client repeats the connection @@ -182,7 +182,7 @@ pub enum IncomingFilterOutcome { /// [`Incoming::remote_addr_validated`] set to `true`. The token is /// bound to the source address. /// - /// - **Relay connections** : there is no source address to validate + /// - **Relay connections**: there is no source address to validate /// (the relay already vouches for the packet origin), so the /// "validation" itself has no security meaning. However, the retry /// still imposes a real cost on the client: an extra round trip @@ -491,7 +491,7 @@ impl RouterBuilder { self } - /// Returns the [`Endpoint`] of the endpoint. + /// Returns the [`Endpoint`] stored in this builder. pub fn endpoint(&self) -> &Endpoint { &self.endpoint } diff --git a/iroh/src/socket.rs b/iroh/src/socket.rs index fd7b3b4b99..ab83cf714d 100644 --- a/iroh/src/socket.rs +++ b/iroh/src/socket.rs @@ -476,6 +476,7 @@ impl Socket { /// /// [`Watcher`]: n0_watcher::Watcher /// [`Watcher::initialized`]: n0_watcher::Watcher::initialized + #[cfg(feature = "unstable-net-report")] pub(crate) fn net_report(&self) -> impl Watcher> + use<> { self.net_report.watch().map(|(r, _)| r) } @@ -695,7 +696,7 @@ impl Socket { } } -/// Manages currently running [`crate::NetReport`] to learn this endpoint's IP addresses. +/// Manages currently running net reports to learn this endpoint's IP addresses. /// /// Invariants: /// - only one direct addr update must be running at a time diff --git a/iroh/src/socket/metrics.rs b/iroh/src/socket/metrics.rs index d3fba821de..7a03c65574 100644 --- a/iroh/src/socket/metrics.rs +++ b/iroh/src/socket/metrics.rs @@ -1,32 +1,41 @@ use iroh_metrics::{Counter, MetricsGroup}; use serde::{Deserialize, Serialize}; -/// Enum of metrics for the module -// TODO(frando): Add description doc strings for each metric. -#[allow(missing_docs)] +/// Metrics collected by the iroh socket. #[derive(Debug, Serialize, Deserialize, MetricsGroup)] #[non_exhaustive] #[metrics(name = "socket", default)] pub struct Metrics { + /// Intended to count updates to the local direct address set, but currently unused + /// (never incremented). pub update_direct_addrs: Counter, - // Sends (data or disco) + /// Number of bytes sent over IPv4. pub send_ipv4: Counter, + /// Number of bytes sent over IPv6. pub send_ipv6: Counter, + /// Number of bytes sent over the relay transport. pub send_relay: Counter, - // Data packets (non-disco) + /// Number of data bytes received over the relay transport. pub recv_data_relay: Counter, - // Number of bytes received on any custom transport. + /// Number of data bytes received over any custom transport. pub recv_data_custom: Counter, + /// Number of data bytes received over IPv4. pub recv_data_ipv4: Counter, + /// Number of data bytes received over IPv6. pub recv_data_ipv6: Counter, /// Number of QUIC datagrams received. pub recv_datagrams: Counter, - /// Number of datagrams received using GRO + /// Number of receive events that used GRO (coalesced datagram batches). + /// + /// This counts batches, not the individual datagrams within them. See + /// [`Self::recv_datagrams`] for the datagram count. pub recv_gro_datagrams: Counter, - // How many times our relay home endpoint DI has changed from non-zero to a different non-zero. + /// Number of times the home relay changed to a different relay. + /// + /// This includes the initial assignment from no home relay to a home relay. pub relay_home_change: Counter, /* @@ -79,11 +88,18 @@ pub struct Metrics { /// Number of custom transport paths closed. pub transport_custom_paths_removed: Counter, + /// Number of iterations of the main socket actor loop. pub actor_tick_main: Counter, + /// Number of actor messages processed by the socket actor loop. pub actor_tick_msg: Counter, + /// Number of periodic re-STUN timer ticks handled by the socket actor loop. pub actor_tick_re_stun: Counter, + /// Number of port-mapping change events handled by the socket actor loop. pub actor_tick_portmap_changed: Counter, + /// Intended to count direct address heartbeat ticks, but currently unused (never incremented). pub actor_tick_direct_addr_heartbeat: Counter, + /// Number of local network interface (link) change events handled by the socket actor loop. pub actor_link_change: Counter, + /// Number of times an input watcher or receiver closed in the socket actor loop. pub actor_tick_other: Counter, } diff --git a/iroh/src/socket/transports.rs b/iroh/src/socket/transports.rs index c58f1a10e9..77097437d3 100644 --- a/iroh/src/socket/transports.rs +++ b/iroh/src/socket/transports.rs @@ -807,12 +807,10 @@ impl PartialEq for Addr { /// Identifies a network path by the combination of remote and local addresses. /// -/// Mirrors [`noq::FourTuple`] but uses transport-specific addresses. -/// /// The meaning of the local address is a bit particular: /// * For IP transports it is the interface IP, if known. -/// * For custom transports it is a custom transport address, if the transport reports one. -/// * For relay transports there is no separate local address; the relay URL identifies the path. +/// * For custom transports it is a custom transport address, if the transport implementation reports one. +/// * For relay transports there is no separate local address. #[derive(Debug, Clone, PartialEq, Eq, Hash)] #[cfg_attr(not(feature = "unstable-custom-transports"), allow(unreachable_pub))] pub enum FourTuple { @@ -842,7 +840,7 @@ pub enum FourTuple { #[cfg_attr(not(feature = "unstable-custom-transports"), allow(unreachable_pub))] impl FourTuple { /// Creates a four-tuple from a remote address, with no known local address. - pub(super) fn from_remote(remote: Addr) -> Self { + pub fn from_remote(remote: Addr) -> Self { match remote { Addr::Ip(remote) => Self::Ip { remote, @@ -861,7 +859,7 @@ impl FourTuple { /// The variant is determined by `remote`. The `local` address is retained only when /// it matches that variant. A mismatched `local` is dropped, which cannot happen for /// values derived together from the same network path. - pub(super) fn new(remote: Addr, local: LocalTransportAddr) -> Self { + pub fn new(remote: Addr, local: LocalTransportAddr) -> Self { match remote { Addr::Ip(remote) => Self::Ip { remote, diff --git a/iroh/src/tls.rs b/iroh/src/tls.rs index b5d25d760f..808b1470c0 100644 --- a/iroh/src/tls.rs +++ b/iroh/src/tls.rs @@ -1,6 +1,6 @@ //! TLS configuration for iroh. //! -//! Currently there is one mechanisms available +//! Currently there is one mechanism available: //! - Raw Public Keys, using the TLS extension described in [RFC 7250] //! //! [RFC 7250]: https://datatracker.ietf.org/doc/html/rfc7250 diff --git a/iroh/src/tls/verifier.rs b/iroh/src/tls/verifier.rs index f27c9737c8..52e5ff9824 100644 --- a/iroh/src/tls/verifier.rs +++ b/iroh/src/tls/verifier.rs @@ -114,7 +114,7 @@ impl ServerCertVerifier for ServerCertificateVerifier { #[derive(Default, Debug)] pub(super) struct ClientCertificateVerifier; -/// We requires either following of X.509 client certificate chains: +/// We require one of the following client certificate configurations: /// /// - a valid raw public key configuration impl ClientCertVerifier for ClientCertificateVerifier {