64 Commits

Author SHA1 Message Date
philipch07
965031eb25 Add IceCandidatePairStats 2025-09-16 10:50:44 -04:00
Kevin Wang
be0657f17b Fix lint errors 2025-08-16 23:35:36 -04:00
Xiaobo Liu
eef8d96d36 Replace interface{} with any type alias
This change maintains full backward compatibility while adopting
modern Go type alias conventions for better code clarity.

Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
2025-06-14 16:52:30 +08: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
Paul Wells
abdc0cadec Use addrEqual for candidate comparison (#752) 2025-01-13 07:48:00 -05:00
ARJUN SHAJI
166b1b7f9e Use sync.Pool for candidate inbound buffer
This commit reduces garbage collection pressure by re-using the buffer
used for reading inbound ICE traffic.

Fixes #737
2024-10-28 12:45:01 -04:00
Sean DuBois
39c90d8419 Upgrade dtls, turn and sturn
New major version of dtls causes API breaks on three packages
2024-08-12 11:43:44 -04: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
fdca6c47c0 Move taskloop into dedicated package
Reduce size of Agent and simplify code
2024-03-22 20:09:57 -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
renovate[bot]
8d69e9ecd8 Update module github.com/pion/stun to v2
Generated by renovateBot
2023-09-08 14:25:52 -04:00
Steffen Vogel
8d14c1f2e7 Harmonize errors and error logging
Signed-off-by: Steffen Vogel <post@steffenvogel.de>
2023-07-18 07:48:09 +02: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
San9H0
f07b6d16ad Add RemoteCandidateCache for better performance
Check sourceAddress from first packet validation of STUNTraffic.
If validation is true, store it in the cache.
Use cache for performance.
2023-04-18 19:20:52 +02:00
Steffen Vogel
5ef81b65f4 Make package REUSE compliant 2023-04-18 13:46:38 +02:00
Steffen Vogel
c6c0a15708 Fix new golangci-lint errors 2023-04-12 09:27:03 +02:00
Miroslav Šedivý
d99a6fcb7c Return ErrClosedPipe for writeTo
Return ErrClosedPipe for writeTo
2023-01-12 22:09:12 +01:00
Genteure
3fe1ae7c2b Fix IPv6 formatting in Candidate.String()
A Candidate with IPv6 address was formatted similar to fe80::1:51820
net.JoinHostPort will add [ ] around the address if it's IPv6,
so it would look like [fe80::1]:51820 instead.
2023-01-12 18:40:14 +01:00
Steffen Vogel
f87e3be545 Do not show a warning for closed connections
Do not show a warning for closed connections
2022-11-16 09:52:12 +02:00
Steffen Vogel
d415139840 Refactor variable names from buffer to buf
Go encourages short names. And a quick
survey through the Pion code bases reveals,
that we have been using buf more often than buffer.
So this change will harmonize the different spellings.
2022-11-13 21:56:24 +01:00
Steffen Vogel
85bda0bf6c Refactor and simplify handleInboundCandidateMsg()
There is only a single location in the code calling
handleInboundCandidateMsg(). Hence it makes sense to turn it into
a receiver function.
2022-11-13 21:56:24 +01:00
Steffen Vogel
fdfe34ab7b Harmonize capitalization of variable names
As most variable names are using camelCase.
2022-11-13 21:56:24 +01:00
cnderrauber
8c1adf18f1 Change writeTo failed log level to info
In #252 decide to ignore the writeTo failed error with a log,
application can choose callback and query state for the connection
state. But if application keep sending packet during try icerestart
to recover from ICEFailed, the warn log is annoying since the error
is not critical and no need to process. So change it to info.
2022-10-19 10:32:32 +08:00
Pion
16e03db8f8 Update CI configs to v0.7.2
Update lint scripts and CI configs.
2022-04-26 23:27:21 -04:00
Sean DuBois
bdb23b0bf4 Improve parsing candidates with missing Foundation
Support missing foundation candidates with additional attributes

Resolves #390
2021-12-25 22:53:35 -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
e9caba4e03 Expose ErrUnknownCandidateTyp
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 12:18:08 -05:00
Sean DuBois
6d30128765 Revert "Remove unknown constant"
We will re-do this in the future, but need to keep it for a major
release.

Resolves #385
2021-08-11 13:09:13 -04:00
Woodrow Douglass
366757d59d Remove unknown constant
This constant tends to cause collisions with enumerations, and is
in general a source of bugs
2021-08-10 15:51:40 -04: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
Sean DuBois
6e4403794a Implement GetSelectedCandidatePair
Related to pion/webrtc#1713
2021-04-10 16:52:52 -07:00
Sean DuBois
e0312efe33 Fix candidateBase Marshal receiver type
Should be a pointer, not a value. Copying the atomics was causing a
race

Resolves #307
2020-11-28 21:47:14 -08:00
Sean DuBois
1a4dd6394c Log don't return error on writeTo fail
Downstream isn't able to distinguish a temporary from a Permanent
error yet.

Relates to #252
2020-11-13 04:52:57 -08: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
28df93f669 Expose Priority and Foundation overrides
Allow pion/webrtc to override these as well
2020-09-12 23:40:36 -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
f5493bc7fb Add TCPType Support
Unmarshal/Marshal now supports TCPType
2020-09-12 21:10:58 -07:00
Sean DuBois
43c86267c6 Add Foundation generation to Candidate
Also add some comments to Candidate interface
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