54 Commits

Author SHA1 Message Date
Joe Turki
ee3a2e4341 Fix the tests on Windows 2025-09-22 17:39:54 +03: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
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
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
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
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
b2e40ad7fa Partial undo of 85a3a7f524
Broke i386 tests
2024-03-23 20:34:30 -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
dinvlad
77cc354d7f Respect IncludeLoopback in UDPMuxDefault
Currently, when using UDPMuxDefault with unspecified address,
the loopback address is included by default, but
agentConfig.IncludeLoopback is not respected when gathering
local candidates.

The same holds true when UDPMuxDefault is configured with a loopback
address, but agentConfig.IncludeLoopback is not explicitly set to
true.

This commit adds an extra check to gatherCandidatesLocalUDPMux()
for respecting that setting in both cases.
2024-03-20 13:37:34 -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
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
ca9de18fd6 Move URL type to pion/stun.URI 2023-05-10 16:33:20 +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
aler9
03471f5adc Fix regression with UDPMuxDefault and NAT1To1IPs
PR #496 added a mechanism to close connections of duplicate candidates
and avoid memory leaks. When UDPMuxDefault and NAT1To1IPs are used
together, candidates may share the same connection, and candidates may
be equal, since their IPs are overridden by the one specified in
NAT1To1IPs. When a duplicate candidate is found, its connection is
closed, making impossible to use any other candidate that shares the
same connection.

This PR fixes the issue as it prevents duplicate candidates from
creating connections and getting their connection closed.
2023-04-14 23:15:17 +02:00
Steffen Vogel
c6c0a15708 Fix new golangci-lint errors 2023-04-12 09:27:03 +02:00
Miroslav Šedivý
cf6f758882 Fix gathering candidates race condition
Canceling previous gathering does not happen synchronously. If it takes
a little bit longer, it can close newly created `gatherCandidateDone`
channel. If we pass channel to the `gatherCandidates` function, it will
always close its done channel and only the latest done channel will be
available in `gatherCandidateDone`.
2023-03-28 12:26:58 -04: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
cnderrauber
e90a58e51a Add option to include loopback candidate
Add option to include loopback candidate
2022-11-22 17:07:31 +08:00
cnderrauber
227b290b77 Solve comments and clean code
Solve comments and clean code
2022-10-10 20:22:30 +08:00
cnderrauber
04a6027e93 Use MultiUDPMux to implement listen any address
In #475, import low-level API (ReadMsgUDP) to determine
destination interface for packets received by UDPConn listen
at any(unspecified) address, to fix msg received by incorrect
candidate that shared same ufrags. But the api has compatibility
issues, also not reliable in some special network cases like
AWS/ECS.
So this pr revert that change, and make UDPMuxDefault not
accept Conn listen at unspecified address. Also provide a
NewMultiUDPMuxFromPort helper function to create a MultiUDPMux
to listen at all addresses.
For ice gather, it will use UDPMux's listen address to generate
canidates instead of create it from interfaces.
2022-10-10 20:22:30 +08:00
cnderrauber
cd0a968a62 Add IPFilter to AgentConfig
When machine's network interface have more than one ip address and
user don't want expose one of these ips to remote peer, interface
filter can't work in this case, so add a ip filter for that.
2022-09-29 14:06:21 +08: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
Kevin Caffrey
169ff6a7b4 Add multi-port wrappers for UDPMux and TCPMux
These wrappers allow a caller to provide UDPMux and TCPMux instances
to the ICE agent that represent multiple open ports. This can be
desirable in what would otherwise be single-port deployments, as it
increases the chance that one of the fixed ports will not be blocked
by a users firewall.
2022-09-12 15:30:42 -04:00
Sean DuBois
9b523704bb Enable acceptAggressiveNomination by default
Always accept Aggressive Nominations by remote agent

Relates to 18f7a214aa
2022-04-22 15:12:20 -04:00
Antoine Baché
45ff379fd3 Makes UDPMux IPv4/IPv6 aware
UDPMux before only worked with UDP4 traffic.
UDP6 traffic would simply be ignored.

