Skip to content

webrtc: support wildcard listen addresses - #640

Merged
dmitry-markin merged 22 commits into
masterfrom
dm-webrtc-wildcard
Aug 14, 2026
Merged

webrtc: support wildcard listen addresses#640
dmitry-markin merged 22 commits into
masterfrom
dm-webrtc-wildcard

Conversation

@dmitry-markin

Copy link
Copy Markdown
Collaborator

Allow wildcard IPv4 & IPv6 WebRTC listen addresses, taking care of local addresses of inbound/outbound UDP packets.

Resolves #638.

@dmitry-markin
dmitry-markin requested a review from gab8i August 11, 2026 11:27
@dmitry-markin dmitry-markin self-assigned this Aug 11, 2026
@socket-security

socket-security Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedquinn-udp@​0.6.18210093100100

View full report

@dmitry-markin dmitry-markin changed the title webrtc: support listening on wildcard addresses webrtc: support wildcard listen addresses Aug 11, 2026

@gab8i gab8i left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It took me a while to understand effectively how does this work but if I got this right this is a great way of using the fact that the ICE candidates IP doesn't really need to be the same as the reachable address

Correct me if I'm wrong:

  • listener addresses for wildcards are expanded into multiple multiaddress, one per effectively reachable interface (ip)
  • using quinn_udp::UdpSocketState allow and auto set up of IP_PKTINFO There is a difference between the reachable ip and what needs to be used within str0m, the latter just needs to stay stable over the connection. This makes possible to keep a node under a proxy, the reachable addr is A but internally the first message arrives at ip B (known thanks to IP_PKTINFO),
  • An AddrsPair can be build knowing B, the first ip a message arrive at, and the remote addr. This pair is now used to force always the usage of B as ip source for sent messages and to internally dispatch messages to the right webrtc instances

One thing I didn't understand though is: what if the destination address changes mid-session?

Behind a wildcard, peers reach the node at A and the internally A → B.
With more than one internal address that can resolve to B1 at handshake time and B2 later,
how is this addressed? It this not possible?

///
/// A wildcard listen address is advertised as all matching interface addresses (link-local IPv6
/// excluded).
fn build_listen_addresses(sockaddr: SocketAddr, certhash: Multihash<64>) -> Vec<Multiaddr> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

loopback addresses are not filtered out here, is this made on purpose?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This matches our approach with TCP/WebSocket. Loopback addresses deprioritized later in DHT, but we advertise them over Identify protocol.

@dmitry-markin

Copy link
Copy Markdown
Collaborator Author

Yes, everything works as you described.

With more than one internal address that can resolve to B1 at handshake time and B2 later

This is not possible if the routing is stable. Even if the routing changes mid-session, this requires at least two local addresses/interfaces B1 B2 both reachable from the public IP A, which is a very weird setup.

@dmitry-markin
dmitry-markin merged commit faeb7c8 into master Aug 14, 2026
11 checks passed
@dmitry-markin
dmitry-markin deleted the dm-webrtc-wildcard branch August 14, 2026 10:01
@github-project-automation github-project-automation Bot moved this to Blocked ⛔️ in Networking Aug 14, 2026
dmitry-markin added a commit that referenced this pull request Aug 17, 2026
## [0.15.0] - 2026-08-17
This release focuses on WebRTC. It is the first release with official
WebRTC support. Expect things to break and get fixed in subsequent point
releases.
This release is also semver breaking on the error API.
`Error::CannotReadSystemDnsConfig` now carries an opaque `DnsInitError`
instead of a `hickory-resolver` error type, and the new
`Error::DnsResolverInit` variant reports resolver construction failures.
`Error` is now `#[non_exhaustive]`, so external `match` expressions over
it require a wildcard arm. Together these changes keep
`hickory-resolver` out of the public API, making future resolver bumps
semver compatible.
### Added
- webrtc: support wildcard listen addresses
([#640](#640))
- bitswap: enable Keccak and BLAKE2b hashers for CIDs
([#641](#641))
### Changed
- deps: bump hickory-resolver and str0m
([#642](#642))
- deps: bump str0m to 0.22
([#639](#639))
- webrtc: use a shared 16 KiB buffer for the `WebRtcTransport` stream
([#623](#623))
### Fixed
- dns: stop leaking hickory error types in litep2p's public API
([#643](#643))
- webrtc: enforce strict client network identity verification
([#637](#637))
- webrtc: fix input backpressure
([#626](#626))
- webrtc: properly handle `str0m::Event::Closed`
([#627](#627))

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Dmitry Markin <dmitry@markin.tech>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Blocked ⛔️

Development

Successfully merging this pull request may close these issues.

webrtc: support listening on wildcard addresses

2 participants