Pre-allocate localAddrsForUnspecified slice with known capacity
and use index assignment instead of append to avoid multiple
slice reallocations.
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
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>
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>
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.
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.
Added `AddExtension` and `RemoveExtension` methods to `ICECandidate`,
allowing extensions to be managed dynamically.
Ensure that `TCPType` is stored in one place (candidate.TCPType)
- 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.