mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-20 20:38:04 +01:00
Update calling routing to return urls only, no instance IPs
This commit is contained in:
@@ -117,7 +117,7 @@ public class TurnCallRouterTest {
|
||||
() -> callDnsRecords,
|
||||
() -> performanceTable,
|
||||
() -> manualTable,
|
||||
configTurnRouter,
|
||||
configTurnRouter,
|
||||
() -> geoIp,
|
||||
// set to true so the return values are predictable
|
||||
true
|
||||
@@ -162,6 +162,21 @@ public class TurnCallRouterTest {
|
||||
));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUrlsOnlyNoInstanceIps() throws UnknownHostException {
|
||||
when(performanceTable.getDatacentersFor(any(), any(), any(), any()))
|
||||
.thenReturn(List.of("dc-performance2", "dc-performance1"));
|
||||
when(configTurnRouter.shouldRandomize())
|
||||
.thenReturn(false);
|
||||
|
||||
assertThat(router().getRoutingFor(aci, Optional.of(InetAddress.getByName("0.0.0.1")), 0))
|
||||
.isEqualTo(new TurnServerOptions(
|
||||
TEST_HOSTNAME,
|
||||
null,
|
||||
TEST_URLS_WITH_HOSTS
|
||||
));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOrderedByPerformance() throws UnknownHostException {
|
||||
when(performanceTable.getDatacentersFor(any(), any(), any(), any()))
|
||||
|
||||
@@ -376,6 +376,23 @@ class DynamicConfigurationTest {
|
||||
|
||||
assertThat(turnConfiguration.getHostname()).isEqualTo("test.domain.org");
|
||||
assertThat(turnConfiguration.getRandomizeRate()).isEqualTo(100_000L);
|
||||
assertThat(turnConfiguration.getDefaultInstanceIpCount()).isEqualTo(0);
|
||||
}
|
||||
|
||||
{
|
||||
final String config = REQUIRED_CONFIG.concat("""
|
||||
turn:
|
||||
uriConfigs:
|
||||
- uris:
|
||||
- turn:test0.org
|
||||
- turn:test1.org
|
||||
defaultInstanceIpCount: 5
|
||||
""");
|
||||
DynamicTurnConfiguration turnConfiguration = DynamicConfigurationManager
|
||||
.parseConfiguration(config, DynamicConfiguration.class)
|
||||
.orElseThrow()
|
||||
.getTurnConfiguration();
|
||||
assertThat(turnConfiguration.getDefaultInstanceIpCount()).isEqualTo(5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,12 +34,10 @@ import org.whispersystems.textsecuregcm.auth.TurnToken;
|
||||
import org.whispersystems.textsecuregcm.auth.TurnTokenGenerator;
|
||||
import org.whispersystems.textsecuregcm.calls.routing.TurnCallRouter;
|
||||
import org.whispersystems.textsecuregcm.calls.routing.TurnServerOptions;
|
||||
import org.whispersystems.textsecuregcm.configuration.dynamic.DynamicConfiguration;
|
||||
import org.whispersystems.textsecuregcm.experiment.ExperimentEnrollmentManager;
|
||||
import org.whispersystems.textsecuregcm.limits.RateLimiter;
|
||||
import org.whispersystems.textsecuregcm.limits.RateLimiters;
|
||||
import org.whispersystems.textsecuregcm.mappers.RateLimitExceededExceptionMapper;
|
||||
import org.whispersystems.textsecuregcm.storage.DynamicConfigurationManager;
|
||||
import org.whispersystems.textsecuregcm.tests.util.AuthHelper;
|
||||
import org.whispersystems.textsecuregcm.util.SystemMapper;
|
||||
import org.whispersystems.textsecuregcm.util.TestRemoteAddressFilterProvider;
|
||||
@@ -96,8 +94,7 @@ class CallRoutingControllerV2Test {
|
||||
try {
|
||||
when(turnCallRouter.getRoutingFor(
|
||||
eq(AuthHelper.VALID_UUID),
|
||||
eq(Optional.of(InetAddress.getByName(REMOTE_ADDRESS))),
|
||||
anyInt())
|
||||
eq(Optional.of(InetAddress.getByName(REMOTE_ADDRESS))))
|
||||
).thenReturn(options);
|
||||
} catch (UnknownHostException ignored) {
|
||||
}
|
||||
@@ -177,8 +174,7 @@ class CallRoutingControllerV2Test {
|
||||
|
||||
when(turnCallRouter.getRoutingFor(
|
||||
eq(AuthHelper.VALID_UUID),
|
||||
eq(Optional.of(InetAddress.getByName(REMOTE_ADDRESS))),
|
||||
anyInt())
|
||||
eq(Optional.of(InetAddress.getByName(REMOTE_ADDRESS))))
|
||||
).thenReturn(options);
|
||||
try (Response rawResponse = resources.getJerseyTest()
|
||||
.target(GET_CALL_RELAYS_PATH)
|
||||
|
||||
Reference in New Issue
Block a user