You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(iroh): Make iroh compile to wasm32-unknown-unknown (#3189)
## 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.
0 commit comments