Merge branch 'macos3' into 'master'

macOS support

See merge request briar/briar!1790
This commit is contained in:
akwizgran
2023-06-22 17:04:09 +00:00
8 changed files with 124 additions and 7 deletions

View File

@@ -9,7 +9,7 @@ or to develop your own user interface for it.
The REST API peer comes as a `jar` file
and needs a Java Runtime Environment (JRE) that supports at least Java 8.
It currently works only on GNU/Linux operating systems and on Windows.
It currently works on GNU/Linux operating systems, on Windows and on macOS.
To build the `jar` file, you need to specify the combination of architecture and platform:
@@ -17,6 +17,8 @@ To build the `jar` file, you need to specify the combination of architecture and
$ ./gradlew --configure-on-demand briar-headless:aarch64LinuxJar
$ ./gradlew --configure-on-demand briar-headless:armhfLinuxJar
$ ./gradlew --configure-on-demand briar-headless:windowsJar
$ ./gradlew --configure-on-demand briar-headless:x86MacOsJar
$ ./gradlew --configure-on-demand briar-headless:aarch64MacOsJar
You can start the peer (and its API server) like this:
@@ -51,6 +53,11 @@ The answer is an empty JSON array, because you don't have any contacts.
Note that the HTTP request sets an `Authorization` header with the bearer token.
A missing or wrong token will result in a `401` response.
To run on macOS you will need to sign the native tor binaries included in the
jar file. To do so, extract the files in `aarch64` or `x86_64` depending on your
system architecture, sign them using `codesign` and replace the original files
in the jar files with the signed ones.
## REST API
### Listing all contacts

View File

