Commit Graph
647 Commits
Author SHA1 Message Date
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
Xiaobo Liu bbb9792ca9 Change activeTCPConn.close to atomic.Bool
Replace manual atomic operations with atomic.Bool type for better
type safety and cleaner code. This modernizes the atomic usage
pattern from atomic.LoadInt32/StoreInt32 to the newer Load/Store
methods on atomic.Bool.

- Update activeTCPConn.closed field type from int32 to atomic.Bool
- Replace atomic.LoadInt32(&a.closed) with a.closed.Load()
- Replace atomic.StoreInt32(&a.closed, 1) with a.closed.Store(true)

All existing functionality preserved with improved type safety.

Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>

tweak

Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
2025-06-14 15:16:36 +08:00
PionandSean DuBois 753c2a0fe8 Update CI configs to v0.11.19
Update lint scripts and CI configs.
2025-04-23 10:53:29 -04: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
sirzooroandGitHub dd072edae9 Pass LoggerFactory to dtls and mdns (#772) 2025-04-12 19:09:54 +02:00
Joe Turki dddf6a4565 Update social media links, move to discord 2025-04-07 05:29:52 +02: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
oto313andGitHub 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
cnderrauberandGitHub 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
renovate[bot]andJoe Turki 141df5a086 Update module github.com/pion/logging to v0.2.3
Generated by renovateBot
2025-01-30 23:36:28 -06: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
renovate[bot]andJoe Turki 647b9786dd Update golang.org/x/net to v0.33.0 [security]
Generated by renovateBot
2025-01-16 01:59: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 WellsandGitHub abdc0cadec Use addrEqual for candidate comparison (#752) 2025-01-13 07:48:00 -05:00
c9abe8bfe0 Add nil checks to agent_handlers (#751)
Co-authored-by: Daniel Kessler <dkess@google.com>
2025-01-09 15:48:42 -08:00
Amin ChelohandSean DuBois 35bb3fb992 docs(agent_config.go): update KeepaliveInterval default value to 2 sec
Update documentation for KeepaliveInterval to match defaultKeepaliveInterval constant
2024-11-26 10:53:54 -05:00
WofWcaandSean DuBois 8b8fffdc3c Use named return val for IP/if filter
This should make it clear that you need to return `true`
to keep it and `false` to exclude.

Relates to pion/webrtc#2958
2024-11-26 10:48:44 -05:00
Nikita KarmatskikhandSean DuBois 1c850ea1d8 Pass UDPAddr.Zone to net.ListenUDP
listenUDPInPortRange wasn't passing the Zone and would always fail to
bind. This would cause high CPU usage as every port in the range would
be attempted and fail.

Fixes #742
2024-11-26 10:35:17 -05:00
renovate[bot]GitHubrenovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2c699d8405 Update module github.com/stretchr/testify to v1.10.0 (#743)
Generated by renovateBot

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-23 17:09:40 +00:00
renovate[bot] 59d8563508 Update module github.com/pion/dtls/v3 to v3.0.4
Generated by renovateBot
2024-11-05 01:58:54 +00:00
Raja SubramanianandGitHub 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
ARJUN SHAJIandSean DuBois 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