-
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 wasm32-unknown-unknown
#3189
Conversation
…roh` in browsers" This reverts commit da63255.
d2a5ca6
to
160df40
Compare
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3189/docs/iroh/ Last updated: 2025-02-21T16:21:36Z |
674a083
to
160df40
Compare
#[cfg(not(wasm_browser))] | ||
pub mod dns; | ||
pub mod node_info; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving node_info
from crate::dns::node_info
to crate::node_info
, because we need it for discovery in browsers, but it's still nice to disable the whole dns
module in browsers, too.
impl Drop for DiscoveryTask { | ||
fn drop(&mut self) { | ||
self.task.abort(); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DiscoveryTask::task
is an AbortOnDropHandle
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some small comments, otherwise LGTM
Cleaning up the cfg
s a bit will certainly be needed, but can definitely land as follow ups
This adds a new example: A chat app based on iroh gossip, running both in the browser and on the command line. See the README for details. * based on #106 for CI infrastructure added there * uses n0-computer/iroh#3189 and n0-computer/iroh-gossip#37
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.)
#[cfg(not(wasm_browser))]
to anything related to socket networking (UDP sockets, DNS, etc.)WebRuntime
for quinn to use instead ofTokioRuntime
in browsersbackoff
that work in browsersnode_info
out of thedns
module, so we can disabledns
as a whole, but keepnode_info
for discoveryMappedAddr::Ip
in browsersBreaking Changes
iroh-relay
: Theiroh_relay::dns::node_info
module was moved toiroh_relay::node_info
Notes & open questions
I'm holding off on refactoring bigger parts for now. I have two main ideas:
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 useUdpConn
, 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 useUdpConn
, when we need the udp sockets to implementAsyncUdpSocket
from quinn.node_info
module so there's fewer places that depend onDnsResolver
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 toNodeAttr
).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