Skip to content

Commit

Permalink
Merge pull request #1089 from alvasw/tor_add_torrc_overrides_to_types…
Browse files Browse the repository at this point in the history
…afe_config

Settings: Add torrc_overrides to typesafe config
  • Loading branch information
alvasw authored Aug 2, 2023
2 parents 3b8c70a + 553c55e commit b8c0439
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 1 deletion.
1 change: 1 addition & 0 deletions desktop_app/src/main/resources/desktop.conf
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ application {
socketTimeout = 120
}
tor {
torrc_overrides = {}
socketTimeout = 120
}
i2p {
Expand Down
1 change: 1 addition & 0 deletions network/tor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
44 changes: 44 additions & 0 deletions network/tor/src/main/java/bisq/tor/TorServiceConfig.java
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/

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<String, String> 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<String, String> torrcOverrides;

public TorServiceConfig(Map<String, String> torrcOverrides) {
this.torrcOverrides = torrcOverrides;
}
}
1 change: 1 addition & 0 deletions oracle_node_app/src/main/resources/oracle_node.conf
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ application {
socketTimeout = 120
}
tor {
torrc_overrides = {}
socketTimeout = 120
}
i2p {
Expand Down
3 changes: 2 additions & 1 deletion rest_api_app/src/main/resources/rest_api.conf
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ application {
clear {
socketTimeout = 120
}
tor {
tor {
torrc_overrides = {}
socketTimeout = 120
}
i2p {
Expand Down
1 change: 1 addition & 0 deletions seed_node_app/src/main/resources/seed_node.conf
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ application {
socketTimeout = 120
}
tor {
torrc_overrides = {}
socketTimeout = 120
}
i2p {
Expand Down

0 comments on commit b8c0439

Please sign in to comment.