pion / ice

A Go implementation of ICE
https://pion.ly/
MIT License
430 stars 158 forks source link

Prioritize TURN servers according to they relay protocol #629

Closed karaziox closed 5 months ago

karaziox commented 9 months ago

Description

Today, all relay candidates from Pion have the same priority. This PR attempts to reproduce libwebrtc's behavior, where the TURN servers candidates priority is based on the underlying relay protocol. UDP are preferred over TCP, which are preferred over the TLS options.

We reuse the same factors as libwebrtc: https://github.com/mozilla/libwebrtc/blob/1389c76d9c79839a2ca069df1db48aa3f2e6a1ac/p2p/base/turn_port.cc#L61

Sean-Der commented 5 months ago

Thank you so much @karaziox I am merging this now!

This is a pretty deep change! Anything else with Pion you would like to see improved? What else do you think could be better? Would love to hear what else you are looking at :)

codecov[bot] commented 5 months ago

Codecov Report

Attention: Patch coverage is 14.28571% with 12 lines in your changes are missing coverage. Please review.

Project coverage is 78.68%. Comparing base (67cc918) to head (82e739b).

Files Patch % Lines
candidate_relay.go 0.00% 12 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #629 +/- ## ========================================== - Coverage 78.80% 78.68% -0.13% ========================================== Files 42 42 Lines 4454 4466 +12 ========================================== + Hits 3510 3514 +4 - Misses 725 734 +9 + Partials 219 218 -1 ``` | [Flag](https://app.codecov.io/gh/pion/ice/pull/629/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion) | Coverage Δ | | |---|---|---| | [go](https://app.codecov.io/gh/pion/ice/pull/629/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion) | `78.68% <14.28%> (-0.13%)` | :arrow_down: | | [wasm](https://app.codecov.io/gh/pion/ice/pull/629/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion) | `23.50% <0.00%> (-0.07%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.