diff --git a/desktop_app/src/main/resources/desktop.conf b/desktop_app/src/main/resources/desktop.conf index 2d7989fae0..9a7ea038bd 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 { + torrc_overrides = {} socketTimeout = 120 } i2p { diff --git a/network/tor/build.gradle b/network/tor/build.gradle index 309d07ef6d..e2fd101d3b 100644 --- a/network/tor/build.gradle +++ b/network/tor/build.gradle @@ -22,6 +22,7 @@ dependencies { implementation libs.google.guava implementation libs.failsafe implementation libs.tukaani + implementation libs.typesafe.config implementation libs.chimp.jsocks implementation libs.chimp.jtorctl diff --git a/network/tor/src/main/java/bisq/tor/TorServiceConfig.java b/network/tor/src/main/java/bisq/tor/TorServiceConfig.java new file mode 100644 index 0000000000..57ced42491 --- /dev/null +++ b/network/tor/src/main/java/bisq/tor/TorServiceConfig.java @@ -0,0 +1,44 @@ +/* + * This file is part of Bisq. + * + * Bisq is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * Bisq is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public + * License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Bisq. If not, see . + */ + +package bisq.tor; + +import com.typesafe.config.Config; +import lombok.Getter; + +import java.util.HashMap; +import java.util.Map; + +@Getter +public class TorServiceConfig { + + public static TorServiceConfig from(Config config) { + Map torrcOverrideConfigMap = new HashMap<>(); + Config torrcOverrides = config.getConfig("torrc_overrides"); + torrcOverrides.entrySet() + .forEach(entry -> torrcOverrideConfigMap.put( + entry.getKey(), (String) entry.getValue().unwrapped() + )); + return new TorServiceConfig(torrcOverrideConfigMap); + } + + private final Map torrcOverrides; + + public TorServiceConfig(Map torrcOverrides) { + this.torrcOverrides = torrcOverrides; + } +} diff --git a/oracle_node_app/src/main/resources/oracle_node.conf b/oracle_node_app/src/main/resources/oracle_node.conf index 8631107b39..fda85f3ca9 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 { + torrc_overrides = {} socketTimeout = 120 } i2p { diff --git a/rest_api_app/src/main/resources/rest_api.conf b/rest_api_app/src/main/resources/rest_api.conf index b33acbb679..71daf360de 100644 --- a/rest_api_app/src/main/resources/rest_api.conf +++ b/rest_api_app/src/main/resources/rest_api.conf @@ -102,7 +102,8 @@ application { clear { socketTimeout = 120 } - tor { + tor { + torrc_overrides = {} socketTimeout = 120 } i2p { diff --git a/seed_node_app/src/main/resources/seed_node.conf b/seed_node_app/src/main/resources/seed_node.conf index 52f57a937a..9d7b982f6f 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 { + torrc_overrides = {} socketTimeout = 120 } i2p {