Skip to content

fix(ice): skip loopback for STUN srflx + add UDP TURN relay candidate gathering#796

Open
nightness wants to merge 1 commit intowebrtc-rs:masterfrom
Brainwires:fix/ice-loopback-stun-turn
Open

fix(ice): skip loopback for STUN srflx + add UDP TURN relay candidate gathering#796
nightness wants to merge 1 commit intowebrtc-rs:masterfrom
Brainwires:fix/ice-loopback-stun-turn

Conversation

@nightness
Copy link
Copy Markdown

Summary

Two related ICE improvements to RTCIceGatherer:

1. Skip loopback addresses for STUN srflx candidates (webrtc#778)

Loopback addresses (127.x.x.x, ::1) are never reachable from remote peers. When a STUN server tries to reflect a loopback source address, it either fails immediately or causes a long timeout that stalls ICE gathering for all other candidates. This fix skips loopback candidates before attempting STUN resolution.

2. UDP TURN relay candidate gathering

RTCIceGatherer now connects to configured TURN servers (from RTCIceServer with username/credential) and gathers relay candidates. This enables NAT traversal in symmetric NAT scenarios where srflx candidates are insufficient.

Test plan

  • cargo test -p webrtc — all existing tests pass
  • Verify ICE gathering completes quickly when loopback interfaces are present
  • Verify relay candidates appear when TURN server is configured

🤖 Generated with Claude Code

…candidate gathering

- fix(ice): skip loopback addresses (127.x.x.x, ::1) when gathering STUN srflx candidates
  Prevents long timeout when STUN server tries to reflect a loopback address (webrtc#778)
- feat(ice): add TURN relay candidate gathering (UDP) in RTCIceGatherer
  Connects to configured TURN servers and gathers relay candidates for NAT traversal

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant