Compare commits

...

10 Commits

Author SHA1 Message Date
bgrozev
d289f125a4
Expose AbstractUdpListener.localAddress. (#277) 2023-12-20 15:12:15 -08:00
Дамян Минков
0d8af275cd Update README.md forum link. 2023-11-20 16:32:27 -06:00
Jonathan Lennox
1c60acc59b
Update for ktlint 1.0.0 (ktlint-maven-plugin 3.0.0). (#273) 2023-10-03 11:20:28 -04:00
bgrozev
fd43e6c181
Fix consent checks (#272)
* fix: Fix sending consent checks (wrong property name).

* log: Log exceptions from PeriodicRunnable.
2023-10-02 07:38:14 -07:00
Jonathan Lennox
27ad37d1af
Update Kotlin to 1.9.10, and related Maven packages, and jitsi-utils and jicoco. (#271)
* Update Kotlin to 1.9.10, and related Maven packages, and jitsi-utils and jicoco.

* Update ktlint-maven-plugin.
2023-09-29 12:22:20 -04:00
bgrozev
9fe2d69cf1
Randomize consent check interval (follow rfc7675). (#270)
* Randomize consent check interval (follow rfc7675).
2023-08-23 14:38:31 -07:00
bgrozev
a947919f40
test: Use meet-jit-si-turnrelay.jitsi.net for STUN, do not use TURN in tests. (#269) 2023-03-06 08:58:41 -06:00
bgrozev
76e8a1968d
fix: Fix creating STUN harvesters when no local addresses are allowed. (#265) 2022-10-21 16:21:23 -05:00
Jonathan Lennox
28a23e1859
Update kotlin version. (#262) 2022-05-26 16:34:13 -04:00
Ingo Bauersachs
71e244dd67 Update dependencies 2022-05-16 09:24:32 -05:00
13 changed files with 107 additions and 85 deletions

View File

@ -7,3 +7,11 @@ 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

View File

@ -11,7 +11,7 @@ on:
env: env:
# Java version to use for the release # Java version to use for the release
RELEASE_JAVA_VERSION: 8 RELEASE_JAVA_VERSION: 11
jobs: jobs:
test: test:
@ -19,16 +19,16 @@ jobs:
strategy: strategy:
matrix: matrix:
java: [ 8, 11, 17 ] java: [ 11, 17 ]
name: Java ${{ matrix.java }} name: Java ${{ matrix.java }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Set up JDK ${{ matrix.java }} - name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v2 uses: actions/setup-java@v3
with: with:
distribution: temurin distribution: temurin
java-version: ${{ matrix.java }} java-version: ${{ matrix.java }}
@ -39,7 +39,7 @@ jobs:
- name: Upload coverage report - name: Upload coverage report
if: matrix.java == env.RELEASE_JAVA_VERSION if: matrix.java == env.RELEASE_JAVA_VERSION
uses: codecov/codecov-action@v1 uses: codecov/codecov-action@v2
release: release:
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'
@ -47,12 +47,12 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Set up JDK - name: Set up JDK
uses: actions/setup-java@v2 uses: actions/setup-java@v3
with: with:
distribution: temurin distribution: temurin
java-version: ${{ env.RELEASE_JAVA_VERSION }} java-version: ${{ env.RELEASE_JAVA_VERSION }}

View File

@ -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 [dev mailing list](https://jitsi.org/Development/MailingLists) for questions and discussions. ice4j is maintained by the [Jitsi](https://jitsi.org/) community. Use Jitsi's [community forum](https://community.jitsi.org) for questions and discussions.
Thanks Thanks
------ ------

58
pom.xml
View File

@ -38,10 +38,11 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jicoco.version>1.1-95-gd8fd866</jicoco.version> <jicoco.version>1.1-127-gf49982f</jicoco.version>
<kotlin.version>1.5.31</kotlin.version> <kotlin.version>1.9.10</kotlin.version>
<kotest.version>4.6.3</kotest.version> <dokka.version>1.9.0</dokka.version>
<junit.version>5.8.1</junit.version> <kotest.version>5.7.2</kotest.version>
<junit.version>5.10.0</junit.version>
</properties> </properties>
<dependencies> <dependencies>
@ -58,7 +59,7 @@
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>
<artifactId>jitsi-utils</artifactId> <artifactId>jitsi-utils</artifactId>
<version>1.0-114-g43815ed</version> <version>1.0-127-g6c65524</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>
@ -70,7 +71,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.8.1</version> <version>1.10.0</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -106,7 +107,13 @@
<dependency> <dependency>
<groupId>org.mockito</groupId> <groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId> <artifactId>mockito-core</artifactId>
<version>4.0.0</version> <version>4.5.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.mockk</groupId>
<artifactId>mockk-jvm</artifactId>
<version>1.13.8</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
@ -146,7 +153,7 @@
</execution> </execution>
</executions> </executions>
<configuration> <configuration>
<jvmTarget>1.8</jvmTarget> <jvmTarget>11</jvmTarget>
<args> <args>
<arg>-Xallow-result-return-type</arg> <arg>-Xallow-result-return-type</arg>
</args> </args>
@ -155,7 +162,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version> <version>3.10.1</version>
<executions> <executions>
<!-- Replacing default-compile as it is treated specially by maven --> <!-- Replacing default-compile as it is treated specially by maven -->
<execution> <execution>
@ -183,8 +190,7 @@
</execution> </execution>
</executions> </executions>
<configuration> <configuration>
<source>1.8</source> <release>11</release>
<target>1.8</target>
<compilerArgs> <compilerArgs>
<arg>-Xlint:all</arg> <arg>-Xlint:all</arg>
</compilerArgs> </compilerArgs>
@ -193,10 +199,17 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId> <artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.1</version> <version>3.1.2</version>
<configuration> <configuration>
<configLocation>checkstyle.xml</configLocation> <configLocation>checkstyle.xml</configLocation>
</configuration> </configuration>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>10.1</version>
</dependency>
</dependencies>
<executions> <executions>
<execution> <execution>
<goals> <goals>
@ -208,7 +221,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>1.7.0</version> <version>3.0.0</version>
<configuration> <configuration>
<sourceRoots> <sourceRoots>
<sourceRoot>${project.basedir}/src/main/kotlin</sourceRoot> <sourceRoot>${project.basedir}/src/main/kotlin</sourceRoot>
@ -229,7 +242,7 @@
<plugin> <plugin>
<groupId>biz.aQute.bnd</groupId> <groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId> <artifactId>bnd-maven-plugin</artifactId>
<version>5.2.0</version> <version>6.2.0</version>
<executions> <executions>
<execution> <execution>
<goals> <goals>
@ -241,7 +254,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version> <version>3.2.2</version>
<configuration> <configuration>
<archive> <archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
@ -251,7 +264,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version> <version>3.0.0-M6</version>
<configuration> <configuration>
<includes>**/*</includes> <includes>**/*</includes>
<systemPropertyVariables> <systemPropertyVariables>
@ -262,12 +275,12 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId> <artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version> <version>3.0.0-M2</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.sonatype.plugins</groupId> <groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId> <artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version> <version>1.6.13</version>
<extensions>true</extensions> <extensions>true</extensions>
<configuration> <configuration>
<serverId>ossrh</serverId> <serverId>ossrh</serverId>
@ -282,6 +295,7 @@
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId> <artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<executions> <executions>
<execution> <execution>
<goals> <goals>
@ -311,7 +325,7 @@
<plugin> <plugin>
<groupId>org.jacoco</groupId> <groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId> <artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.7</version> <version>0.8.8</version>
<executions> <executions>
<execution> <execution>
<goals> <goals>
@ -448,7 +462,7 @@
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId> <artifactId>build-helper-maven-plugin</artifactId>
<version>3.2.0</version> <version>3.3.0</version>
<executions> <executions>
<execution> <execution>
<phase>generate-sources</phase> <phase>generate-sources</phase>
@ -480,7 +494,7 @@
<plugin> <plugin>
<groupId>org.jetbrains.dokka</groupId> <groupId>org.jetbrains.dokka</groupId>
<artifactId>dokka-maven-plugin</artifactId> <artifactId>dokka-maven-plugin</artifactId>
<version>${kotlin.version}</version> <version>${dokka.version}</version>
<executions> <executions>
<execution> <execution>
<phase>package</phase> <phase>package</phase>
@ -493,7 +507,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId> <artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version> <version>3.0.1</version>
<executions> <executions>
<execution> <execution>
<id>sign-artifacts</id> <id>sign-artifacts</id>

View File

@ -21,7 +21,6 @@ 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.*;
@ -70,15 +69,6 @@ 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.
@ -2656,7 +2646,19 @@ public class Agent
{ {
if (shouldRunStunKeepAlive()) if (shouldRunStunKeepAlive())
{ {
return Duration.ofMillis(keepAliveSent == 0 ? 0 : consentFreshnessInterval); if (keepAliveSent == 0)
{
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);
} }

View File

@ -260,6 +260,11 @@ 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.
*/ */

View File

@ -220,17 +220,14 @@ public class MappingCandidateHarvesters
List<Callable<StunMappingCandidateHarvester>> tasks = new LinkedList<>(); List<Callable<StunMappingCandidateHarvester>> tasks = new LinkedList<>();
// Create a StunMappingCandidateHarvester for each local:remote address // Create a StunMappingCandidateHarvester for each local:remote address pair.
// pair. List<InetAddress> localAddresses = HostCandidateHarvester.getAllAllowedAddresses();
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: " logger.severe("Failed to parse STUN server address: " + stunServer);
+ stunServer);
continue; continue;
} }
int port; int port;
@ -259,15 +256,12 @@ public class MappingCandidateHarvesters
continue; continue;
} }
TransportAddress localAddress TransportAddress localAddress = new TransportAddress(localInetAddress, 0, Transport.UDP);
= 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( = new StunMappingCandidateHarvester(localAddress, remoteAddress);
localAddress,
remoteAddress);
Callable<StunMappingCandidateHarvester> task = () -> Callable<StunMappingCandidateHarvester> task = () ->
{ {
@ -278,8 +272,14 @@ public class MappingCandidateHarvesters
} }
} }
// Now run discover() on all created harvesters in parallel and pick if (tasks.isEmpty())
// 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

View File

@ -1,5 +1,7 @@
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.*;
@ -11,6 +13,11 @@ 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.
@ -205,6 +212,10 @@ 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)

View File

@ -27,6 +27,10 @@ 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) }

View File

@ -31,6 +31,9 @@ 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.

View File

@ -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.test.concurrent.*; import org.jitsi.utils.concurrent.*;
import org.junit.jupiter.api.*; import org.junit.jupiter.api.*;
/** /**
@ -21,12 +21,7 @@ public class PeriodicRunnableTests
@BeforeEach @BeforeEach
void beforeEach() void beforeEach()
{ {
timer = mock( timer = new FakeScheduledExecutorService();
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 ->
{ {

View File

@ -339,29 +339,9 @@ public class Ice
{ {
// STUN // STUN
StunCandidateHarvester stunHarv = new StunCandidateHarvester( StunCandidateHarvester stunHarv = new StunCandidateHarvester(
new TransportAddress("stun.jitsi.net", 3478, Transport.UDP)); new TransportAddress("meet-jit-si-turnrelay.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.

View File

@ -20,7 +20,7 @@ import io.kotest.core.spec.IsolationMode
import io.kotest.core.spec.Spec import io.kotest.core.spec.Spec
import io.kotest.core.spec.style.ShouldSpec import io.kotest.core.spec.style.ShouldSpec
import io.kotest.extensions.system.withSystemProperties import io.kotest.extensions.system.withSystemProperties
import org.jitsi.config.useNewConfig import org.jitsi.config.withNewConfig
import org.jitsi.metaconfig.MetaconfigSettings import org.jitsi.metaconfig.MetaconfigSettings
/** /**
@ -29,13 +29,13 @@ import org.jitsi.metaconfig.MetaconfigSettings
abstract class ConfigTest : ShouldSpec() { abstract class ConfigTest : ShouldSpec() {
override fun isolationMode(): IsolationMode? = IsolationMode.InstancePerLeaf override fun isolationMode(): IsolationMode? = IsolationMode.InstancePerLeaf
override fun beforeSpec(spec: Spec) { override suspend fun beforeSpec(spec: Spec) {
super.beforeSpec(spec) super.beforeSpec(spec)
MetaconfigSettings.cacheEnabled = false MetaconfigSettings.cacheEnabled = false
} }
inline fun withNewConfig(config: String, block: () -> Unit) { inline fun withNewConfig(config: String, block: () -> Unit) {
useNewConfig("new-${this::class.simpleName}", config, true, block) withNewConfig(config, "new-${this::class.simpleName}", true, block)
} }
fun withLegacyConfig(config: Map<String, String?>, block: () -> Unit) = withSystemProperties(config) { block } fun withLegacyConfig(config: Map<String, String?>, block: () -> Unit) = withSystemProperties(config) { block }