From 7080d4047f11a268f9742463545df20773c1b8b3 Mon Sep 17 00:00:00 2001 From: Alva Swanson Date: Thu, 10 Aug 2023 13:56:34 +0200 Subject: [PATCH] Add Tor testNetwork option to typesafe config --- desktop_app/src/main/resources/desktop.conf | 1 + .../bisq/network/p2p/node/transport/TorTransport.java | 9 ++++++++- oracle_node_app/src/main/resources/oracle_node.conf | 1 + rest_api_app/src/main/resources/rest_api.conf | 1 + seed_node_app/src/main/resources/seed_node.conf | 1 + 5 files changed, 12 insertions(+), 1 deletion(-) diff --git a/desktop_app/src/main/resources/desktop.conf b/desktop_app/src/main/resources/desktop.conf index 3a731e2c7b..4980de87d5 100644 --- a/desktop_app/src/main/resources/desktop.conf +++ b/desktop_app/src/main/resources/desktop.conf @@ -105,6 +105,7 @@ application { socketTimeout = 120 } tor { + testNetwork = false directoryAuthorities = [] torrcOverrides = {} socketTimeout = 120 diff --git a/network/network/src/main/java/bisq/network/p2p/node/transport/TorTransport.java b/network/network/src/main/java/bisq/network/p2p/node/transport/TorTransport.java index 53ee031d79..1277607b68 100644 --- a/network/network/src/main/java/bisq/network/p2p/node/transport/TorTransport.java +++ b/network/network/src/main/java/bisq/network/p2p/node/transport/TorTransport.java @@ -38,6 +38,7 @@ public class TorTransport implements Transport { public static final class Config implements Transport.Config { public static Config from(String baseDir, com.typesafe.config.Config config) { return new Config( + config.getBoolean("testNetwork"), baseDir, (int) TimeUnit.SECONDS.toMillis(config.getInt("socketTimeout")), parseDirectoryAuthorities(config.getList("directoryAuthorities")), @@ -78,12 +79,18 @@ private static String getStringFromConfigValue(ConfigValue configValue, String k .unwrapped(); } + private final boolean isTestNetwork; private final int socketTimeout; private final String baseDir; private final Set directoryAuthorities; private final Map torrcOverrides; - public Config(String baseDir, int socketTimeout, Set directoryAuthorities, Map torrcOverrides) { + public Config(boolean isTestNetwork, + String baseDir, + int socketTimeout, + Set directoryAuthorities, + Map torrcOverrides) { + this.isTestNetwork = isTestNetwork; this.baseDir = baseDir; this.socketTimeout = socketTimeout; this.directoryAuthorities = directoryAuthorities; diff --git a/oracle_node_app/src/main/resources/oracle_node.conf b/oracle_node_app/src/main/resources/oracle_node.conf index 23d44d8e4f..c9ab92b3cb 100644 --- a/oracle_node_app/src/main/resources/oracle_node.conf +++ b/oracle_node_app/src/main/resources/oracle_node.conf @@ -109,6 +109,7 @@ application { socketTimeout = 120 } tor { + testNetwork = false directoryAuthorities = [] torrcOverrides = {} socketTimeout = 120 diff --git a/rest_api_app/src/main/resources/rest_api.conf b/rest_api_app/src/main/resources/rest_api.conf index 0377fc87a1..ef12c3f208 100644 --- a/rest_api_app/src/main/resources/rest_api.conf +++ b/rest_api_app/src/main/resources/rest_api.conf @@ -103,6 +103,7 @@ application { socketTimeout = 120 } tor { + testNetwork = false torrcOverrides = {} socketTimeout = 120 } diff --git a/seed_node_app/src/main/resources/seed_node.conf b/seed_node_app/src/main/resources/seed_node.conf index 0e35eb0b3a..c93bc108f5 100644 --- a/seed_node_app/src/main/resources/seed_node.conf +++ b/seed_node_app/src/main/resources/seed_node.conf @@ -89,6 +89,7 @@ application { socketTimeout = 120 } tor { + testNetwork = false directoryAuthorities = [] torrcOverrides = {} socketTimeout = 120