Skip to content

Conversation

@amanakin
Copy link
Member

@amanakin amanakin commented Jan 20, 2026

Description

This fixes the handling of relay preferences. Previously, LocalPreference for CandidateRelay was not being called, causing all relay protocols to have the same priority. This change introduces protocol-based preferences (UDP: 3, DTLS: 2, TCP: 1, TLS: 0).

Reference issue

Fixes #879

@codecov
Copy link

codecov bot commented Jan 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.49%. Comparing base (3a1823b) to head (e72e16b).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #880      +/-   ##
==========================================
+ Coverage   88.36%   88.49%   +0.13%     
==========================================
  Files          43       43              
  Lines        5509     5512       +3     
==========================================
+ Hits         4868     4878      +10     
+ Misses        447      440       -7     
  Partials      194      194              
Flag Coverage Δ
go 88.49% <100.00%> (+0.13%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@amanakin amanakin force-pushed the amanakin/add_relay_preference branch from ca92972 to 2f7c6dd Compare January 21, 2026 16:11
@amanakin amanakin requested a review from fippo January 21, 2026 16:14
@JoTurk
Copy link
Member

JoTurk commented Jan 21, 2026

@amanakin thank you so much, I'm reviewing this right now.

I see that contribute to pion frequently, would you like an invite to the org, no exceptions and nothing heavy-weight is required :) but we would like your reviews and it will let you run the CI yourself.

@amanakin
Copy link
Member Author

@JoTurk Hey! Sure, happy to help. :) Regarding this PR, I've started a thread in discord for discussion. libwebrtc's preference for DTLS looks weird..

@JoTurk
Copy link
Member

JoTurk commented Jan 21, 2026

yeah i was reading the discord discussion, and libwebrtc impl.
sent the invite :)

Copy link
Member

@JoTurk JoTurk left a comment

Choose a reason for hiding this comment

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

code is okay, not super sure about the behavior change and preference. but it seems fine and it makes sense to match libwebrtc.

@fippo
Copy link

fippo commented Jan 21, 2026

pion can probably change the specific local type preference without much issue. These days we have "relayProtocol" exposed on candidates so folks should look for that instead of reverse-engineering as was required in the old days

@amanakin
Copy link
Member Author

Well, looks like the webrtclib maintainers agree that DTLS should have lower priority than UDP
https://webrtc-review.googlesource.com/c/src/+/443160

@amanakin amanakin requested a review from JoTurk January 23, 2026 08:38
Copy link
Member

@JoTurk JoTurk left a comment

Choose a reason for hiding this comment

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

looks good for me, i think you should wait few days for other inputs :)

@amanakin amanakin merged commit 91a3151 into pion:master Jan 28, 2026
26 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

ICE doesn't enforce relay preference

3 participants