mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 04:18:53 +01:00
WIP: remove tor binaries; add macos tor dependencies from tmp Maven repo
This commit is contained in:
@@ -55,8 +55,6 @@ import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.concurrent.GuardedBy;
|
||||
@@ -210,6 +208,10 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
||||
return new File(torDirectory, "tor");
|
||||
}
|
||||
|
||||
private File getLibEventFile() {
|
||||
return new File(torDirectory, "libevent-2.1.7.dylib");
|
||||
}
|
||||
|
||||
protected File getObfs4ExecutableFile() {
|
||||
return new File(torDirectory, "obfs4proxy");
|
||||
}
|
||||
@@ -336,7 +338,7 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
||||
doneFile.delete();
|
||||
installTorExecutable();
|
||||
installObfs4Executable();
|
||||
// installSnowflakeExecutable();
|
||||
installSnowflakeExecutable();
|
||||
if (!doneFile.createNewFile())
|
||||
LOG.warning("Failed to create done file");
|
||||
}
|
||||
@@ -350,9 +352,9 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
||||
if (LOG.isLoggable(INFO))
|
||||
LOG.info("Installing Tor binary for " + architecture);
|
||||
File torFile = getTorExecutableFile();
|
||||
extract(getTorInputStream(), torFile);
|
||||
extract(getLibEventInputStream(),
|
||||
new File(torFile.getParentFile(), "libevent-2.1.7.dylib"));
|
||||
File libEventFile = getLibEventFile();
|
||||
extract(getExecutableInputStream("tor"), torFile);
|
||||
extract(getExecutableInputStream("libevent-2.1.7.dylib"), libEventFile);
|
||||
if (!torFile.setExecutable(true, true)) throw new IOException();
|
||||
}
|
||||
|
||||
@@ -382,46 +384,6 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
||||
return "";
|
||||
}
|
||||
|
||||
private InputStream getTorInputStream() throws IOException {
|
||||
System.out.println("tor_macos-" + architecture + ".zip");
|
||||
InputStream in = resourceProvider
|
||||
.getResourceInputStream("tor_macos-" + architecture, ".zip");
|
||||
ZipInputStream zin = new ZipInputStream(in);
|
||||
while (true) {
|
||||
ZipEntry entry = zin.getNextEntry();
|
||||
if (entry == null) {
|
||||
break;
|
||||
}
|
||||
String name = entry.getName();
|
||||
System.out.println(name);
|
||||
if (name.equals("tor")) {
|
||||
return zin;
|
||||
}
|
||||
}
|
||||
|
||||
throw new IOException();
|
||||
}
|
||||
|
||||
private InputStream getLibEventInputStream() throws IOException {
|
||||
System.out.println("tor_macos-" + architecture + ".zip");
|
||||
InputStream in = resourceProvider
|
||||
.getResourceInputStream("tor_macos-" + architecture, ".zip");
|
||||
ZipInputStream zin = new ZipInputStream(in);
|
||||
while (true) {
|
||||
ZipEntry entry = zin.getNextEntry();
|
||||
if (entry == null) {
|
||||
break;
|
||||
}
|
||||
String name = entry.getName();
|
||||
System.out.println(name);
|
||||
if (name.startsWith("libevent")) {
|
||||
return zin;
|
||||
}
|
||||
}
|
||||
|
||||
throw new IOException();
|
||||
}
|
||||
|
||||
private static void append(StringBuilder strb, String name, Object value) {
|
||||
strb.append(name);
|
||||
strb.append(" ");
|
||||
|
||||
Reference in New Issue
Block a user