mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-22 23:59:54 +01:00
WIP: macos support
This commit is contained in:
@@ -55,6 +55,8 @@ import java.util.concurrent.Executor;
|
|||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipInputStream;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.annotation.concurrent.GuardedBy;
|
import javax.annotation.concurrent.GuardedBy;
|
||||||
@@ -334,7 +336,7 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
|||||||
doneFile.delete();
|
doneFile.delete();
|
||||||
installTorExecutable();
|
installTorExecutable();
|
||||||
installObfs4Executable();
|
installObfs4Executable();
|
||||||
installSnowflakeExecutable();
|
// installSnowflakeExecutable();
|
||||||
if (!doneFile.createNewFile())
|
if (!doneFile.createNewFile())
|
||||||
LOG.warning("Failed to create done file");
|
LOG.warning("Failed to create done file");
|
||||||
}
|
}
|
||||||
@@ -348,7 +350,9 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
|||||||
if (LOG.isLoggable(INFO))
|
if (LOG.isLoggable(INFO))
|
||||||
LOG.info("Installing Tor binary for " + architecture);
|
LOG.info("Installing Tor binary for " + architecture);
|
||||||
File torFile = getTorExecutableFile();
|
File torFile = getTorExecutableFile();
|
||||||
extract(getExecutableInputStream("tor"), torFile);
|
extract(getTorInputStream(), torFile);
|
||||||
|
extract(getLibEventInputStream(),
|
||||||
|
new File(torFile.getParentFile(), "libevent-2.1.7.dylib"));
|
||||||
if (!torFile.setExecutable(true, true)) throw new IOException();
|
if (!torFile.setExecutable(true, true)) throw new IOException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -378,6 +382,46 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
|||||||
return "";
|
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) {
|
private static void append(StringBuilder strb, String name, Object value) {
|
||||||
strb.append(name);
|
strb.append(name);
|
||||||
strb.append(" ");
|
strb.append(" ");
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ dependencies {
|
|||||||
implementation project(':bramble-core')
|
implementation project(':bramble-core')
|
||||||
|
|
||||||
implementation fileTree(dir: 'libs', include: '*.jar')
|
implementation fileTree(dir: 'libs', include: '*.jar')
|
||||||
def jna_version = '4.5.2'
|
def jna_version = '5.10.0'
|
||||||
implementation "net.java.dev.jna:jna:$jna_version"
|
implementation "net.java.dev.jna:jna:$jna_version"
|
||||||
implementation "net.java.dev.jna:jna-platform:$jna_version"
|
implementation "net.java.dev.jna:jna-platform:$jna_version"
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class UnixTorPlugin extends JavaTorPlugin {
|
|||||||
|
|
||||||
private interface CLibrary extends Library {
|
private interface CLibrary extends Library {
|
||||||
|
|
||||||
CLibrary INSTANCE = Native.loadLibrary("c", CLibrary.class);
|
CLibrary INSTANCE = Native.load("c", CLibrary.class);
|
||||||
|
|
||||||
int getpid();
|
int getpid();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import javax.net.SocketFactory;
|
|||||||
|
|
||||||
import static java.util.logging.Level.INFO;
|
import static java.util.logging.Level.INFO;
|
||||||
import static org.briarproject.bramble.util.OsUtils.isLinux;
|
import static org.briarproject.bramble.util.OsUtils.isLinux;
|
||||||
|
import static org.briarproject.bramble.util.OsUtils.isMac;
|
||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
@NotNullByDefault
|
@NotNullByDefault
|
||||||
@@ -57,14 +58,18 @@ public class UnixTorPluginFactory extends TorPluginFactory {
|
|||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
String getArchitectureForTorBinary() {
|
String getArchitectureForTorBinary() {
|
||||||
if (!isLinux()) return null;
|
if (!isLinux() && !isMac()) return null;
|
||||||
String arch = System.getProperty("os.arch");
|
String arch = System.getProperty("os.arch");
|
||||||
if (LOG.isLoggable(INFO)) {
|
if (LOG.isLoggable(INFO)) {
|
||||||
LOG.info("System's os.arch is " + arch);
|
LOG.info("System's os.arch is " + arch);
|
||||||
}
|
}
|
||||||
if (arch.equals("amd64")) return "x86_64";
|
if (isLinux()) {
|
||||||
else if (arch.equals("aarch64")) return "aarch64";
|
if (arch.equals("amd64")) return "x86_64";
|
||||||
else if (arch.equals("arm")) return "armhf";
|
else if (arch.equals("aarch64")) return "aarch64";
|
||||||
|
else if (arch.equals("arm")) return "armhf";
|
||||||
|
} else if (isMac()) {
|
||||||
|
if (arch.equals("aarch64")) return "aarch64";
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
BIN
bramble-java/src/main/resources/aarch64/obfs4proxy
Executable file
BIN
bramble-java/src/main/resources/aarch64/obfs4proxy
Executable file
Binary file not shown.
150684
bramble-java/src/main/resources/geoip
Normal file
150684
bramble-java/src/main/resources/geoip
Normal file
File diff suppressed because it is too large
Load Diff
BIN
bramble-java/src/main/resources/libevent-2.1.7.dylib
Executable file
BIN
bramble-java/src/main/resources/libevent-2.1.7.dylib
Executable file
Binary file not shown.
BIN
bramble-java/src/main/resources/tor
Executable file
BIN
bramble-java/src/main/resources/tor
Executable file
Binary file not shown.
BIN
bramble-java/src/main/resources/tor_macos-aarch64.zip
Normal file
BIN
bramble-java/src/main/resources/tor_macos-aarch64.zip
Normal file
Binary file not shown.
@@ -21,8 +21,8 @@ dependencyVerification {
|
|||||||
'javax.inject:javax.inject:1:javax.inject-1.jar:91c77044a50c481636c32d916fd89c9118a72195390452c81065080f957de7ff',
|
'javax.inject:javax.inject:1:javax.inject-1.jar:91c77044a50c481636c32d916fd89c9118a72195390452c81065080f957de7ff',
|
||||||
'junit:junit:4.13.2:junit-4.13.2.jar:8e495b634469d64fb8acfa3495a065cbacc8a0fff55ce1e31007be4c16dc57d3',
|
'junit:junit:4.13.2:junit-4.13.2.jar:8e495b634469d64fb8acfa3495a065cbacc8a0fff55ce1e31007be4c16dc57d3',
|
||||||
'net.bytebuddy:byte-buddy:1.9.12:byte-buddy-1.9.12.jar:3688c3d434bebc3edc5516296a2ed0f47b65e451071b4afecad84f902f0efc11',
|
'net.bytebuddy:byte-buddy:1.9.12:byte-buddy-1.9.12.jar:3688c3d434bebc3edc5516296a2ed0f47b65e451071b4afecad84f902f0efc11',
|
||||||
'net.java.dev.jna:jna-platform:4.5.2:jna-platform-4.5.2.jar:f1d00c167d8921c6e23c626ef9f1c3ae0be473c95c68ffa012bc7ae55a87e2d6',
|
'net.java.dev.jna:jna-platform:5.10.0:jna-platform-5.10.0.jar:1f71afd977051bf0109ef5e3767d4e2afd777be894d89788cc0f38ad68f6a16f',
|
||||||
'net.java.dev.jna:jna:4.5.2:jna-4.5.2.jar:0c8eb7acf67261656d79005191debaba3b6bf5dd60a43735a245429381dbecff',
|
'net.java.dev.jna:jna:5.10.0:jna-5.10.0.jar:e335c10679f743207d822c5f7948e930319835492575a9dba6b94f8a3b96fcc8',
|
||||||
'net.jcip:jcip-annotations:1.0:jcip-annotations-1.0.jar:be5805392060c71474bf6c9a67a099471274d30b83eef84bfc4e0889a4f1dcc0',
|
'net.jcip:jcip-annotations:1.0:jcip-annotations-1.0.jar:be5805392060c71474bf6c9a67a099471274d30b83eef84bfc4e0889a4f1dcc0',
|
||||||
'net.ltgt.gradle.incap:incap:0.2:incap-0.2.jar:b625b9806b0f1e4bc7a2e3457119488de3cd57ea20feedd513db070a573a4ffd',
|
'net.ltgt.gradle.incap:incap:0.2:incap-0.2.jar:b625b9806b0f1e4bc7a2e3457119488de3cd57ea20feedd513db070a573a4ffd',
|
||||||
'org.apache-extras.beanshell:bsh:2.0b6:bsh-2.0b6.jar:a17955976070c0573235ee662f2794a78082758b61accffce8d3f8aedcd91047',
|
'org.apache-extras.beanshell:bsh:2.0b6:bsh-2.0b6.jar:a17955976070c0573235ee662f2794a78082758b61accffce8d3f8aedcd91047',
|
||||||
|
|||||||
Reference in New Issue
Block a user