diff --git a/build.gradle b/build.gradle index 6e5d8df08f7..42285e58ae1 100644 --- a/build.gradle +++ b/build.gradle @@ -47,7 +47,6 @@ configure(subprojects) { repositories { mavenCentral() maven { url 'https://jitpack.io' } - maven { url 'https://raw.githubusercontent.com/JesusMcCloud/tor-binary/8.0.3/release/' } } dependencies { @@ -190,10 +189,10 @@ configure(project(':common')) { configure(project(':p2p')) { dependencies { compile project(':common') - compile('com.github.JesusMcCloud.netlayer:tor.native:0.6') { + compile('com.github.JesusMcCloud.netlayer:tor.native:0.6.1') { exclude(module: 'slf4j-api') } - compile('com.github.JesusMcCloud.netlayer:tor.external:0.6') { + compile('com.github.JesusMcCloud.netlayer:tor.external:0.6.1') { exclude(module: 'slf4j-api') } compile('org.apache.httpcomponents:httpclient:4.5.3') { diff --git a/p2p/src/main/java/bisq/network/p2p/network/NewTor.java b/p2p/src/main/java/bisq/network/p2p/network/NewTor.java index 69c0461699b..b94c3886028 100644 --- a/p2p/src/main/java/bisq/network/p2p/network/NewTor.java +++ b/p2p/src/main/java/bisq/network/p2p/network/NewTor.java @@ -47,21 +47,12 @@ @Slf4j public class NewTor extends TorMode { - /** - * Netlayer stores its hidden service files in a custom - * subdirectory of $torDir/hiddenservice/. Note that the - * {@link HiddenServiceSocket} does add this part on its own, hence, - * {@link NewTor#getHiddenServiceDirectory()} returns only the custom - * subdirectory (which happens to be "") - */ - private static final String HIDDEN_SERVICE_DIRECTORY = "hiddenservice"; - private final String torrcFile; private final String torrcOptions; private final Collection bridgeEntries; public NewTor(File torWorkingDirectory, String torrcFile, String torrcOptions, Collection bridgeEntries) { - super(torWorkingDirectory, HIDDEN_SERVICE_DIRECTORY); + super(torWorkingDirectory); this.torrcFile = torrcFile; this.torrcOptions = torrcOptions; this.bridgeEntries = bridgeEntries; diff --git a/p2p/src/main/java/bisq/network/p2p/network/RunningTor.java b/p2p/src/main/java/bisq/network/p2p/network/RunningTor.java index 88aae8c4870..4af31d2ab94 100644 --- a/p2p/src/main/java/bisq/network/p2p/network/RunningTor.java +++ b/p2p/src/main/java/bisq/network/p2p/network/RunningTor.java @@ -40,7 +40,6 @@ @Slf4j public class RunningTor extends TorMode { - private static final String EXTERNAL_TOR_HIDDEN_SERVICE = "externalTorHiddenService"; private final int controlPort; private final String password; private final File cookieFile; @@ -49,7 +48,7 @@ public class RunningTor extends TorMode { public RunningTor(final File torDir, final int controlPort, final String password, final String cookieFile, final boolean useSafeCookieAuthentication) { - super(torDir, EXTERNAL_TOR_HIDDEN_SERVICE); + super(torDir); this.controlPort = controlPort; this.password = password; this.cookieFile = new File(cookieFile); @@ -81,7 +80,7 @@ else if (cookieFile.exists()) @Override public String getHiddenServiceDirectory() { - return new File(torDir, EXTERNAL_TOR_HIDDEN_SERVICE).getAbsolutePath(); + return new File(torDir, HIDDEN_SERVICE_DIRECTORY).getAbsolutePath(); } } diff --git a/p2p/src/main/java/bisq/network/p2p/network/TorMode.java b/p2p/src/main/java/bisq/network/p2p/network/TorMode.java index 1ddcda3e281..b1a8e88b823 100644 --- a/p2p/src/main/java/bisq/network/p2p/network/TorMode.java +++ b/p2p/src/main/java/bisq/network/p2p/network/TorMode.java @@ -35,11 +35,11 @@ public abstract class TorMode { /** - * The directory where the private_key file sits in. Kept private, - * because it is only valid for the {@link TorMode#doRollingBackup()} due to the - * inner workings of the Netlayer dependency. + * The sub-directory where the private_key file sits in. Kept + * private, because it only concerns implementations of {@link TorMode}. */ - private final File hiddenServiceDirectory; + protected static final String HIDDEN_SERVICE_DIRECTORY = "hiddenservice"; + protected final File torDir; /** @@ -51,9 +51,8 @@ public abstract class TorMode { * necessarily equal * {@link TorMode#getHiddenServiceDirectory()}. */ - public TorMode(File torDir, String hiddenServiceDir) { + public TorMode(File torDir) { this.torDir = torDir; - this.hiddenServiceDirectory = new File(torDir, hiddenServiceDir); } /** @@ -70,9 +69,9 @@ public TorMode(File torDir, String hiddenServiceDir) { * other stuff to the hiddenServiceDir, thus, selecting nothing (i.e. * "") as a hidden service directory is fine. {@link ExternalTor}, * however, does not have a Tor installation path and thus, takes the hidden - * service path literally. Hence, we set - * "torDir/externalTorHiddenService" as the hidden service - * directory. + * service path literally. Hence, we set "torDir/hiddenservice" as + * the hidden service directory. By doing so, we use the same + * private_key file as in {@link NewTor} mode. * * @return "" in {@link NewTor} Mode, * "torDir/externalTorHiddenService" in {@link RunningTor} @@ -84,7 +83,7 @@ public TorMode(File torDir, String hiddenServiceDir) { * Do a rolling backup of the "private_key" file. */ protected void doRollingBackup() { - FileUtil.rollingBackup(hiddenServiceDirectory, "private_key", 20); + FileUtil.rollingBackup(new File(torDir, HIDDEN_SERVICE_DIRECTORY), "private_key", 20); } }