102 Commits

Author SHA1 Message Date
Joe Turki
ee3a2e4341 Fix the tests on Windows 2025-09-22 17:39:54 +03:00
philipch07
965031eb25 Add IceCandidatePairStats 2025-09-16 10:50:44 -04:00
philipch07
f7437da850 Improve code cov by adding various tests 2025-09-14 15:34:52 -04:00
Pion
850dec457f Update CI configs to v0.11.25
Update lint scripts and CI configs.
2025-08-31 22:25:38 -04:00
Sean DuBois
2c04474e38 Implement ICE Role conflict resolution
Detect if remote has a role conflict and resolve it as defined by
RFC 8445 section-7.3.1.1

Resolves #359
2025-07-17 12:42:47 -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
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
oto313
37fb5d2fc3 Always send KeepAlives (#767)
Pion incorrectly resets the consent timer when sending any traffic. 
The consent timer must only be reset on STUN traffic.

RFC 7675
> Consent expires after 30 seconds.  That is, if a valid STUN binding
> response has not been received from the remote peer's transport
> address in 30 seconds, the endpoint MUST cease transmission on that
> 5-tuple.  STUN consent responses received after consent expiry do not
> re-establish consent and may be discarded or cause an ICMP error.
2025-03-17 14:06:54 -04:00
cnderrauber
f92d05f17c Add Req/Res count/time to candidate stats (#763)
These details will provide information for
connectivity issue.
2025-02-27 12:57:32 +08:00
Joe Turki
d21ae5e0e5 Include ufrag in generated ICE candidates
Include ufrag extension in the ICE candidates generated by the ICE agent
2025-01-30 23:42:03 -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
Raja Subramanian
9407bb0d2a Accept use-candidate unconditionally for ice-lite (#739)
There could be a mismatch between the two ends in candidate priority
when using peer reflexive. It happens in the following scenario

1. Client has two srflx candidates.
   a. The first one gets discovered by LiveKit server as prflx.
   b. The second one gets added via ice-trickle first and then
      gets a STUN ping. So, it is srflx remote candidate from
      server's point-of-view.
2. This leads to a priority issue.
   a. Both candidates have same priority from client's point-of-view
      (both are srflx).
   b. But, from server's point-of-view, the first candidate has
      higher priority (prflx).
3. The first candidate establishes connectivity and becomes
   the selected pair (client is ICE controlling and server is
   ICE controlled, server is in ICE lite).
4. libwebrtc does a sort and switch some time later based on RTT.
   As client side has both at same priority, RTT based sorting
   could make the second candidate the preferred one.
   So, the client sends useCandidate=1 for the second candidate.
   pion/ice does not switch because the selected pair is at
   higher priority due to prflx candidate.
5. STUN pings do not happen and the ICE connection eventually fails.

ICE controlled agent should accept use-candidate unconditionally if
it is an ICE lite agentt.
Just in case existing behaviour is needed, it can be configured
using `EnableUseCandidateCheckPriority`.

NOTE: With aggressive nomination, the selected pair could change
a few times, but should eventually settle on what the controlling
side wants.
2024-10-31 11:05:14 +05:30
Raja Subramanian
854fdfdb51 Add ability to get selected candidate pair stats (#735)
It is useful to have stats from just the selected pair as a lightweight
option where a lot of agents are running, for example, an SFU.

lint

Switch udp_mux_test to use sha256 instead of sha1 (#733)

Minor change to this test to stop using sha1 and remove the linter
exceptions.

Co-authored-by: Daniel Kessler <dkess@google.com>

Update module golang.org/x/net to v0.29.0

Generated by renovateBot

Update module github.com/pion/dtls/v3 to v3.0.3

Generated by renovateBot
2024-10-07 12:38:39 +05:30
Raja Subramanian
2d9be9b7bc Add round trip time measurement to candidate pair (#731)
* Add round trip time measurement to candidate pair

Use the round trip time measurement to populate RTT fields in
CandidatePairStats.

Atomic and tests

* Use int64 nanosecnods to make atomic easier
2024-09-16 23:59:57 +05:30
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
Eric Daniels
def1670796 Clean up Agents in tests more aggressively 2024-07-25 16:31:21 -04:00
Eric Daniels
a0385eec1a Add GracefulClose 2024-07-25 15:02:45 -04:00
Sean DuBois
89093bb75b Revert "Cleanly close agent goroutines"
This reverts commit d8341e71ae.
2024-07-15 12:19:01 -04:00
Eric Daniels
d8341e71ae Cleanly close agent goroutines 2024-07-02 10:40:52 -04:00
Eric Daniels
39c0392295 Support IPv6 from mDNS 2024-03-27 12:47:20 -04:00
Steffen Vogel
52f2075c2e Replace t.(Error/Fatal) with require.NoError
Make tests easier to read
2024-03-23 21:03:07 -04:00
Sean DuBois
85a3a7f524 Simplify usage of test.TimeOut()
Execute directly instead of allocating function
2024-03-23 20:28:47 -04:00
Sean DuBois
01c35354b0 Simplify usage of test.CheckRoutines()
Execute directly instead of allocating function
2024-03-23 20:08:57 -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
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
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
renovate[bot]
8d69e9ecd8 Update module github.com/pion/stun to v2
Generated by renovateBot
2023-09-08 14:25:52 -04:00
renovate[bot]
d21edf9690 Start pion/ice@v3
This is required to update pion/transport/v2 to v3

The public API of transport changed, and we expose transport as part of
our public API.
2023-09-03 23:51:36 -04:00
Steffen Vogel
52bac769b5 Add tests for Agent.Get{Local,Remote}Candidates() 2023-07-04 11:28:15 +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
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
c2756c121d Change type of ConnectionState constants 2023-05-10 16:33:20 +02:00
Steffen Vogel
ca9de18fd6 Move URL type to pion/stun.URI 2023-05-10 16:33:20 +02:00
Artur Shellunts
3172e05931 Extract TestOnSelectedCandidatePairChange
Extract TestOnSelectedCandidatePairChange to its own file.
2023-05-08 11:56:47 +02:00
Artur Shellunts
53ecdad0e2 Move MockPacketConn to fakenet package 2023-05-08 11:56:47 +02:00
Steffen Vogel
f40dd65abb Fix comment capitalization
Comments should start with an uppercase letter.
2023-04-18 19:38:54 +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
Artur Shellunts
b7897a6b72 Extract TestPairPriority
to separate file
2023-02-09 18:52:05 +01:00
Steffen Vogel
0194bd6ce8 Use new pion/transport Net interface
This change adapts pion/ice to use a new interface for most network
related operations. The interface was formerly a simple struct vnet.Net
which was originally intended to facilicate testing. By replacing it
with an interface we have greater flexibility and allow users to hook
into the networking stack by providing their own implementation of
the interface.
2023-02-08 21:58:49 +01:00
Artur Shellunts
0d1c333fcd Extract TestPairSearch from agent_test.go
to separate file.
2023-02-07 13:01:42 +01:00
Steffen Vogel
90a16ec70b Fix several typos throughout the codebase
As detected by an automatic spell checker.
2022-11-13 21:56:24 +01:00
Will Forcey
9ab8f71673 Cancel previous gathering routine on restart
Updated ICE agent restart method to cancel the
current gathering and then restart the candidate
gathering process.
2022-11-12 15:49:20 +01:00
cnderrauber
93980395c8 Fix muxed conn shared by candidate
When we have multiple host candidates and mux to a
single port, if these candidates share a same conn
(either tcp or udp), they might read other's msg
cause ice connection cost long time or failed.
2022-09-26 09:26:23 +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
cnderrauber
18f7a214aa Accept aggressive nomination
Add config for accept aggressive nomination, it is useful for
compatible with chrome or other clients use aggressive nominate
to update nominate candidate pairs.
2022-04-21 15:18:01 +08:00
Kyle Carberry
c7f5f6e56c Expose CheckInterval on AgentConfig
Allow users to configure how often internal task loop runs
2021-05-16 12:03:06 -07:00
Sean DuBois
6e4403794a Implement GetSelectedCandidatePair
Related to pion/webrtc#1713
2021-04-10 16:52:52 -07:00