Fix Rust custom relay example#67
Merged
Merged
Conversation
RelayMode::Custom takes a RelayMap, not a Vec<RelayUrl>, so the previous example did not compile. Also fix the RelayUrl import path (crate root, there is no iroh::relay module) and pass the now-required preset to Endpoint::builder. Verified with cargo check against iroh 1.0.0-rc.1. Fixes #53 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
matheus23
approved these changes
Jun 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #53.
The Rust tab of the custom relay snippet (used by the dedicated infrastructure page) had three problems against iroh 1.0.0-rc.1:
RelayMode::Customtakes aRelayMap, not aVec<RelayUrl>(the bug reported in Rust examples for custom relays are wrong #53). Now usesRelayMap::from_iter, which is implemented forRelayUrliterators.use iroh::relay::RelayUrlis not a valid path;RelayUrlis exported at the crate root.Endpoint::builder()now requires a preset argument; passespresets::N0, matching the other language tabs which combinepreset_n0()with arelay_modeoverride.Verified the corrected example with
cargo checkagainstiroh@1.0.0-rc.1. The Python, Swift, and Kotlin tabs use the bindings'RelayMode.customFromUrls(...)API and are unchanged.🤖 Generated with Claude Code