@@ -20,6 +20,9 @@ configurations {
linux {
extendsFrom runtimeClasspath
}
macos {
extendsFrom runtimeClasspath
}
}
sourceCompatibility = 1.8
@@ -38,6 +41,10 @@ dependencies {
windows "org.briarproject:obfs4proxy-windows:$obfs4proxy_version"
windows "org.briarproject:snowflake-windows:$snowflake_version"
macos "org.briarproject:tor-macos:$tor_version"
macos "org.briarproject:obfs4proxy-macos:$obfs4proxy_version"
macos "org.briarproject:snowflake-macos:$snowflake_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'io.javalin:javalin:3.5.0'
implementation 'org.slf4j:slf4j-simple:1.7.30'
@@ -89,7 +96,7 @@ void jarFactory(Jar jarTask, os, architecture, configuration) {
}
{
it.duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
if (os == "linux") {
if (os == "linux" || os == "macos") {
String[] architectures = [
"aarch64",
"armhf",
@@ -100,6 +107,7 @@ void jarFactory(Jar jarTask, os, architecture, configuration) {
exclude arch + "/obfs4proxy"
exclude arch + "/tor"
exclude arch + "/snowflake"
exclude arch + "/libevent-*.dylib"
}
}
}
@@ -153,10 +161,22 @@ task windowsJar(type: Jar) {
jarFactory(it, 'windows', 'x86_64', configurations.windows)
}
task aarch64MacOsJar(type: Jar) {
jarFactory(it, 'macos', 'aarch64', configurations.macos)
}
task x86MacOsJar(type: Jar) {
jarFactory(it, 'macos', 'x86_64', configurations.macos)
}
task linuxJars {
dependsOn(aarch64LinuxJar, armhfLinuxJar, x86LinuxJar)
}
task macosJars {
dependsOn(aarch64MacOsJar, x86MacOsJar)
}
// At the moment for non-Android projects we need to explicitly mark the code generated by kapt
// as 'generated source code' for correct highlighting and resolve in IDE.
idea {

View File

@@ -18,6 +18,7 @@ import org.briarproject.bramble.api.plugin.duplex.DuplexPluginFactory
import org.briarproject.bramble.api.plugin.simplex.SimplexPluginFactory
import org.briarproject.bramble.battery.DefaultBatteryManagerModule
import org.briarproject.bramble.event.DefaultEventExecutorModule
import org.briarproject.bramble.plugin.tor.MacTorPluginFactory
import org.briarproject.bramble.plugin.tor.UnixTorPluginFactory
import org.briarproject.bramble.plugin.tor.WindowsTorPluginFactory
import org.briarproject.bramble.system.ClockModule
@@ -92,10 +93,12 @@ internal class HeadlessModule(private val appDir: File) {
@Singleton
internal fun providePluginConfig(
unixTor: UnixTorPluginFactory,
macTor: MacTorPluginFactory,
winTor: WindowsTorPluginFactory
): PluginConfig {
val duplex: List<DuplexPluginFactory> = when {
isLinux() || isMac() -> listOf(unixTor)
isLinux() -> listOf(unixTor)
isMac() -> listOf(macTor)
isWindows() -> listOf(winTor)
else -> emptyList()
}

View File

@@ -29,7 +29,8 @@ import java.util.logging.Level.INFO
import java.util.logging.Level.WARNING
import java.util.logging.LogManager
private const val DEFAULT_PORT = 7000
// On macOS, port 7000 is used by ControlCenter (probably AirPlay), so use a different port
private val DEFAULT_PORT = if (isMac()) 7001 else 7000
private val DEFAULT_DATA_DIR = getProperty("user.home") + separator + ".briar"
private class Main : CliktCommand(

View File

@@ -44,12 +44,15 @@ dependencyVerification {
'org.briarproject:jtorctl:0.5:jtorctl-0.5.jar:43f8c7d390169772b9a2c82ab806c8414c136a2a8636c555e22754bb7260793b',
'org.briarproject:null-safety:0.1:null-safety-0.1.jar:161760de5e838cb982bafa973df820675d4397098e9a91637a36a306d43ba011',
'org.briarproject:obfs4proxy-linux:0.0.14-tor2:obfs4proxy-linux-0.0.14-tor2.jar:bb2431092b5ad998ad620b0223e725c0f7e43f1b02af2f097a2544edc1fd9738',
'org.briarproject:obfs4proxy-macos:0.0.14-tor2:obfs4proxy-macos-0.0.14-tor2.jar:4a688d3a14d2510dd312213488c8f39ee08e609e47a7300aa12e31ceacb16ce2',
'org.briarproject:obfs4proxy-windows:0.0.14-tor2:obfs4proxy-windows-0.0.14-tor2.jar:b5fbd00a8c35ccf095b265370752390e4cd46055331049c4dfcc236dc9c650ac',
'org.briarproject:onionwrapper-core:0.0.4:onionwrapper-core-0.0.4.jar:28a01a62e96aa763989a8afc325abd3bee54f8021269f91aa48b247a6e717870',
'org.briarproject:onionwrapper-java:0.0.4:onionwrapper-java-0.0.4.jar:7806ef878074498653b557e26eb70e6007df3450d6a910a2e9a322f7eb4df442',
'org.briarproject:snowflake-linux:2.5.1:snowflake-linux-2.5.1.jar:edc807dcb7758365970d95525e4749349a27f462d0e2df6505ad1ca65fb296d2',
'org.briarproject:snowflake-macos:2.5.1:snowflake-macos-2.5.1.jar:f6d59471d476860950bb639ac318920caa460c4d6d023cbd6547c742949c84f0',
'org.briarproject:snowflake-windows:2.5.1:snowflake-windows-2.5.1.jar:700ec9c68dc033f544daa4ca3547c89e523aed66500cf4b3ac51fe017c51e7be',
'org.briarproject:tor-linux:0.4.7.13-2:tor-linux-0.4.7.13-2.jar:1e4ca9e0f724e1f17fcce570832704942cc3be26c4c2eccbe5aae29f35afa307',
'org.briarproject:tor-macos:0.4.7.13-2:tor-macos-0.4.7.13-2.jar:3d84fbe667584d24275c6a4cb197bafcb0ead890e4d46acac3317debf0cd3351',
'org.briarproject:tor-windows:0.4.7.13-2:tor-windows-0.4.7.13-2.jar:3a0aa01ed3103cac0c22a91a6f227ab99f7d32ea970ea41558eece484ab49e88',
'org.checkerframework:checker-compat-qual:2.5.5:checker-compat-qual-2.5.5.jar:11d134b245e9cacc474514d2d66b5b8618f8039a1465cdc55bbc0b34e0008b7a',
'org.checkerframework:checker-qual:3.12.0:checker-qual-3.12.0.jar:ff10785ac2a357ec5de9c293cb982a2cbb605c0309ea4cc1cb9b9bc6dbe7f3cb',