Commit Graph

43 Commits

Author SHA1 Message Date
Kevin Wang
4b50bc8078 Add support for renomination 2025-08-25 10:44:44 -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
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
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
Sean DuBois
abf50f9c34 Don't allocate new error inside TaskLoop
Libraries use errors.Is to catch this error. Allocating a new one inside
internal breaks that
2024-07-25 10:22:51 -05:00
sebapeti
66051b6877 Improve performance of UDPMux map lookups
UDPMux is using a map to lookup addresses of each packets.
Unfortunately the key is based on a string and each time we
want to check the map, a conversion of the UDP address to string
is made (.String()) which is expensive.

This CR replace the string key by a binary key called ipPort. This
structure contains a netip.Addr field and ipPort could be used as
a map key
2024-03-25 12:48:50 -04:00
Steffen Vogel
8d14c1f2e7 Harmonize errors and error logging
Signed-off-by: Steffen Vogel <post@steffenvogel.de>
2023-07-18 07:48:09 +02:00
Steffen Vogel
ca9de18fd6 Move URL type to pion/stun.URI 2023-05-10 16:33:20 +02:00
Steffen Vogel
8b166270df Fix capitalization of acronyms like UDP, TCP, STUN 2023-04-20 22:15:07 +02:00
Steffen Vogel
c596a7cc2b Simplify handling if no TCP mux is configured 2023-04-19 14:40:56 +02:00
Steffen Vogel
5ef81b65f4 Make package REUSE compliant 2023-04-18 13:46:38 +02:00
Steffen Vogel
67f28cf23a Move util.go to more appropriately named files
Move util.go to more appropriately named files
2023-02-10 22:48:36 +01:00
Steffen Vogel
fdfe34ab7b Harmonize capitalization of variable names
As most variable names are using camelCase.
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
227b290b77 Solve comments and clean code
Solve comments and clean code
2022-10-10 20:22:30 +08:00
cnderrauber
a70c38101c Fix lint for unused and duplicate code
Fix lint for unused and duplicate 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
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
Kacper Bąk
6ff52a9264 Fix typo in error comment
passoword -> password
2022-05-11 12:57:26 -04: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
Sean DuBois
b897e71a59 Expose ErrDetermineNetworkType
Expose this error so pion/webrtc can handle gracefully.
rfc8839#section-5.1 specifies that a WebRTC Agent MUST
ignore any name/value pairs it doesn't understand.

Relates to pion/webrtc#1949
2021-12-15 15:51:34 -05:00
Sean DuBois
e9caba4e03 Expose ErrUnknownCandidateTyp
Expose this error so pion/webrtc can handle gracefully.
rfc8839#section-5.1 specifies that a WebRTC Agent MUST
ignore any name/value pairs it doesn't understand.

Relates to pion/webrtc#1949
2021-12-15 12:18:08 -05:00
David Zhao
c4d5d1c670 Bypass other host candidates with UDPMux
Separate candidate gathering when UDPMux is enabled.
Only a single UDP host candidate should be generated
that points to the mux.
2021-04-25 14:07:45 -07:00
David Zhao
86d69d6ce5 Single port handling via UDPMux
Allows for ICE to handle connections on a single UDP port
2021-04-12 20:42:10 -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
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
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
2d60776193 Add MulticastDNSHostName to AgentConfig
Allow users to pass in a static MulticastDNSHostName, this can be used to
connect peers in a LAN without signaling. If you set a static uFrag/uPwd
on either side and have a static hostname you can gather without knowing
an IP Address on either side.
2019-12-08 20:04:29 -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
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
Sean DuBois
acbf5671b7 IP -> Address in public API
ICE RFC specifies this value as `Address` and not IP. We need to fix
this divergence to implement mDNS

Relates to pion/webrtc#699
2019-06-21 20:22:21 +08:00
Sean DuBois
78c7f4e989 Return error from GatherCandidates
When OnCandidate handler isn't defined and trickle
is enabled return an error

Relates to #51
2019-05-27 01:23:34 -07:00
Konstantin Itskov
e928d7b932 Add trickle support
Resolves #51
2019-05-27 01:23:34 -07:00
Sean DuBois
f88c7d2cfa Add Username/Password to URL
Needed to allow auth for TURN
2019-05-25 16:20:23 -07:00
Sean DuBois
bb69dcb592 Assert that agent isn't started twice
Check was lost, also add tests so we don't regress again
2019-04-25 16:45:38 -07:00
Sean DuBois
3580f6234f Return typed error when no candidate pairs
Returning a typed error allows us to handle it gracefully in
pions/webrtc
2019-03-26 00:50:44 -07:00
Sean DuBois
be2ef55e62 Remove pkg/errors dependency
Lots of people are paying attention to what dependecies we add to their
projects now. This just makes things a little cleaner.

Resolves #469
2019-03-06 09:34:10 -08:00
Michael MacDonald
dc966e04a9 Move pkg/ice to internal/ice
Avoid exposing any non-standard API.
2019-03-01 08:07:42 -05:00