mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 01:41:11 +01:00
Refactored TorMode classes
This commit is contained in:
parent
18cfc1a138
commit
6eeda23f31
@ -51,13 +51,12 @@ public class NewTor extends TorMode {
|
||||
private final String torrcFile;
|
||||
private final String torrcOptions;
|
||||
private final Collection<String> bridgeEntries;
|
||||
private final File torWorkikngDirectory;
|
||||
|
||||
public NewTor(File torWorkingDirectory, String torrcFile, String torrcOptions, Collection<String> bridgeEntries) {
|
||||
super(torWorkingDirectory);
|
||||
this.torrcFile = torrcFile;
|
||||
this.torrcOptions = torrcOptions;
|
||||
this.bridgeEntries = bridgeEntries;
|
||||
this.torWorkikngDirectory = torWorkingDirectory;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -103,7 +102,7 @@ public class NewTor extends TorMode {
|
||||
override = new Torrc(torrcOptionsMap);
|
||||
|
||||
log.info("Starting tor");
|
||||
NativeTor result = new NativeTor(torWorkikngDirectory, bridgeEntries, override);
|
||||
NativeTor result = new NativeTor(torDir, bridgeEntries, override);
|
||||
log.info(
|
||||
"\n################################################################\n"
|
||||
+ "Tor started after {} ms. Start publishing hidden service.\n"
|
||||
|
@ -42,14 +42,13 @@ public class RunningTor extends TorMode {
|
||||
private static final Logger log = LoggerFactory.getLogger(RunningTor.class);
|
||||
private final int controlPort;
|
||||
private final String password;
|
||||
private final String torDir;
|
||||
private final File cookieFile;
|
||||
private final boolean useSafeCookieAuthentication;
|
||||
|
||||
|
||||
public RunningTor(final File torDir, final int controlPort, final String password, final String cookieFile,
|
||||
final boolean useSafeCookieAuthentication) {
|
||||
this.torDir = torDir.getAbsolutePath();
|
||||
super(torDir);
|
||||
this.controlPort = controlPort;
|
||||
this.password = password;
|
||||
this.cookieFile = new File(cookieFile);
|
||||
@ -81,7 +80,7 @@ public class RunningTor extends TorMode {
|
||||
|
||||
@Override
|
||||
public String getHiddenServiceDirectory() {
|
||||
return torDir + File.separator + "externalTorHiddenService";
|
||||
return new File(torDir, "externalTorHiddenService").getAbsolutePath();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,6 +32,12 @@ import org.berndpruenster.netlayer.tor.TorCtlException;
|
||||
*/
|
||||
public abstract class TorMode {
|
||||
|
||||
protected final File torDir;
|
||||
|
||||
public TorMode(File torDir) {
|
||||
this.torDir = torDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a fresh {@link Tor} object.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user