Commit Graph

68 Commits

Author SHA1 Message Date
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
Will Forcey
55ce2f2b05 Add test for setting nil candidatepair
This was already fixed in c2e6f9, but adding a test to ensure we don't
regress

Resolves #303
2021-01-16 23:04:29 -08:00
ZHENK
7c897626c1 Accept nil Candidate in AddRemoteCandidate
Allow a user to pass a nil Candidate. We perform no actions off of this
currently. Until browsers implement end-of-candidates consistently it
isn't something we can do.

Relates to pion/webrtc#1212 and #271
2020-12-08 20:50:37 -08:00
Sean DuBois
c8afc270b0 Add failing test for #288
ICE-lite Agent doesn't detect disconnects
2020-10-12 13:08:56 -07: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
Yutaka Takeda
5d2bbc818c Increase binding req timeout value
Resolves #255
2020-07-26 12:08:17 -07:00
Sam Lancia
a4a53ab443 Agent: Frequent candidate check when connecting
Previously in the connecting phase, a gathered peer reflexive candidate
which is by default nominated after 500mS, would have to wait 2s
(default taskLoopInterval) before being nominated.
2020-07-05 17:45:01 +09:00
Atsushi Watanabe
6b045b828f Stabilize callback deadlock test
Wait until checking in OnSelectedCandidatePairChange callback.
2020-07-05 17:17:01 +09:00
Atsushi Watanabe
77a072692c Fix deadlock in SelectedCandidatePairChange
Call handler in different routine.
2020-07-05 16:05:45 +09:00
Atsushi Watanabe
06922c1601 Refactor agent task runner
- Control blocking tasks by context
- Add tests to check deadlock by calling Close/Restart in
  state change callback
- Remove unnecessary chan
2020-07-05 16:05:45 +09:00
Sean DuBois
bd57bd814c Make Credential getters thread safe
GetRemoteUserCredentials and GetLocalUserCredentials were
not thread safe. This puts them both behind a .run
2020-06-29 19:37:25 -07:00
Sean DuBois
bc8f00d8e0 Add GetRemoteUserCredentials
Need by pion/webrtc for ICE Restarts

Relates to pion/webrtc#1251
2020-06-29 08:34:18 -07:00
Atsushi Watanabe
a64ddd064c Fix TestAgentRestart stability
Task loop interval was 2s and disconnect/fail timeout was 1s.
If the first ping packet after the pair nomination was dropped,
it entered failed state.
2020-06-28 12:43:03 -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
Atsushi Watanabe
ab4eba1707 Add routine leak checks
To find out routine leak source.
2020-06-26 11:16:59 -07:00
Atsushi Watanabe
1f0d0a213c Fix TestConnectivityOnStartup
It failed when accepting routine is not started faster than dial.
2020-06-25 20:26:37 -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
Sean DuBois
5a7603837b Set defaultKeepaliveInterval to 2 seconds
This should be lower then defaultDisconnectTimeout otherwise
we are going to enter disconnected.

Also rename defaultDisconnectTimeout -> defaultDisconnectedTimeout
to make the tense consistent with other options

Resolves #190
2020-06-25 00:16:58 -07:00
Sean DuBois
5cab987ca4 Add an additional done to Agent.run
Callers of run need to be able to cancel their waiting individually.
This would cause hung threads during restart if we attempted to close
a candidate while processing a packet for it.

Before the run would be canceled by the global close, but we can't
depend on that anymore.

Resolves #190
2020-06-25 00:16:58 -07:00
Sean DuBois
f195edb4c1 Implement SetRemoteCredentials and Restart
Add simple tests that check it works E2E

Resolves #190
2020-06-25 00:16:58 -07:00
Sean DuBois
e264665676 Move Checking -> Failed handling out of Selection
Selection before was written in a way that wouldn't work for restarts.
This moves the code out and makes it stateless. In the future we will be
able to clear the candidates and update the ConnectionState and
everything will restart properly.

Relates to #190
2020-06-25 00:16:58 -07:00
Sean DuBois
c97476bb42 Add Failed state to Agent
This is currently fatal because you can't do an restart.

Resolves #189
2020-06-21 01:06:53 -07:00
Sean DuBois
0c308ea365 Rename ConnectionTimeout -> DisconnectTimeout
ICE has two distinct states `Disconnected` and `Failed`. We need to
split out these arguments so that we can control (and test) both.

Relates to #190
2020-06-21 01:06:53 -07:00
Sean DuBois
dd1e92e33c Remove taskLoopInterval from TestConnectivityLite
Connectivity checks are over UDP, if we lost any message
message this would cause the test to fail.

Resolves #149
2020-02-25 11:08:35 -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
Atsushi Watanabe
b8eb3d4ec4 Upgrade golangci-lint to 1.19.1
Fix whitespace error.
Disable dogsled and godox.
2020-01-11 22:58:26 -08:00
Nevio Vesic
a077bc201a Allow setting local credentials via AgentConfig
Add local credential support to the AgentConfig and
validate credentials per RFC standard. If no credentials
are passed we still generate random ones ourselves.
2019-11-08 01:09:08 -08: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
Jason Maldonis
34ef65fcea Lifetime instead of length for binding requests
Before we have a hard limit of 50, this will fall down if users
has more local/remote candidates then we expect.

Resolves #122

Co-authored-by: Sean DuBois <sean@siobud.com>
2019-10-15 21:59:32 -07:00
Yutaka Takeda
867a355033 Support 1:1 NAT option
Relates to pion/webrtc#835
2019-09-24 11:51:07 -07:00
Sebastian Waisbrot
953f36f07f Add config to run Agent in Lite mode
Allow the agent to run in Lite mode. This is useful in
cases where you never want connectivity checks, and reduces
possible attacks surfaces when you have a public IP.
2019-09-02 16:13:08 -07:00
Hugo Arregui
aab2d5ba84 Use vnet for ConnectivityOnStartup test
The test was failing if the first ContactCandidates was not enough to
establish the connection.
2019-08-13 18:09:22 +00:00
Atsushi Watanabe
0f5c553070 Fix Ticker leak
time.Ticker leaks if not Stop()-ed after use.
Close connectivity interval ticker on Agent.Close() to fix leak.
2019-08-01 07:21:42 -07:00
Hugo Arregui
77a03cd608 Use config to create candidate
Use config objects to create candidates + add optional candidateID
2019-06-25 19:30:23 +00:00