Compare commits
1 Commits
master
...
update-dep
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a422c5983c |
@ -7,11 +7,3 @@ charset = utf-8
|
|||||||
indent_size = 2
|
indent_size = 2
|
||||||
indent_style = space
|
indent_style = space
|
||||||
max_line_length = 120
|
max_line_length = 120
|
||||||
|
|
||||||
[*.{kt,kts}]
|
|
||||||
max_line_length = 120
|
|
||||||
ktlint_code_style = intellij_idea
|
|
||||||
|
|
||||||
# I find trailing commas annoying
|
|
||||||
ktlint_standard_trailing-comma-on-call-site = disabled
|
|
||||||
ktlint_standard_trailing-comma-on-declaration-site = disabled
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@ The Interactive Connectivity Establishment (ICE) protocol combines various NAT t
|
|||||||
|
|
||||||
This project provides a Java implementation of the ICE protocol that would be usable by both SIP and XMPP applications. The project also provides features such as socket sharing and support for Pseudo TCP.
|
This project provides a Java implementation of the ICE protocol that would be usable by both SIP and XMPP applications. The project also provides features such as socket sharing and support for Pseudo TCP.
|
||||||
|
|
||||||
ice4j is maintained by the [Jitsi](https://jitsi.org/) community. Use Jitsi's [community forum](https://community.jitsi.org) for questions and discussions.
|
ice4j is maintained by the [Jitsi](https://jitsi.org/) community. Use Jitsi's [dev mailing list](https://jitsi.org/Development/MailingLists) for questions and discussions.
|
||||||
|
|
||||||
Thanks
|
Thanks
|
||||||
------
|
------
|
||||||
|
|||||||
23
pom.xml
23
pom.xml
@ -38,11 +38,10 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<jicoco.version>1.1-127-gf49982f</jicoco.version>
|
<jicoco.version>1.1-104-g20c4353</jicoco.version>
|
||||||
<kotlin.version>1.9.10</kotlin.version>
|
<kotlin.version>1.5.31</kotlin.version>
|
||||||
<dokka.version>1.9.0</dokka.version>
|
<kotest.version>5.3.0</kotest.version>
|
||||||
<kotest.version>5.7.2</kotest.version>
|
<junit.version>5.8.2</junit.version>
|
||||||
<junit.version>5.10.0</junit.version>
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -59,7 +58,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>${project.groupId}</groupId>
|
<groupId>${project.groupId}</groupId>
|
||||||
<artifactId>jitsi-utils</artifactId>
|
<artifactId>jitsi-utils</artifactId>
|
||||||
<version>1.0-127-g6c65524</version>
|
<version>1.0-114-g43815ed</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>${project.groupId}</groupId>
|
<groupId>${project.groupId}</groupId>
|
||||||
@ -71,7 +70,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.platform</groupId>
|
<groupId>org.junit.platform</groupId>
|
||||||
<artifactId>junit-platform-launcher</artifactId>
|
<artifactId>junit-platform-launcher</artifactId>
|
||||||
<version>1.10.0</version>
|
<version>1.8.2</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -110,12 +109,6 @@
|
|||||||
<version>4.5.1</version>
|
<version>4.5.1</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>io.mockk</groupId>
|
|
||||||
<artifactId>mockk-jvm</artifactId>
|
|
||||||
<version>1.13.8</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@ -221,7 +214,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>com.github.gantsign.maven</groupId>
|
<groupId>com.github.gantsign.maven</groupId>
|
||||||
<artifactId>ktlint-maven-plugin</artifactId>
|
<artifactId>ktlint-maven-plugin</artifactId>
|
||||||
<version>3.0.0</version>
|
<version>1.13.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<sourceRoots>
|
<sourceRoots>
|
||||||
<sourceRoot>${project.basedir}/src/main/kotlin</sourceRoot>
|
<sourceRoot>${project.basedir}/src/main/kotlin</sourceRoot>
|
||||||
@ -494,7 +487,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.jetbrains.dokka</groupId>
|
<groupId>org.jetbrains.dokka</groupId>
|
||||||
<artifactId>dokka-maven-plugin</artifactId>
|
<artifactId>dokka-maven-plugin</artifactId>
|
||||||
<version>${dokka.version}</version>
|
<version>${kotlin.version}</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import org.ice4j.*;
|
|||||||
import org.ice4j.ice.harvest.*;
|
import org.ice4j.ice.harvest.*;
|
||||||
import org.ice4j.stack.*;
|
import org.ice4j.stack.*;
|
||||||
import org.ice4j.util.PeriodicRunnable;
|
import org.ice4j.util.PeriodicRunnable;
|
||||||
|
import org.jitsi.utils.collections.*;
|
||||||
import org.jitsi.utils.concurrent.*;
|
import org.jitsi.utils.concurrent.*;
|
||||||
import org.jitsi.utils.logging2.Logger;
|
import org.jitsi.utils.logging2.Logger;
|
||||||
import org.jitsi.utils.logging2.*;
|
import org.jitsi.utils.logging2.*;
|
||||||
@ -69,6 +70,15 @@ public class Agent
|
|||||||
private static final PropertyChangeListener[] NO_STATE_CHANGE_LISTENERS
|
private static final PropertyChangeListener[] NO_STATE_CHANGE_LISTENERS
|
||||||
= new PropertyChangeListener[0];
|
= new PropertyChangeListener[0];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link Logger} used by the {@link Agent} class for logging output.
|
||||||
|
* Note that this shouldn't be used directly by instances of {@link Agent},
|
||||||
|
* because it doesn't take into account the per-instance log level.
|
||||||
|
* Instances should use {@link #logger} instead.
|
||||||
|
*/
|
||||||
|
private static final java.util.logging.Logger classLogger
|
||||||
|
= java.util.logging.Logger.getLogger(Agent.class.getName());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the {@link PropertyChangeEvent} that we use to deliver
|
* The name of the {@link PropertyChangeEvent} that we use to deliver
|
||||||
* events on changes in the state of ICE processing in this agent.
|
* events on changes in the state of ICE processing in this agent.
|
||||||
@ -2646,19 +2656,7 @@ public class Agent
|
|||||||
{
|
{
|
||||||
if (shouldRunStunKeepAlive())
|
if (shouldRunStunKeepAlive())
|
||||||
{
|
{
|
||||||
if (keepAliveSent == 0)
|
return Duration.ofMillis(keepAliveSent == 0 ? 0 : consentFreshnessInterval);
|
||||||
{
|
|
||||||
return Duration.ZERO;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
double r = 1;
|
|
||||||
if (config.getRandomizeConsentFreshnessInterval())
|
|
||||||
{
|
|
||||||
r = 0.8d + ThreadLocalRandom.current().nextDouble() * 0.4;
|
|
||||||
}
|
|
||||||
return Duration.ofMillis((long) (consentFreshnessInterval * r));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return Duration.ofMillis(-1);
|
return Duration.ofMillis(-1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -260,11 +260,6 @@ public abstract class AbstractUdpListener
|
|||||||
thread.start();
|
thread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TransportAddress getLocalAddress()
|
|
||||||
{
|
|
||||||
return localAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Triggers the termination of the threads of this instance.
|
* Triggers the termination of the threads of this instance.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -220,14 +220,17 @@ public class MappingCandidateHarvesters
|
|||||||
|
|
||||||
List<Callable<StunMappingCandidateHarvester>> tasks = new LinkedList<>();
|
List<Callable<StunMappingCandidateHarvester>> tasks = new LinkedList<>();
|
||||||
|
|
||||||
// Create a StunMappingCandidateHarvester for each local:remote address pair.
|
// Create a StunMappingCandidateHarvester for each local:remote address
|
||||||
List<InetAddress> localAddresses = HostCandidateHarvester.getAllAllowedAddresses();
|
// pair.
|
||||||
|
List<InetAddress> localAddresses
|
||||||
|
= HostCandidateHarvester.getAllAllowedAddresses();
|
||||||
for (String stunServer : stunServers)
|
for (String stunServer : stunServers)
|
||||||
{
|
{
|
||||||
String[] addressAndPort = stunServer.split(":");
|
String[] addressAndPort = stunServer.split(":");
|
||||||
if (addressAndPort.length < 2)
|
if (addressAndPort.length < 2)
|
||||||
{
|
{
|
||||||
logger.severe("Failed to parse STUN server address: " + stunServer);
|
logger.severe("Failed to parse STUN server address: "
|
||||||
|
+ stunServer);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int port;
|
int port;
|
||||||
@ -256,12 +259,15 @@ public class MappingCandidateHarvesters
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
TransportAddress localAddress = new TransportAddress(localInetAddress, 0, Transport.UDP);
|
TransportAddress localAddress
|
||||||
|
= new TransportAddress(localInetAddress, 0, Transport.UDP);
|
||||||
|
|
||||||
logger.info("Using " + remoteAddress + " for StunMappingCandidateHarvester (localAddress="
|
logger.info("Using " + remoteAddress + " for StunMappingCandidateHarvester (localAddress="
|
||||||
+ localAddress + ").");
|
+ localAddress + ").");
|
||||||
final StunMappingCandidateHarvester stunHarvester
|
final StunMappingCandidateHarvester stunHarvester
|
||||||
= new StunMappingCandidateHarvester(localAddress, remoteAddress);
|
= new StunMappingCandidateHarvester(
|
||||||
|
localAddress,
|
||||||
|
remoteAddress);
|
||||||
|
|
||||||
Callable<StunMappingCandidateHarvester> task = () ->
|
Callable<StunMappingCandidateHarvester> task = () ->
|
||||||
{
|
{
|
||||||
@ -272,14 +278,8 @@ public class MappingCandidateHarvesters
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tasks.isEmpty())
|
// Now run discover() on all created harvesters in parallel and pick
|
||||||
{
|
// the ones which succeeded.
|
||||||
logger.warning("STUN mapping harvesters are configured, but no allowed local addresses were found." +
|
|
||||||
" Not using STUN.");
|
|
||||||
return stunHarvesters;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now run discover() on all created harvesters in parallel and pick the ones which succeeded.
|
|
||||||
ExecutorService es = ExecutorFactory.createFixedThreadPool(tasks.size(), "ice4j.Harvester-executor-");
|
ExecutorService es = ExecutorFactory.createFixedThreadPool(tasks.size(), "ice4j.Harvester-executor-");
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
package org.ice4j.util;
|
package org.ice4j.util;
|
||||||
|
|
||||||
import org.jitsi.utils.logging2.*;
|
|
||||||
|
|
||||||
import java.time.*;
|
import java.time.*;
|
||||||
import java.util.concurrent.*;
|
import java.util.concurrent.*;
|
||||||
|
|
||||||
@ -13,11 +11,6 @@ import java.util.concurrent.*;
|
|||||||
*/
|
*/
|
||||||
public abstract class PeriodicRunnable
|
public abstract class PeriodicRunnable
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* The {@link Logger} used by the {@link PeriodicRunnable} class for logging output.
|
|
||||||
*/
|
|
||||||
private final static Logger logger = new LoggerImpl(PeriodicRunnable.class.getName());
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A timer to perform periodic scheduling of {@link #run()} execution
|
* A timer to perform periodic scheduling of {@link #run()} execution
|
||||||
* on {@link #executor}'s thread.
|
* on {@link #executor}'s thread.
|
||||||
@ -212,10 +205,6 @@ public abstract class PeriodicRunnable
|
|||||||
{
|
{
|
||||||
this.run();
|
this.run();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
logger.warn("Exception in run(), will retry.", e);
|
|
||||||
}
|
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (running)
|
if (running)
|
||||||
|
|||||||
@ -27,10 +27,6 @@ class AgentConfig {
|
|||||||
"ice4j.consent-freshness.interval".from(configSource)
|
"ice4j.consent-freshness.interval".from(configSource)
|
||||||
}
|
}
|
||||||
|
|
||||||
val randomizeConsentFreshnessInterval: Boolean by config {
|
|
||||||
"ice4j.consent-freshness.randomize-interval".from(configSource)
|
|
||||||
}
|
|
||||||
|
|
||||||
val consentFreshnessOriginalWaitInterval: Duration by config {
|
val consentFreshnessOriginalWaitInterval: Duration by config {
|
||||||
"org.ice4j.ice.CONSENT_FRESHNESS_WAIT_INTERVAL".from(configSource)
|
"org.ice4j.ice.CONSENT_FRESHNESS_WAIT_INTERVAL".from(configSource)
|
||||||
.convertFrom<Long> { Duration.ofMillis(it) }
|
.convertFrom<Long> { Duration.ofMillis(it) }
|
||||||
|
|||||||
@ -31,9 +31,6 @@ ice4j {
|
|||||||
// The maximum number of retransmissions of a STUN Binding request without a valid STUN Binding response after which
|
// The maximum number of retransmissions of a STUN Binding request without a valid STUN Binding response after which
|
||||||
// consent freshness is to be considered unconfirmed according to `STUN Usage for Consent Freshness` (RFC7675).
|
// consent freshness is to be considered unconfirmed according to `STUN Usage for Consent Freshness` (RFC7675).
|
||||||
max-retransmissions = 30
|
max-retransmissions = 30
|
||||||
// Whether to randomize the period between any two checks between 0.8 and 1.2 of the configured interval as
|
|
||||||
// recommended in RFC7675 Section 5.1. We keep this configurable in case the previous behavior is desired.
|
|
||||||
randomize-interval = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configuration related to harvesting (aka gathering) of local candidates.
|
// Configuration related to harvesting (aka gathering) of local candidates.
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import static org.mockito.Mockito.*;
|
|||||||
|
|
||||||
import java.time.*;
|
import java.time.*;
|
||||||
import java.util.concurrent.*;
|
import java.util.concurrent.*;
|
||||||
import org.jitsi.utils.concurrent.*;
|
import org.jitsi.test.concurrent.*;
|
||||||
import org.junit.jupiter.api.*;
|
import org.junit.jupiter.api.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -21,7 +21,12 @@ public class PeriodicRunnableTests
|
|||||||
@BeforeEach
|
@BeforeEach
|
||||||
void beforeEach()
|
void beforeEach()
|
||||||
{
|
{
|
||||||
timer = new FakeScheduledExecutorService();
|
timer = mock(
|
||||||
|
FakeScheduledExecutorService.class,
|
||||||
|
withSettings()
|
||||||
|
.useConstructor()
|
||||||
|
.defaultAnswer(CALLS_REAL_METHODS)
|
||||||
|
);
|
||||||
executor = mock(ExecutorService.class);
|
executor = mock(ExecutorService.class);
|
||||||
when(executor.submit(any(Runnable.class))).thenAnswer(a ->
|
when(executor.submit(any(Runnable.class))).thenAnswer(a ->
|
||||||
{
|
{
|
||||||
|
|||||||
@ -339,9 +339,29 @@ public class Ice
|
|||||||
{
|
{
|
||||||
// STUN
|
// STUN
|
||||||
StunCandidateHarvester stunHarv = new StunCandidateHarvester(
|
StunCandidateHarvester stunHarv = new StunCandidateHarvester(
|
||||||
new TransportAddress("meet-jit-si-turnrelay.jitsi.net", 3478, Transport.UDP));
|
new TransportAddress("stun.jitsi.net", 3478, Transport.UDP));
|
||||||
|
StunCandidateHarvester stun6Harv = new StunCandidateHarvester(
|
||||||
|
new TransportAddress("stun6.jitsi.net", 3478, Transport.UDP));
|
||||||
|
|
||||||
agent.addCandidateHarvester(stunHarv);
|
agent.addCandidateHarvester(stunHarv);
|
||||||
|
agent.addCandidateHarvester(stun6Harv);
|
||||||
|
|
||||||
|
// TURN
|
||||||
|
String[] hostnames = new String[]
|
||||||
|
{
|
||||||
|
"stun.jitsi.net",
|
||||||
|
"stun6.jitsi.net"
|
||||||
|
};
|
||||||
|
int port = 3478;
|
||||||
|
LongTermCredential longTermCredential
|
||||||
|
= new LongTermCredential("guest", "anonymouspower!!");
|
||||||
|
|
||||||
|
for (String hostname : hostnames)
|
||||||
|
agent.addCandidateHarvester(
|
||||||
|
new TurnCandidateHarvester(
|
||||||
|
new TransportAddress(
|
||||||
|
hostname, port, Transport.UDP),
|
||||||
|
longTermCredential));
|
||||||
|
|
||||||
//UPnP: adding an UPnP harvester because they are generally slow
|
//UPnP: adding an UPnP harvester because they are generally slow
|
||||||
//which makes it more convenient to test things like trickle.
|
//which makes it more convenient to test things like trickle.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user