119 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
sirzooro
dd072edae9 Pass LoggerFactory to dtls and mdns (#772) 2025-04-12 19:09:54 +02: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
Kristian Paradis
ad0240747d Improve STUN resolution error message
Add network to resolve stun host error message
Most error message in gatherCandidatesSrflx and
gatherCandidatesSrflxUDPMux include the network in
them but not the one when failing to Resolve the host.
2024-04-16 10:10:31 -04:00
Stephan Rotolante
edaa25e409 Expose stunGatherTimeout in Agent struct (#668) 2024-04-02 23:17:51 -04:00
Eric Daniels
39c0392295 Support IPv6 from mDNS 2024-03-27 12:47:20 -04:00
Steffen Vogel
fdca6c47c0 Move taskloop into dedicated package
Reduce size of Agent and simplify code
2024-03-22 20:09:57 -04:00
José Mélançon
8680cd591f Match libwebrtc's TURN protocol priority
Today, all relay candidates from Pion have the same priority.
This PR attempts to reproduce libwebrtc's behavior, where the
TURN servers candidates priority is based on the underlying
relay protocol. UDP are preferred over TCP, which are preferred
over the TLS options.
2024-03-20 14:42:20 -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
Aleks Todorov
a72844663f Allow using mDNS candidates with UDP multiplexing 2024-03-20 13:16:52 -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
Atsushi Watanabe
efff4c4457 Fix connection close log
Printf arguments weren't passed to the logger.
2023-08-07 15:11:41 +09:00
ar-hosseinkhani
4f32f1057d Change log level for failed DNS resolution 2023-07-06 08:02:10 +02:00
Sean DuBois
abc1ca33b5 Revert active TCP candidate support
This reverts commit 00bbd2954c
and 1d502ca6ec
2023-05-24 00:05:44 -04:00
Steffen Vogel
00bbd2954c Minor style fixes for active TCP candidate support 2023-05-16 20:07:39 +02: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
8c5b0991ef Refactor local variables Rel{Addr,Port} 2023-04-20 22:15:07 +02:00
Steffen Vogel
2d2407b9c5 Refactor local variable TURNServerAddr 2023-04-20 22:15:07 +02:00
Steffen Vogel
8e15962f64 Simplify logging with gather's closeConnAndLog() 2023-04-20 22:15:07 +02:00
Steffen Vogel
ecfb354131 Fix capitalization of log messages
Log messages must start with an upper case letter
2023-04-20 22:15:07 +02:00
Steffen Vogel
b37a5a34eb Change working for logging errors 2023-04-20 22:15:07 +02:00
Steffen Vogel
1aa9d76f17 Make comments more readable 2023-04-20 22:15:07 +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
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
Rasmus Hanning
1f4b50ded8 Add ServerName to tlsConfig for TLS-over-TCP 2023-02-24 13:51:16 -05: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
583ad442c1 Replace closable interface by io.Closer
There is no need to define a custom interface.
2023-02-10 22:48:36 +01:00
Steffen Vogel
359f068c08 Move fakePacketConn to dedicated file
This is a first step to cleanup the gatherer code
2023-02-10 22:48:36 +01:00
Steffen Vogel
228c31f051 Fix comment and error name
Co-authored-by: Eric Daniels <eric@erdaniels.com>
2023-02-08 21:58:49 +01:00
Steffen Vogel
ef54990223 Fix linter warnings
Fix linter warnings
2023-02-08 21:58:49 +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
cnderrauber
e90a58e51a Add option to include loopback candidate
Add option to include loopback candidate
2022-11-22 17:07:31 +08:00
Steffen Vogel
dc5bce4401 Refactor variable names {r,s}addr to {r,s}Addr
As most variables are using camelCase.
2022-11-13 21:56:24 +01:00
Steffen Vogel
97c77bb1ce Refactor port{min,max} to port{Min,Max}
As most variable names are using camelCase.
2022-11-13 21:56:24 +01: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
Antoine Baché
cfc20992b4 Fix UDPMux memory leaks
Clients performing an early termination/cancelation
would cause `udpMuxedConn` to leak addresses
into `UDPMuxDefault`
2022-08-26 14:18:57 +02:00
Steffen Vogel
4669f66673 Improve UDPMux Error Logging
Include error in warning output if candidate
gathering via UDPmux fails.
2022-05-08 22:53:42 -04:00
Steffen Vogel
e32a520e4c Do not use newlines in logging statements
A newline is automatically added by the DefaultLeveledLogger.
The current code-base used a mix of log statements w/o endlines.
This is misleading for custom loggers.
2022-05-08 22:53:42 -04:00