-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(iroh): Make iroh
compile to Wasm & run in browsers
#3145
Closed
Conversation
This file contains 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
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3145/docs/iroh/ Last updated: 2025-01-24T10:46:54Z |
942d4ac
to
766164e
Compare
3458ef3
to
d6250d3
Compare
766164e
to
18eb0d2
Compare
d6250d3
to
445d014
Compare
4a84051
to
5191a9c
Compare
5286020
to
d4149ba
Compare
d4149ba
to
0df6a79
Compare
8111662
to
d9d798e
Compare
13b0ae0
to
3fd7585
Compare
…roh` in browsers" This reverts commit da63255.
d747692
to
3320d80
Compare
3fd7585
to
f9a3720
Compare
059ec18
to
85ea312
Compare
2 tasks
github-merge-queue bot
pushed a commit
that referenced
this pull request
Feb 14, 2025
## Description This makes iroh-net-report compile to Wasm. We make sure it's likely to work by grepping the generated Wasm file for "env" imports (which would make it not work in browsers). Mostly this will disable functionality in iroh-net-report for the browser target - specifically, it disables STUN, QAD, ICMP and all other probes besides HTTPS to relays. I've experimentally verified this code works with an integration test, it's really hard to come up with a good strategy for automating this testing due to requiring running cross-languages. I'd like to do that as a follow-up once #3145 is merged. ## Change checklist - [x] Self-review. - [x] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant.
4 tasks
github-merge-queue bot
pushed a commit
that referenced
this pull request
Feb 21, 2025
## Description (This PR is a rebase & some changes from the #3145 PR, so we don't disturb users who are trying out the iroh browser alpha.) - Adds a bunch of `#[cfg(not(wasm_browser))]` to anything related to socket networking (UDP sockets, DNS, etc.) - Implements a `WebRuntime` for quinn to use instead of `TokioRuntime` in browsers - Implements sleeping & timing utilities for `backoff` that work in browsers - Moves `node_info` out of the `dns` module, so we can disable `dns` as a whole, but keep `node_info` for discovery - Disables `MappedAddr::Ip` in browsers - Adjusts dependencies so we don't depend on unused/unsupported things in browsers ## Breaking Changes - `iroh-relay`: The `iroh_relay::dns::node_info` module was moved to `iroh_relay::node_info` ## Notes & open questions I'm holding off on refactoring bigger parts for now. I have two main ideas: - Group a bunch of structs in `magicsock.rs`, i.e. everything that depends on sockets. However, to do this, I want to refactor the way we *sometimes* use `Arc<netwatch::UdpSocket>` and *sometimes* use `UdpConn`, which is just a newtype over said type. Ideally we store `Arc<netwatch::UdpSocket>` everywhere, since it's more commonly used in APIs, e.g. in iroh-net-report, and only use `UdpConn`, when we need the udp sockets to implement `AsyncUdpSocket` from quinn. - Refactor the `node_info` module so there's fewer places that depend on `DnsResolver` in it. There's a bunch of things in that module that IMO are needless indirections (we go from `hickory::TxtLookup` -> `node_info::TxtAttrs<IrohAttr>` -> `(NodeId, NodeData)` -> `NodeInfo`. And even then, `NodeInfo` is mostly isomorphic to `NodeAttr`). I think both these refactors are helpful, but don't necessarily make the diff easier to read? Not sure. I'd like to merge this & then work on these refactors next week. ## Change checklist - [x] Self-review. - [x] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - [x] Tests if relevant. - [x] All breaking changes documented.
replaced by #3189 |
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.
Description
So far this enables this demo: https://github.com/matheus23/browser-iroh-net-demo/blob/update/src/lib.rs
Breaking Changes
Notes & open questions
Needs lots of love and refactoring, and other PRs landing first.
Change checklist