Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
fb83cc8
feat(iroh): add initial scaffolding for WebRTC support
anchalshivank Aug 18, 2025
908eef3
feat(iroh): add basic webrtc implementation
anchalshivank Aug 19, 2025
676a6b3
Merge branch 'main' into feature/webrtc-wasm-support
anchalshivank Aug 19, 2025
54e9423
feat(webrtc): implement actor and sender
anchalshivank Aug 27, 2025
257bdb5
feat(webrtc): add webrtc poll_recv, webrtc transport and webrtc sender
anchalshivank Sep 2, 2025
3496a19
feat(webrtc): add various builder for different transports
anchalshivank Sep 3, 2025
a559b35
Merge branch 'main' into feature/webrtc-wasm-support
anchalshivank Sep 3, 2025
219915a
fix(webrtc): fix compile errors
anchalshivank Sep 4, 2025
d4ce636
feat(webrtc): add webrtc initiation in ping action for disco
anchalshivank Sep 8, 2025
4a358f2
feat(webrtc): exchange offer via disco
anchalshivank Sep 8, 2025
b87d3f8
chore(webrtc): remove repomix.xml
anchalshivank Sep 10, 2025
7d4cfbd
feat(webrtc): add offer and answer exchange struct
anchalshivank Sep 11, 2025
dd02f37
feat(webrtc): send answer after receiving offer
anchalshivank Sep 12, 2025
b054362
feat(webrtc): add ice exchange
anchalshivank Sep 13, 2025
829a419
feat(webrtc): send ice-candidates
anchalshivank Sep 13, 2025
f446b67
feat(webrtc): exchange ice candidates
anchalshivank Sep 15, 2025
70aed13
feat(webrtc): send data via webrtc p2p
anchalshivank Sep 15, 2025
42264d9
feat(webrtc): refactor code
anchalshivank Sep 16, 2025
5aaf775
feat(webrtc): refactor code
anchalshivank Sep 16, 2025
d5c14a5
Merge branch 'main' into feature/webrtc-wasm-support
anchalshivank Sep 16, 2025
b00e5ac
feat(webrtc): fix compilation errors
anchalshivank Sep 16, 2025
4540a68
chore(webrtc): remove unneccesary code
anchalshivank Sep 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(webrtc): add webrtc initiation in ping action for disco
  • Loading branch information
anchalshivank committed Sep 8, 2025
commit d4ce6366f445e811a17d76fd4f8cce715be5b18c
32 changes: 13 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion iroh-base/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ pub use self::node_addr::NodeAddr;
#[cfg(feature = "relay")]
pub use self::relay_url::{RelayUrl, RelayUrlParseError};
#[cfg(feature = "webrtc")]
pub use self::webrtc_port::{ChannelId, WebRtcPort};
pub use self::webrtc_port::{WebRtcPort, ChannelId};
37 changes: 35 additions & 2 deletions iroh-base/src/node_addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ use std::{collections::BTreeSet, net::SocketAddr};

use serde::{Deserialize, Serialize};

use crate::{ChannelId, NodeId, PublicKey, RelayUrl};
use crate::{NodeId, PublicKey, RelayUrl};
use crate::webrtc_port::ChannelId;

/// Network-level addressing information for an iroh node.
///
Expand Down Expand Up @@ -42,10 +43,18 @@ pub struct NodeAddr {
pub node_id: NodeId,
/// The node's home relay url.
pub relay_url: Option<RelayUrl>,
/// The node's webrtc port
/// The node's channel_id port
pub channel_id: Option<ChannelId>,
/// Socket addresses where the peer might be reached directly.
pub direct_addresses: BTreeSet<SocketAddr>,
/// Static Webrtc connection information for the node
pub webrtc_info: Option<WebRtcInfo>,
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding:
NodeAddr is used by the discovery system to locate nodes in the network. For discovery purposes, we only need the node_id to find a node. Once found, WebRTC connections are established through the standard offer/answer exchange process.

My concern:
Since WebRTC connections require dynamic offer/answer negotiation anyway, is it necessary to store static WebRTC information like channel_id and webrtc_info (certificate fingerprints) here?


#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
pub struct WebRtcInfo{
/// The hash of the certificate, prefixed with the algorithm, e.g./ "sha-256, B1:....:4E"
pub cert_fingerprints: BTreeSet<String>
}

impl NodeAddr {
Expand All @@ -56,6 +65,7 @@ impl NodeAddr {
relay_url: None,
channel_id: None,
direct_addresses: Default::default(),
webrtc_info: None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these two separate fields?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be fixed.
I think we do not need webrtc info and channel id here

}
}

Expand Down Expand Up @@ -91,6 +101,7 @@ impl NodeAddr {
relay_url,
direct_addresses: direct_addresses.into_iter().collect(),
channel_id: None,
webrtc_info: None,
}
}

Expand All @@ -106,6 +117,22 @@ impl NodeAddr {
relay_url,
channel_id,
direct_addresses: direct_addresses.into_iter().collect(),
webrtc_info: None,
}
}
/// Creates a new [`NodeAddr`] from its parts
pub fn from_parts_with_webrtc_info(
node_id: PublicKey,
relay_url: Option<RelayUrl>,
webrtc_info: Option<WebRtcInfo>,
direct_addresses: impl IntoIterator<Item = SocketAddr>,
) -> Self {
Self {
node_id,
relay_url,
channel_id: None,
direct_addresses: direct_addresses.into_iter().collect(),
webrtc_info
}
}

Expand All @@ -128,6 +155,11 @@ impl NodeAddr {
pub fn channel_id(&self) -> Option<&ChannelId> {
self.channel_id.as_ref()
}

/// Returns the WebRTC info
pub fn webrtc_info(&self) -> Option<&WebRtcInfo> {
self.webrtc_info.as_ref()
}
}

impl From<(PublicKey, Option<RelayUrl>, &[SocketAddr])> for NodeAddr {
Expand All @@ -138,6 +170,7 @@ impl From<(PublicKey, Option<RelayUrl>, &[SocketAddr])> for NodeAddr {
relay_url,
direct_addresses: direct_addresses_iter.iter().copied().collect(),
channel_id: None,
webrtc_info: None,
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion iroh-base/src/ticket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ use nested_enum_utils::common_fields;
use serde::{Deserialize, Serialize};
use snafu::{Backtrace, Snafu};

use crate::webrtc_port::ChannelId;
use crate::webrtc_port::{ChannelId, WebRtcPort};
use crate::{key::NodeId, relay_url::RelayUrl};
use crate::node_addr::WebRtcInfo;

mod node;

Expand Down Expand Up @@ -114,4 +115,5 @@ struct Variant0AddrInfo {
relay_url: Option<RelayUrl>,
direct_addresses: BTreeSet<SocketAddr>,
channel_id: Option<ChannelId>,
webrtc_info: Option<WebRtcInfo>
}
2 changes: 2 additions & 0 deletions iroh-base/src/ticket/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ impl Ticket for NodeTicket {
relay_url: self.node.relay_url.clone(),
direct_addresses: self.node.direct_addresses.clone(),
channel_id: self.node.channel_id.clone(),
webrtc_info: self.node.webrtc_info.clone()
},
},
});
Expand All @@ -72,6 +73,7 @@ impl Ticket for NodeTicket {
relay_url: node.info.relay_url,
direct_addresses: node.info.direct_addresses,
channel_id: node.info.channel_id,
webrtc_info: node.info.webrtc_info
},
})
}
Expand Down
Loading