mirror of
https://github.com/boldsuck/haveno.git
synced 2024-12-22 20:19:21 +00:00
Update tor binary to 0.4.7.10 (#810)
This commit is contained in:
parent
82b6bcfda5
commit
78098e49d8
8 changed files with 97 additions and 39 deletions
|
@ -71,7 +71,7 @@ configure(subprojects) {
|
||||||
loggingVersion = '1.2'
|
loggingVersion = '1.2'
|
||||||
lombokVersion = '1.18.30'
|
lombokVersion = '1.18.30'
|
||||||
mockitoVersion = '5.10.0'
|
mockitoVersion = '5.10.0'
|
||||||
netlayerVersion = '6797461310f077bbea4f43a3a509c077b0ed8c34' // Netlayer version 0.7.3 with Tor browser version 11.0.14 and tor binary version: 0.4.7.7
|
netlayerVersion = '2b459dc' // Tor browser version 11.5.2 and tor binary version: 0.4.7.10
|
||||||
protobufVersion = '3.19.1'
|
protobufVersion = '3.19.1'
|
||||||
protocVersion = protobufVersion
|
protocVersion = protobufVersion
|
||||||
pushyVersion = '0.13.2'
|
pushyVersion = '0.13.2'
|
||||||
|
|
|
@ -84,6 +84,7 @@ public class Config {
|
||||||
public static final String USE_TOR_FOR_XMR = "useTorForXmr";
|
public static final String USE_TOR_FOR_XMR = "useTorForXmr";
|
||||||
public static final String TORRC_FILE = "torrcFile";
|
public static final String TORRC_FILE = "torrcFile";
|
||||||
public static final String TORRC_OPTIONS = "torrcOptions";
|
public static final String TORRC_OPTIONS = "torrcOptions";
|
||||||
|
public static final String TOR_CONTROL_HOST = "torControlHost";
|
||||||
public static final String TOR_CONTROL_PORT = "torControlPort";
|
public static final String TOR_CONTROL_PORT = "torControlPort";
|
||||||
public static final String TOR_CONTROL_PASSWORD = "torControlPassword";
|
public static final String TOR_CONTROL_PASSWORD = "torControlPassword";
|
||||||
public static final String TOR_CONTROL_COOKIE_FILE = "torControlCookieFile";
|
public static final String TOR_CONTROL_COOKIE_FILE = "torControlCookieFile";
|
||||||
|
@ -173,6 +174,7 @@ public class Config {
|
||||||
public final String socks5ProxyHttpAddress;
|
public final String socks5ProxyHttpAddress;
|
||||||
public final File torrcFile;
|
public final File torrcFile;
|
||||||
public final String torrcOptions;
|
public final String torrcOptions;
|
||||||
|
public final String torControlHost;
|
||||||
public final int torControlPort;
|
public final int torControlPort;
|
||||||
public final String torControlPassword;
|
public final String torControlPassword;
|
||||||
public final File torControlCookieFile;
|
public final File torControlCookieFile;
|
||||||
|
@ -446,6 +448,11 @@ public class Config {
|
||||||
.withValuesConvertedBy(RegexMatcher.regex("^([^\\s,]+\\s[^,]+,?\\s*)+$"))
|
.withValuesConvertedBy(RegexMatcher.regex("^([^\\s,]+\\s[^,]+,?\\s*)+$"))
|
||||||
.defaultsTo("");
|
.defaultsTo("");
|
||||||
|
|
||||||
|
ArgumentAcceptingOptionSpec<String> torControlHostOpt =
|
||||||
|
parser.accepts(TOR_CONTROL_HOST, "The control hostname of an already running Tor service to be used by Haveno.")
|
||||||
|
.withRequiredArg()
|
||||||
|
.defaultsTo("127.0.0.1");
|
||||||
|
|
||||||
ArgumentAcceptingOptionSpec<Integer> torControlPortOpt =
|
ArgumentAcceptingOptionSpec<Integer> torControlPortOpt =
|
||||||
parser.accepts(TOR_CONTROL_PORT,
|
parser.accepts(TOR_CONTROL_PORT,
|
||||||
"The control port of an already running Tor service to be used by Haveno.")
|
"The control port of an already running Tor service to be used by Haveno.")
|
||||||
|
@ -667,6 +674,7 @@ public class Config {
|
||||||
this.bitcoinRegtestHost = options.valueOf(bitcoinRegtestHostOpt);
|
this.bitcoinRegtestHost = options.valueOf(bitcoinRegtestHostOpt);
|
||||||
this.torrcFile = options.has(torrcFileOpt) ? options.valueOf(torrcFileOpt).toFile() : null;
|
this.torrcFile = options.has(torrcFileOpt) ? options.valueOf(torrcFileOpt).toFile() : null;
|
||||||
this.torrcOptions = options.valueOf(torrcOptionsOpt);
|
this.torrcOptions = options.valueOf(torrcOptionsOpt);
|
||||||
|
this.torControlHost = options.valueOf(torControlHostOpt);
|
||||||
this.torControlPort = options.valueOf(torControlPortOpt);
|
this.torControlPort = options.valueOf(torControlPortOpt);
|
||||||
this.torControlPassword = options.valueOf(torControlPasswordOpt);
|
this.torControlPassword = options.valueOf(torControlPasswordOpt);
|
||||||
this.torControlCookieFile = options.has(torControlCookieFileOpt) ?
|
this.torControlCookieFile = options.has(torControlCookieFileOpt) ?
|
||||||
|
|
|
@ -236,6 +236,11 @@
|
||||||
<sha256 value="6306d89cfdb12bd0b6436390de71cef31879985da10d071a3bdad56bf287bbbb" origin="Generated by Gradle"/>
|
<sha256 value="6306d89cfdb12bd0b6436390de71cef31879985da10d071a3bdad56bf287bbbb" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="com.github.bisq-network.netlayer" name="tor" version="2b459dc">
|
||||||
|
<artifact name="tor-2b459dc.jar">
|
||||||
|
<sha256 value="d8aba69568795826bd1139b6854b479d9af9fc945eccf2b15d7f9ecb304c5cc4" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="com.github.bisq-network.netlayer" name="tor" version="6797461310f077bbea4f43a3a509c077b0ed8c34">
|
<component group="com.github.bisq-network.netlayer" name="tor" version="6797461310f077bbea4f43a3a509c077b0ed8c34">
|
||||||
<artifact name="tor-6797461310f077bbea4f43a3a509c077b0ed8c34.jar">
|
<artifact name="tor-6797461310f077bbea4f43a3a509c077b0ed8c34.jar">
|
||||||
<sha256 value="1536211d3f204059e2ad49c136978b36ebaa19e62103fcd46dcb926842fa0718" origin="Generated by Gradle"/>
|
<sha256 value="1536211d3f204059e2ad49c136978b36ebaa19e62103fcd46dcb926842fa0718" origin="Generated by Gradle"/>
|
||||||
|
@ -260,6 +265,11 @@
|
||||||
<sha256 value="605e15f473aa7163c4dfa75b0fa17a96466d24c6e3d7a66925b29aadde98dfb4" origin="Generated by Gradle"/>
|
<sha256 value="605e15f473aa7163c4dfa75b0fa17a96466d24c6e3d7a66925b29aadde98dfb4" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="com.github.bisq-network.netlayer" name="tor.external" version="2b459dc">
|
||||||
|
<artifact name="tor.external-2b459dc.jar">
|
||||||
|
<sha256 value="6646b6ce9312a16f6b4b61ee91512b8725b55a2f7204aec29f64974207fd5015" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="com.github.bisq-network.netlayer" name="tor.external" version="6797461310f077bbea4f43a3a509c077b0ed8c34">
|
<component group="com.github.bisq-network.netlayer" name="tor.external" version="6797461310f077bbea4f43a3a509c077b0ed8c34">
|
||||||
<artifact name="tor.external-6797461310f077bbea4f43a3a509c077b0ed8c34.jar">
|
<artifact name="tor.external-6797461310f077bbea4f43a3a509c077b0ed8c34.jar">
|
||||||
<sha256 value="d79dee1380fcc912dd9f321e6689b99129a90c6b30085b3f86a0b81830ecee71" origin="Generated by Gradle"/>
|
<sha256 value="d79dee1380fcc912dd9f321e6689b99129a90c6b30085b3f86a0b81830ecee71" origin="Generated by Gradle"/>
|
||||||
|
@ -284,6 +294,11 @@
|
||||||
<sha256 value="021ab6d438023653afee96c0fab1262eed6b7522fce76e114593d55e6d7d9928" origin="Generated by Gradle"/>
|
<sha256 value="021ab6d438023653afee96c0fab1262eed6b7522fce76e114593d55e6d7d9928" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="com.github.bisq-network.netlayer" name="tor.native" version="2b459dc">
|
||||||
|
<artifact name="tor.native-2b459dc.jar">
|
||||||
|
<sha256 value="dc5850e232f2c579d948213a3ea1ce536f56bcc49045a43d3bc63f1e065f1c94" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="com.github.bisq-network.netlayer" name="tor.native" version="6797461310f077bbea4f43a3a509c077b0ed8c34">
|
<component group="com.github.bisq-network.netlayer" name="tor.native" version="6797461310f077bbea4f43a3a509c077b0ed8c34">
|
||||||
<artifact name="tor.native-6797461310f077bbea4f43a3a509c077b0ed8c34.jar">
|
<artifact name="tor.native-6797461310f077bbea4f43a3a509c077b0ed8c34.jar">
|
||||||
<sha256 value="7ab70a9948fffea33da9fee161c5783a74aeb1531e3fda09995c47bb5e2de0f5" origin="Generated by Gradle"/>
|
<sha256 value="7ab70a9948fffea33da9fee161c5783a74aeb1531e3fda09995c47bb5e2de0f5" origin="Generated by Gradle"/>
|
||||||
|
@ -315,6 +330,11 @@
|
||||||
<sha256 value="f1ef0c2b2a1df585f057b96b62b05e2e7d7953353b64e29ac798810ff2919b42" origin="Generated by Gradle"/>
|
<sha256 value="f1ef0c2b2a1df585f057b96b62b05e2e7d7953353b64e29ac798810ff2919b42" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="com.github.bisq-network.tor-binary" name="tor-binary-geoip" version="580d31bdcf1fabccd38456aa084044064d89d5c1">
|
||||||
|
<artifact name="tor-binary-geoip-580d31bdcf1fabccd38456aa084044064d89d5c1.jar">
|
||||||
|
<sha256 value="5a1795e95128e8c6fb3381d1c31ac39f2ec4e4fc3a0262f3f9ac3c7987e0c87e" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="com.github.bisq-network.tor-binary" name="tor-binary-geoip" version="6d1fd95">
|
<component group="com.github.bisq-network.tor-binary" name="tor-binary-geoip" version="6d1fd95">
|
||||||
<artifact name="tor-binary-geoip-6d1fd95.jar">
|
<artifact name="tor-binary-geoip-6d1fd95.jar">
|
||||||
<sha256 value="5a55df3a5bed0aa57165e9bae9ecda8b14d5e85b97dd1a266fa77602fbdaec54" origin="Generated by Gradle"/>
|
<sha256 value="5a55df3a5bed0aa57165e9bae9ecda8b14d5e85b97dd1a266fa77602fbdaec54" origin="Generated by Gradle"/>
|
||||||
|
@ -339,6 +359,11 @@
|
||||||
<sha256 value="197d034216b332fcfaa7111442ac4a23bddc60fb71fefba1c736fe9844c1001b" origin="Generated by Gradle"/>
|
<sha256 value="197d034216b332fcfaa7111442ac4a23bddc60fb71fefba1c736fe9844c1001b" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="com.github.bisq-network.tor-binary" name="tor-binary-linux32" version="580d31bdcf1fabccd38456aa084044064d89d5c1">
|
||||||
|
<artifact name="tor-binary-linux32-580d31bdcf1fabccd38456aa084044064d89d5c1.jar">
|
||||||
|
<sha256 value="2516ce5549ef5687ef7f855db5940574fc9232ff3ba531fbc216275b8d51ae85" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="com.github.bisq-network.tor-binary" name="tor-binary-linux32" version="6d1fd95">
|
<component group="com.github.bisq-network.tor-binary" name="tor-binary-linux32" version="6d1fd95">
|
||||||
<artifact name="tor-binary-linux32-6d1fd95.jar">
|
<artifact name="tor-binary-linux32-6d1fd95.jar">
|
||||||
<sha256 value="fe8b0ddb1c109b453adf9b055e067be04b6ca4cda9d2b33c875b99d2092f0eae" origin="Generated by Gradle"/>
|
<sha256 value="fe8b0ddb1c109b453adf9b055e067be04b6ca4cda9d2b33c875b99d2092f0eae" origin="Generated by Gradle"/>
|
||||||
|
@ -363,6 +388,11 @@
|
||||||
<sha256 value="a01902c476556a0529413b0f3810e954a5eb8a7cdc1a9cc604ec2d24ceca91ce" origin="Generated by Gradle"/>
|
<sha256 value="a01902c476556a0529413b0f3810e954a5eb8a7cdc1a9cc604ec2d24ceca91ce" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="com.github.bisq-network.tor-binary" name="tor-binary-linux64" version="580d31bdcf1fabccd38456aa084044064d89d5c1">
|
||||||
|
<artifact name="tor-binary-linux64-580d31bdcf1fabccd38456aa084044064d89d5c1.jar">
|
||||||
|
<sha256 value="afc7ad5e1bc57e73aae55d9b022ff63f41f7c73a9a7603d4c24975288432daa1" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="com.github.bisq-network.tor-binary" name="tor-binary-linux64" version="6d1fd95">
|
<component group="com.github.bisq-network.tor-binary" name="tor-binary-linux64" version="6d1fd95">
|
||||||
<artifact name="tor-binary-linux64-6d1fd95.jar">
|
<artifact name="tor-binary-linux64-6d1fd95.jar">
|
||||||
<sha256 value="7f58d31dd684b2e361e2980ba23922cadd5d9d8f8dbab9b3a2c6737741b21f7e" origin="Generated by Gradle"/>
|
<sha256 value="7f58d31dd684b2e361e2980ba23922cadd5d9d8f8dbab9b3a2c6737741b21f7e" origin="Generated by Gradle"/>
|
||||||
|
@ -387,6 +417,11 @@
|
||||||
<sha256 value="ee305ee12585057bcce380710e4a5ae3a3ed43e1701f5e565f15b75854e3e715" origin="Generated by Gradle"/>
|
<sha256 value="ee305ee12585057bcce380710e4a5ae3a3ed43e1701f5e565f15b75854e3e715" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="com.github.bisq-network.tor-binary" name="tor-binary-macos" version="580d31bdcf1fabccd38456aa084044064d89d5c1">
|
||||||
|
<artifact name="tor-binary-macos-580d31bdcf1fabccd38456aa084044064d89d5c1.jar">
|
||||||
|
<sha256 value="5bfb2eaf7efe5d280d6b68e222c910cc6ae2a925e3d06fa35c6b5295ebf94651" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="com.github.bisq-network.tor-binary" name="tor-binary-macos" version="6d1fd95">
|
<component group="com.github.bisq-network.tor-binary" name="tor-binary-macos" version="6d1fd95">
|
||||||
<artifact name="tor-binary-macos-6d1fd95.jar">
|
<artifact name="tor-binary-macos-6d1fd95.jar">
|
||||||
<sha256 value="a23802ff66d4ac01366ebe712879e2f51df960572dc34db269588da87453a70d" origin="Generated by Gradle"/>
|
<sha256 value="a23802ff66d4ac01366ebe712879e2f51df960572dc34db269588da87453a70d" origin="Generated by Gradle"/>
|
||||||
|
@ -411,6 +446,11 @@
|
||||||
<sha256 value="143a9bfc539101d8293b7d151d6a952135fa5ad76d752639d2ed72fb9c9c494d" origin="Generated by Gradle"/>
|
<sha256 value="143a9bfc539101d8293b7d151d6a952135fa5ad76d752639d2ed72fb9c9c494d" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="com.github.bisq-network.tor-binary" name="tor-binary-windows" version="580d31bdcf1fabccd38456aa084044064d89d5c1">
|
||||||
|
<artifact name="tor-binary-windows-580d31bdcf1fabccd38456aa084044064d89d5c1.jar">
|
||||||
|
<sha256 value="b5fbe9f9e2681b0cfdd0d8a26c7b216c38acfea74fe2103633fe7e81b6cc4bf7" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="com.github.bisq-network.tor-binary" name="tor-binary-windows" version="6d1fd95">
|
<component group="com.github.bisq-network.tor-binary" name="tor-binary-windows" version="6d1fd95">
|
||||||
<artifact name="tor-binary-windows-6d1fd95.jar">
|
<artifact name="tor-binary-windows-6d1fd95.jar">
|
||||||
<sha256 value="8e0dee7429228aa0c9f7a36f40f303a016ed8dfb40fea77382f7076c13fc27f1" origin="Generated by Gradle"/>
|
<sha256 value="8e0dee7429228aa0c9f7a36f40f303a016ed8dfb40fea77382f7076c13fc27f1" origin="Generated by Gradle"/>
|
||||||
|
|
|
@ -47,6 +47,7 @@ public class NetworkNodeProvider implements Provider<NetworkNode> {
|
||||||
@Named(Config.TOR_DIR) File torDir,
|
@Named(Config.TOR_DIR) File torDir,
|
||||||
@Nullable @Named(Config.TORRC_FILE) File torrcFile,
|
@Nullable @Named(Config.TORRC_FILE) File torrcFile,
|
||||||
@Named(Config.TORRC_OPTIONS) String torrcOptions,
|
@Named(Config.TORRC_OPTIONS) String torrcOptions,
|
||||||
|
@Named(Config.TOR_CONTROL_HOST) String controlHost,
|
||||||
@Named(Config.TOR_CONTROL_PORT) int controlPort,
|
@Named(Config.TOR_CONTROL_PORT) int controlPort,
|
||||||
@Named(Config.TOR_CONTROL_PASSWORD) String password,
|
@Named(Config.TOR_CONTROL_PASSWORD) String password,
|
||||||
@Nullable @Named(Config.TOR_CONTROL_COOKIE_FILE) File cookieFile,
|
@Nullable @Named(Config.TOR_CONTROL_COOKIE_FILE) File cookieFile,
|
||||||
|
@ -59,11 +60,12 @@ public class NetworkNodeProvider implements Provider<NetworkNode> {
|
||||||
torDir,
|
torDir,
|
||||||
torrcFile,
|
torrcFile,
|
||||||
torrcOptions,
|
torrcOptions,
|
||||||
|
controlHost,
|
||||||
controlPort,
|
controlPort,
|
||||||
password,
|
password,
|
||||||
cookieFile,
|
cookieFile,
|
||||||
useSafeCookieAuthentication);
|
useSafeCookieAuthentication);
|
||||||
networkNode = new TorNetworkNode(port, networkProtoResolver, streamIsolation, torMode, banFilter, maxConnections);
|
networkNode = new TorNetworkNode(port, networkProtoResolver, streamIsolation, torMode, banFilter, maxConnections, controlHost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,12 +73,13 @@ public class NetworkNodeProvider implements Provider<NetworkNode> {
|
||||||
File torDir,
|
File torDir,
|
||||||
@Nullable File torrcFile,
|
@Nullable File torrcFile,
|
||||||
String torrcOptions,
|
String torrcOptions,
|
||||||
|
String controlHost,
|
||||||
int controlPort,
|
int controlPort,
|
||||||
String password,
|
String password,
|
||||||
@Nullable File cookieFile,
|
@Nullable File cookieFile,
|
||||||
boolean useSafeCookieAuthentication) {
|
boolean useSafeCookieAuthentication) {
|
||||||
return controlPort != Config.UNSPECIFIED_PORT ?
|
return controlPort != Config.UNSPECIFIED_PORT ?
|
||||||
new RunningTor(torDir, controlPort, password, cookieFile, useSafeCookieAuthentication) :
|
new RunningTor(torDir, controlHost, controlPort, password, cookieFile, useSafeCookieAuthentication) :
|
||||||
new NewTor(torDir, torrcFile, torrcOptions, bridgeAddressProvider);
|
new NewTor(torDir, torrcFile, torrcOptions, bridgeAddressProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,26 @@ package haveno.network.p2p;
|
||||||
|
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
|
import static com.google.inject.name.Names.named;
|
||||||
|
import static com.google.inject.util.Providers.of;
|
||||||
import haveno.common.app.AppModule;
|
import haveno.common.app.AppModule;
|
||||||
import haveno.common.config.Config;
|
import haveno.common.config.Config;
|
||||||
|
import static haveno.common.config.Config.BAN_LIST;
|
||||||
|
import static haveno.common.config.Config.MAX_CONNECTIONS;
|
||||||
|
import static haveno.common.config.Config.NODE_PORT;
|
||||||
|
import static haveno.common.config.Config.REPUBLISH_MAILBOX_ENTRIES;
|
||||||
|
import static haveno.common.config.Config.SOCKS_5_PROXY_HTTP_ADDRESS;
|
||||||
|
import static haveno.common.config.Config.SOCKS_5_PROXY_XMR_ADDRESS;
|
||||||
|
import static haveno.common.config.Config.TORRC_FILE;
|
||||||
|
import static haveno.common.config.Config.TORRC_OPTIONS;
|
||||||
|
import static haveno.common.config.Config.TOR_CONTROL_COOKIE_FILE;
|
||||||
|
import static haveno.common.config.Config.TOR_CONTROL_HOST;
|
||||||
|
import static haveno.common.config.Config.TOR_CONTROL_PASSWORD;
|
||||||
|
import static haveno.common.config.Config.TOR_CONTROL_PORT;
|
||||||
|
import static haveno.common.config.Config.TOR_CONTROL_USE_SAFE_COOKIE_AUTH;
|
||||||
|
import static haveno.common.config.Config.TOR_DIR;
|
||||||
|
import static haveno.common.config.Config.TOR_STREAM_ISOLATION;
|
||||||
|
import static haveno.common.config.Config.USE_LOCALHOST_FOR_P2P;
|
||||||
import haveno.network.Socks5ProxyProvider;
|
import haveno.network.Socks5ProxyProvider;
|
||||||
import haveno.network.http.HttpClient;
|
import haveno.network.http.HttpClient;
|
||||||
import haveno.network.http.HttpClientImpl;
|
import haveno.network.http.HttpClientImpl;
|
||||||
|
@ -35,29 +53,10 @@ import haveno.network.p2p.storage.P2PDataStorage;
|
||||||
import haveno.network.p2p.storage.persistence.AppendOnlyDataStoreService;
|
import haveno.network.p2p.storage.persistence.AppendOnlyDataStoreService;
|
||||||
import haveno.network.p2p.storage.persistence.ProtectedDataStoreService;
|
import haveno.network.p2p.storage.persistence.ProtectedDataStoreService;
|
||||||
import haveno.network.p2p.storage.persistence.ResourceDataStoreService;
|
import haveno.network.p2p.storage.persistence.ResourceDataStoreService;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.time.Clock;
|
import java.time.Clock;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.google.inject.name.Names.named;
|
|
||||||
import static com.google.inject.util.Providers.of;
|
|
||||||
import static haveno.common.config.Config.BAN_LIST;
|
|
||||||
import static haveno.common.config.Config.MAX_CONNECTIONS;
|
|
||||||
import static haveno.common.config.Config.NODE_PORT;
|
|
||||||
import static haveno.common.config.Config.REPUBLISH_MAILBOX_ENTRIES;
|
|
||||||
import static haveno.common.config.Config.SOCKS_5_PROXY_XMR_ADDRESS;
|
|
||||||
import static haveno.common.config.Config.SOCKS_5_PROXY_HTTP_ADDRESS;
|
|
||||||
import static haveno.common.config.Config.TORRC_FILE;
|
|
||||||
import static haveno.common.config.Config.TORRC_OPTIONS;
|
|
||||||
import static haveno.common.config.Config.TOR_CONTROL_COOKIE_FILE;
|
|
||||||
import static haveno.common.config.Config.TOR_CONTROL_PASSWORD;
|
|
||||||
import static haveno.common.config.Config.TOR_CONTROL_PORT;
|
|
||||||
import static haveno.common.config.Config.TOR_CONTROL_USE_SAFE_COOKIE_AUTH;
|
|
||||||
import static haveno.common.config.Config.TOR_DIR;
|
|
||||||
import static haveno.common.config.Config.TOR_STREAM_ISOLATION;
|
|
||||||
import static haveno.common.config.Config.USE_LOCALHOST_FOR_P2P;
|
|
||||||
|
|
||||||
public class P2PModule extends AppModule {
|
public class P2PModule extends AppModule {
|
||||||
|
|
||||||
public P2PModule(Config config) {
|
public P2PModule(Config config) {
|
||||||
|
@ -96,6 +95,7 @@ public class P2PModule extends AppModule {
|
||||||
bindConstant().annotatedWith(named(SOCKS_5_PROXY_HTTP_ADDRESS)).to(config.socks5ProxyHttpAddress);
|
bindConstant().annotatedWith(named(SOCKS_5_PROXY_HTTP_ADDRESS)).to(config.socks5ProxyHttpAddress);
|
||||||
bind(File.class).annotatedWith(named(TORRC_FILE)).toProvider(of(config.torrcFile)); // allow null value
|
bind(File.class).annotatedWith(named(TORRC_FILE)).toProvider(of(config.torrcFile)); // allow null value
|
||||||
bindConstant().annotatedWith(named(TORRC_OPTIONS)).to(config.torrcOptions);
|
bindConstant().annotatedWith(named(TORRC_OPTIONS)).to(config.torrcOptions);
|
||||||
|
bindConstant().annotatedWith(named(TOR_CONTROL_HOST)).to(config.torControlHost);
|
||||||
bindConstant().annotatedWith(named(TOR_CONTROL_PORT)).to(config.torControlPort);
|
bindConstant().annotatedWith(named(TOR_CONTROL_PORT)).to(config.torControlPort);
|
||||||
bindConstant().annotatedWith(named(TOR_CONTROL_PASSWORD)).to(config.torControlPassword);
|
bindConstant().annotatedWith(named(TOR_CONTROL_PASSWORD)).to(config.torControlPassword);
|
||||||
bind(File.class).annotatedWith(named(TOR_CONTROL_COOKIE_FILE)).toProvider(of(config.torControlCookieFile));
|
bind(File.class).annotatedWith(named(TOR_CONTROL_COOKIE_FILE)).toProvider(of(config.torControlCookieFile));
|
||||||
|
|
|
@ -17,15 +17,13 @@
|
||||||
|
|
||||||
package haveno.network.p2p.network;
|
package haveno.network.p2p.network;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Date;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.berndpruenster.netlayer.tor.ExternalTor;
|
import org.berndpruenster.netlayer.tor.ExternalTor;
|
||||||
import org.berndpruenster.netlayer.tor.Tor;
|
import org.berndpruenster.netlayer.tor.Tor;
|
||||||
import org.berndpruenster.netlayer.tor.TorCtlException;
|
import org.berndpruenster.netlayer.tor.TorCtlException;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class creates a brand new instance of the Tor onion router.
|
* This class creates a brand new instance of the Tor onion router.
|
||||||
*
|
*
|
||||||
|
@ -39,15 +37,21 @@ import java.util.Date;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class RunningTor extends TorMode {
|
public class RunningTor extends TorMode {
|
||||||
|
|
||||||
|
private final String controlHost;
|
||||||
private final int controlPort;
|
private final int controlPort;
|
||||||
private final String password;
|
private final String password;
|
||||||
private final File cookieFile;
|
private final File cookieFile;
|
||||||
private final boolean useSafeCookieAuthentication;
|
private final boolean useSafeCookieAuthentication;
|
||||||
|
|
||||||
|
|
||||||
public RunningTor(final File torDir, final int controlPort, final String password, final File cookieFile,
|
public RunningTor(final File torDir,
|
||||||
|
final String controlHost,
|
||||||
|
final int controlPort,
|
||||||
|
final String password,
|
||||||
|
final File cookieFile,
|
||||||
final boolean useSafeCookieAuthentication) {
|
final boolean useSafeCookieAuthentication) {
|
||||||
super(torDir);
|
super(torDir);
|
||||||
|
this.controlHost = controlHost;
|
||||||
this.controlPort = controlPort;
|
this.controlPort = controlPort;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
this.cookieFile = cookieFile;
|
this.cookieFile = cookieFile;
|
||||||
|
@ -55,18 +59,18 @@ public class RunningTor extends TorMode {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Tor getTor() throws IOException, TorCtlException {
|
public Tor getTor() throws TorCtlException {
|
||||||
long ts1 = new Date().getTime();
|
long ts1 = new Date().getTime();
|
||||||
|
|
||||||
log.info("Connecting to running tor");
|
log.info("Connecting to running tor");
|
||||||
|
|
||||||
Tor result;
|
Tor result;
|
||||||
if (!password.isEmpty())
|
if (!password.isEmpty())
|
||||||
result = new ExternalTor(controlPort, password);
|
result = new ExternalTor(controlHost, controlPort, password);
|
||||||
else if (cookieFile != null && cookieFile.exists())
|
else if (cookieFile != null && cookieFile.exists())
|
||||||
result = new ExternalTor(controlPort, cookieFile, useSafeCookieAuthentication);
|
result = new ExternalTor(controlHost, controlPort, cookieFile, useSafeCookieAuthentication);
|
||||||
else
|
else
|
||||||
result = new ExternalTor(controlPort);
|
result = new ExternalTor(controlHost, controlPort);
|
||||||
|
|
||||||
log.info(
|
log.info(
|
||||||
"\n################################################################\n"
|
"\n################################################################\n"
|
||||||
|
|
|
@ -51,6 +51,8 @@ import static com.google.common.base.Preconditions.checkArgument;
|
||||||
public class TorNetworkNode extends NetworkNode {
|
public class TorNetworkNode extends NetworkNode {
|
||||||
private static final long SHUT_DOWN_TIMEOUT = 2;
|
private static final long SHUT_DOWN_TIMEOUT = 2;
|
||||||
|
|
||||||
|
private final String torControlHost;
|
||||||
|
|
||||||
private HiddenServiceSocket hiddenServiceSocket;
|
private HiddenServiceSocket hiddenServiceSocket;
|
||||||
private Timer shutDownTimeoutTimer;
|
private Timer shutDownTimeoutTimer;
|
||||||
private Tor tor;
|
private Tor tor;
|
||||||
|
@ -70,10 +72,11 @@ public class TorNetworkNode extends NetworkNode {
|
||||||
boolean useStreamIsolation,
|
boolean useStreamIsolation,
|
||||||
TorMode torMode,
|
TorMode torMode,
|
||||||
@Nullable BanFilter banFilter,
|
@Nullable BanFilter banFilter,
|
||||||
int maxConnections) {
|
int maxConnections, String torControlHost) {
|
||||||
super(servicePort, networkProtoResolver, banFilter, maxConnections);
|
super(servicePort, networkProtoResolver, banFilter, maxConnections);
|
||||||
this.torMode = torMode;
|
this.torMode = torMode;
|
||||||
this.streamIsolation = useStreamIsolation;
|
this.streamIsolation = useStreamIsolation;
|
||||||
|
this.torControlHost = torControlHost;
|
||||||
|
|
||||||
executor = SingleThreadExecutorUtils.getSingleThreadExecutor("StartTor");
|
executor = SingleThreadExecutorUtils.getSingleThreadExecutor("StartTor");
|
||||||
}
|
}
|
||||||
|
@ -97,7 +100,7 @@ public class TorNetworkNode extends NetworkNode {
|
||||||
checkArgument(peerNodeAddress.getHostName().endsWith(".onion"), "PeerAddress is not an onion address");
|
checkArgument(peerNodeAddress.getHostName().endsWith(".onion"), "PeerAddress is not an onion address");
|
||||||
// If streamId is null stream isolation gets deactivated.
|
// If streamId is null stream isolation gets deactivated.
|
||||||
// Hidden services use stream isolation by default, so we pass null.
|
// Hidden services use stream isolation by default, so we pass null.
|
||||||
return new TorSocket(peerNodeAddress.getHostName(), peerNodeAddress.getPort(), null);
|
return new TorSocket(peerNodeAddress.getHostName(), peerNodeAddress.getPort(), torControlHost, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Socks5Proxy getSocksProxy() {
|
public Socks5Proxy getSocksProxy() {
|
||||||
|
@ -111,7 +114,7 @@ public class TorNetworkNode extends NetworkNode {
|
||||||
|
|
||||||
if (socksProxy == null || streamIsolation) {
|
if (socksProxy == null || streamIsolation) {
|
||||||
tor = Tor.getDefault();
|
tor = Tor.getDefault();
|
||||||
socksProxy = tor != null ? tor.getProxy(stream) : null;
|
socksProxy = tor != null ? tor.getProxy(torControlHost, stream) : null;
|
||||||
}
|
}
|
||||||
return socksProxy;
|
return socksProxy;
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class TorNetworkNodeTest {
|
||||||
latch = new CountDownLatch(1);
|
latch = new CountDownLatch(1);
|
||||||
int port = 9001;
|
int port = 9001;
|
||||||
TorNetworkNode node1 = new TorNetworkNode(port, TestUtils.getNetworkProtoResolver(), false,
|
TorNetworkNode node1 = new TorNetworkNode(port, TestUtils.getNetworkProtoResolver(), false,
|
||||||
new NewTor(new File("torNode_" + port), null, "", this::getBridgeAddresses), null, 12);
|
new NewTor(new File("torNode_" + port), null, "", this::getBridgeAddresses), null, 12, "127.0.0.1");
|
||||||
node1.start(new SetupListener() {
|
node1.start(new SetupListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onTorNodeReady() {
|
public void onTorNodeReady() {
|
||||||
|
@ -78,7 +78,7 @@ public class TorNetworkNodeTest {
|
||||||
latch = new CountDownLatch(1);
|
latch = new CountDownLatch(1);
|
||||||
int port2 = 9002;
|
int port2 = 9002;
|
||||||
TorNetworkNode node2 = new TorNetworkNode(port2, TestUtils.getNetworkProtoResolver(), false,
|
TorNetworkNode node2 = new TorNetworkNode(port2, TestUtils.getNetworkProtoResolver(), false,
|
||||||
new NewTor(new File("torNode_" + port), null, "", this::getBridgeAddresses), null, 12);
|
new NewTor(new File("torNode_" + port), null, "", this::getBridgeAddresses), null, 12, "127.0.0.1");
|
||||||
node2.start(new SetupListener() {
|
node2.start(new SetupListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onTorNodeReady() {
|
public void onTorNodeReady() {
|
||||||
|
@ -136,7 +136,7 @@ public class TorNetworkNodeTest {
|
||||||
latch = new CountDownLatch(2);
|
latch = new CountDownLatch(2);
|
||||||
int port = 9001;
|
int port = 9001;
|
||||||
TorNetworkNode node1 = new TorNetworkNode(port, TestUtils.getNetworkProtoResolver(), false,
|
TorNetworkNode node1 = new TorNetworkNode(port, TestUtils.getNetworkProtoResolver(), false,
|
||||||
new NewTor(new File("torNode_" + port), null, "", this::getBridgeAddresses), null, 12);
|
new NewTor(new File("torNode_" + port), null, "", this::getBridgeAddresses), null, 12, "127.0.0.1");
|
||||||
node1.start(new SetupListener() {
|
node1.start(new SetupListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onTorNodeReady() {
|
public void onTorNodeReady() {
|
||||||
|
@ -162,7 +162,7 @@ public class TorNetworkNodeTest {
|
||||||
|
|
||||||
int port2 = 9002;
|
int port2 = 9002;
|
||||||
TorNetworkNode node2 = new TorNetworkNode(port2, TestUtils.getNetworkProtoResolver(), false,
|
TorNetworkNode node2 = new TorNetworkNode(port2, TestUtils.getNetworkProtoResolver(), false,
|
||||||
new NewTor(new File("torNode_" + port), null, "", this::getBridgeAddresses), null, 12);
|
new NewTor(new File("torNode_" + port), null, "", this::getBridgeAddresses), null, 12, "127.0.0.1");
|
||||||
node2.start(new SetupListener() {
|
node2.start(new SetupListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onTorNodeReady() {
|
public void onTorNodeReady() {
|
||||||
|
|
Loading…
Reference in a new issue