33 Commits

Author SHA1 Message Date
Sean DuBois
f32c107a62 Update lint rules, force testify/assert for tests
Use testify's assert package instead of the standard library's testing
package.
2025-04-22 23:36:32 -04:00
Joe Turki
ef453b3fdd Handle candidate: prefix with UnmarshalCandidate
Make UnmarshalCandidate able to handle candidate: prefix in the
candidate string.
2025-03-25 06:52:45 +02:00
Joe Turki
9dfb5c2667 Allow for empty extension values
While not spec compliant, some implementations allow for empty extension
values. This aligns with our behavior for empty foundation values.
And makes the parser more forgiving for bad implementations.
2025-01-30 23:02:25 -06:00
Joe Turki
47dad556f1 Add methods to add and remove extensions
Added `AddExtension` and `RemoveExtension` methods to `ICECandidate`,
allowing extensions to be managed dynamically.
Ensure that `TCPType` is stored in one place (candidate.TCPType)
2025-01-30 03:24:09 -06:00
Joe Turki
cad1676659 Upgrade golangci-lint, more linters
Introduces new linters, upgrade golangci-lint to version (v1.63.4)
2025-01-17 08:21:15 -06:00
Joe Turki
ab6e243686 Parse Candidate Extensions (RFC5245)
- Rewrote `UnmarshalCandidate` to better align with RFC5245.
- Added Candidate `Extensions` and `GetExtension`.
- Updated `Equal` and `Marshal` to accommodate these changes.
- New Type `CandidateExtension` to handle.
2025-01-15 21:38:13 -06:00
sirzooro
11845a7f56 Remove IPv6 ZoneID from ICE candidates (#704)
Link-local IPv6 addresses may have ZoneID attached at the end. It has
local meaning only and should not be send to other parties. This change
removes ZoneID from generated candidate string, and ignores ZoneID
when received candidate is parsed.
2024-07-06 14:52:09 +02:00
Juliusz Chroboczek
7e44037480 Revert "Avoid allocation storing last active time"
This reverts commit edb69295c0.

In that commit, active time was changed from time.Time to
Unix time in order to avoid allocations. Unfortunately, that
has the side effect of discarding the monotonic component of
time.Time, and therefore makes our code vulnerable to stepping
of the system clock.

Fixes #697
2024-05-26 06:59:13 -07:00
Paul Wells
edb69295c0 Avoid allocation storing last active time 2024-04-30 06:31:05 -07:00
Eric Daniels
39c0392295 Support IPv6 from mDNS 2024-03-27 12:47:20 -04:00
Steffen Vogel
05ab684741 Use testify/require instead of testify/assert
Don't continue to run a test if it has already failed
2024-03-23 07:42:06 -04:00
Sean DuBois
26ba6dfea5 Fix WASM build
Constant used by WASM+Go tests was in Go only file
2024-03-18 19:59:32 -04:00
Sean DuBois
2d7ced1d49 Fix linter errors
golangci-lint upgrade to v1.56.2 added more checks

Relates to pion/.goassets#201
2024-03-15 22:25:46 -04:00
Sean DuBois
db5d7ea72b Implement Active ICE TCP Candidates
Co-authored-by: Steffen Vogel <post@steffenvogel.de>
Co-authored-by: Artur Shellunts <shellunts.artur@gmail.com>
2023-06-15 21:44:21 -04:00
Sean DuBois
abc1ca33b5 Revert active TCP candidate support
This reverts commit 00bbd2954c
and 1d502ca6ec
2023-05-24 00:05:44 -04:00
Steffen Vogel
00bbd2954c Minor style fixes for active TCP candidate support 2023-05-16 20:07:39 +02:00
Artur Shellunts
1d502ca6ec Implement active TCP candidate type (RFC6544)
By default TCP candidate type priority is UDP one minus 27 (except
relay), so that UDP+srlfx priority > TCP+host priority. That priority
offset can be configured using AgentConfig.
IPv6 TCP candidates are also supported.
2023-05-15 22:41:52 +02:00
Steffen Vogel
8b166270df Fix capitalization of acronyms like UDP, TCP, STUN 2023-04-20 22:15:07 +02:00
Steffen Vogel
5ef81b65f4 Make package REUSE compliant 2023-04-18 13:46:38 +02:00
Miroslav Šedivý
52b8cab92c Test candidate WriteTo function to return error
When connection is closed
2023-01-12 22:09:12 +01:00
Sean DuBois
b7178c055e Remove TestMissingCandidateFoundation
This is covered in TestCandidateMarshal
2022-02-01 10:43:33 -05:00
Sean DuBois
bc26832ad7 Support parsing candidates with missing Foundation
Not RFC 8445 compliant but are currently emitted by Google.

Resolves #390
2021-12-15 23:12:09 -05:00
Sean DuBois
b897e71a59 Expose ErrDetermineNetworkType
Expose this error so pion/webrtc can handle gracefully.
rfc8839#section-5.1 specifies that a WebRTC Agent MUST
ignore any name/value pairs it doesn't understand.

Relates to pion/webrtc#1949
2021-12-15 15:51:34 -05:00
Meelap Shah
1b533aee68 Populate RelayProtocol for relay candidates
The webrtc-stats spec defines this field as:
> It is the protocol used by the endpoint to communicate with the TURN
> server. This is only present for local candidates. Valid values are
> "udp", "tcp", or "tls".
https://w3.org/TR/webrtc-stats/#dom-rtcicecandidatestats-relayprotocol
2021-07-20 16:05:57 -04:00
Pion
d3e1775d73 Update CI configs to v0.4.7
Update lint scripts and CI configs.
2020-09-26 08:54:24 -07:00
Sean DuBois
a03db7f0a3 Preserve Priority and Foundation E2E
We need these when handling remote candidates
2020-09-12 23:03:38 -07:00
Sean DuBois
449f7af43b Assume mDNS candidates are UDPv4 until parsed
Otherwise we are unable to handle remote candidates
2020-09-12 21:44:47 -07:00
Sean DuBois
f5493bc7fb Add TCPType Support
Unmarshal/Marshal now supports TCPType
2020-09-12 21:10:58 -07:00
korymiller1489
166df5842e Add Marshal and Unmarshal to Candidate Base
Move string representation of candidates into pion/ice from pion/webrtc
2020-09-12 00:23:24 -07:00
Jerko Steiner
b828116017 Make TCP ICE candidates have lower preference
Closes #262. Adds the changes in determining local preference according
to RFC 6544, section 4.2.
2020-08-10 21:02:15 +02:00
David Hamilton
5870fb0c99 Added tests for lastSent and lastReceived get/set
Validate the new behaviour when these atomic vars have not been
set yet.
2019-12-11 10:32:37 -08:00
Sean DuBois
63b37975b6 Make Candidate an interface
This change will allow us to have custom logic and members
per interface type. Relay candidates will have a completely different
read loop, and candidate specific state.

Relates to #47
2019-05-24 15:55:42 -07:00
Michael MacDonald
ad7c8697fd Candidate priority is incorrectly calculated
Some constants were being incorrectly generated using 2^N (XOR)
instead of 1 << N. This resulted in incorrect candidate priorities
being used to evaluate candidate pairs.

Resolves #14.
2019-04-11 13:40:39 -04:00