pion / stun

A Go implementation of STUN
https://pion.ly/
MIT License
601 stars 91 forks source link

Move URI type from pion/ice to pion/stun #134

Closed stv0g closed 1 year ago

stv0g commented 1 year ago

This PR moves the URL type from the pion/ice module to pion/stun and renames it to URI. Hence this module gains full support for RFC7064 and RFC7065 (see #65).

The PR also adds a new function stun.DialURI(u *stun.URI, cfg *stun.DialConfig) which create the underlying connection for the client for you based on the URI Scheme and transport protocol. Hence it can also use the dtls and tls modules to establish an encrypted connection.

Currently, the connection establishment is done by hand in various places:

This is also related to https://github.com/pion/stun/issues/35#issuecomment-1315361580

Furthermore, we now fully support passing a custom transport.Net for testing which was previously not supported for TLS / DTLS connections.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 70.11% and project coverage change: -39.95 :warning:

Comparison is base (23bfc11) 98.16% compared to head (73f2585) 58.21%.

:exclamation: Current head 73f2585 differs from pull request most recent head 8c40294. Consider uploading reports for the commit 8c40294 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #134 +/- ## =========================================== - Coverage 98.16% 58.21% -39.95% =========================================== Files 19 18 -1 Lines 1577 1716 +139 =========================================== - Hits 1548 999 -549 - Misses 23 684 +661 - Partials 6 33 +27 ``` | Flag | Coverage Δ | | |---|---|---| | go | `?` | | | wasm | `58.21% <70.11%> (-3.36%)` | :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. | [Impacted Files](https://app.codecov.io/gh/pion/stun/pull/134?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion) | Coverage Δ | | |---|---|---| | [client.go](https://app.codecov.io/gh/pion/stun/pull/134?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#diff-Y2xpZW50Lmdv) | `0.00% <0.00%> (-100.00%)` | :arrow_down: | | [helpers.go](https://app.codecov.io/gh/pion/stun/pull/134?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#diff-aGVscGVycy5nbw==) | `97.72% <ø> (-2.28%)` | :arrow_down: | | [uri.go](https://app.codecov.io/gh/pion/stun/pull/134?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion#diff-dXJpLmdv) | `96.94% <96.82%> (-3.06%)` | :arrow_down: | ... and [16 files with indirect coverage changes](https://app.codecov.io/gh/pion/stun/pull/134/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pion)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

stv0g commented 1 year ago

This change currently breaks the API of the module. As we are still with v0, I dont think this is a huge deal. The breaking changes are also really minor..