This commit implements 2 connections per ufrag. When requesting a
connection for a ufrag the user must specify if they want IPv4 or IPv6.

Relates to pion/webrtc#1915
2022-03-02 19:02:34 +01:00
Mikhail Bragin
2d70ec8e3c Support UDP muxing for SRFLX candidates
The original UDPMux only works for the HOST candidates.
UniversalUDPMux adds support for SRFLX candidates
and will later support Relay candidates.
UniversalUDPMux embeds UDPMuxDefault and
handles STUN server packets to discover XORMappedAddr
forwarding the remaining packets for muxing to UDPMuxDefault.
2022-02-20 12:29:29 -08:00
Assad Obaid
64a2cf0c47 Add proxy dialer interface
Enable user to implement the golang.org/x/net/proxy
dialer interface in order to have a customized dialer.
The customized dialer could be one that connect through
a corporate HTTP/HTTPS proxy.

Resolves #284
2020-10-09 12:09:21 -07:00
Pion
d3e1775d73 Update CI configs to v0.4.7
Update lint scripts and CI configs.
2020-09-26 08:54:24 -07:00
Jerko Steiner
3b9a989177 Remove global state for ICE TCP
This addresses a few points issue of #245:

 - Take a net.Listener instead of having global state
 - Expose a net.TCPMux based API

Also, the unused closeChannel was removed from tcp_mux.go

Closes #253.
2020-08-01 09:28:28 +02:00
Jerko Steiner
12f44e93f1 Add support for passive ICE TCP candidate
Closes #196
2020-07-15 07:51:55 +02:00
Lander Noterman
d8d3ef3aac Gather srflx candidates from turn: urls
allow gathering srflx candidates from turn: urls
2020-06-29 22:10:03 +02:00
Sam Lancia
5c1bbaa050 Gather all candidate types in parallel
This was an especially noticable issue in an environment
where all UDP was blocked, then we waited for STUN to
timeout (5 seconds) before trying TCP/turn
2020-06-28 12:49:38 -07:00
Atsushi Watanabe
47186b5abd Fix timeout check order
Timeout check must be inside the scope of routine leak check.
Routine leak check internally has wait for routine exit which
may causes timeout error in some case.
2020-06-26 11:16:59 -07:00
Sean DuBois
3b47033146 Remove non-trickle ICE
pion/webrtc@v3 will be trickle by default, so removing
support from here.  Users can easily simulate non-trickle
by setting a OnICECandidate callback.

This just reduces the amount of things we need to test/worry about.
2020-06-25 00:16:58 -07:00
Sam Lancia
b3ade1e219 Gather: fix closable crash again
Add assert for nil pointer as well
2020-06-06 03:17:05 -07:00
Sean DuBois
bf81fb5154 Implement TLS and DTLS Gathering
Also add tests to cover.

Resolves #133
2020-02-24 21:25:32 -08:00
Sean DuBois
3e38db1ea5 Gather TURN/STUN concurrently
Each URL is gathered in a goroutine. Add tests to ensure that this
doesn't regress in the future.

Resolves #118
2020-02-23 22:05:13 -08:00
Sean DuBois
9ca33c2380 Move localInterfaces and listenUDPInPortRange
Move more code out of the agent that doesn't actually require any state
from the ICE Agent.

Relates to #118
2020-02-23 22:05:13 -08:00
Sean DuBois
11318ea39f Cleanup gather code
Simplify tests and use assert where possible. Move all generic code out
of gather.go into util.go

Relates to #118
2020-02-23 22:05:13 -08:00
Atsushi Watanabe
d001618082 Support WASM build/test
Some tests using net.Conn connection are disabled for now
as it is not fully supported by WASM MVP stage.
2020-01-13 08:51:13 +09:00
Sean DuBois
e161aa966e Update to pion/transport@v0.8.10
Tests now assert for routine leaks on startup as well
2019-10-31 09:54:40 -07:00