A Mac could install PF rules and advertise itself while IPv4 forwarding was still off. Check and enable forwarding when applying the offer and refresh the physical route when the uplink changes. Try the agent's existing privileges first. When an existing utun needs additional permission, the foreground tray or CLI can obtain an administrator grant scoped to the local UID and overlay subnet. Reconcile the current offer after the dialog so a withdrawal during authorization stays effective. A user agent denied a host utun can serve peers over bounded TCP, UDP and ICMP echo sockets bound to the physical interface. Keep host routes and ordinary local application traffic on the system-utun path. Preserve the saved choice for intentionally off-host setups and report readiness separately. Report exit selection directly to the selected peer over its authenticated session. Older peers appear for one minute following forwarded traffic. The optional announcement trailer remains compatible with control v8. Local IPC v29 carries the new status and authorization results. Keep the exit user count, left-aligned names and one-row scroll controls in a single fixed-height block alongside the network details. Show health and a small traffic trace on folded cards. Open desktop Devices at a usable width and keep the exit action clickable in its compact layout. Replace Android's per-card exit buttons with a fixed thumb-sized control. The chooser and Quick Settings share one list with a single local option, network groups, measured latency and an accessible confirmation sheet. Release the applications and packages as 1.0.9. On macOS, checked formatting, strict workspace Clippy and the workspace all-target test suite, including real encrypted agents and loopback TCP, UDP and ICMP. Ran the opt-in user-mode exit UDP round trip on a physical IPv4 interface. Verified the authorization scripts and syntax of their PF, sudoers and AppleScript components. The privileged two-utun kernel test is reserved for an isolated macOS runner. Rendered phone and desktop layouts in both themes, built the arm64 Android debug APK and cross- checked all workspace targets for Windows GNU.
89 lines
3.8 KiB
Groovy
89 lines
3.8 KiB
Groovy
import groovy.json.JsonSlurper
|
|
|
|
plugins { id 'com.android.application' version '9.2.1' }
|
|
|
|
def workspace = rootProject.projectDir.parentFile
|
|
def abi = 'arm64-v8a'
|
|
android {
|
|
namespace 'cy.hexor.tsunagi'
|
|
compileSdk 35
|
|
def cargoNdk = providers.environmentVariable('ANDROID_NDK_HOME')
|
|
if (cargoNdk.isPresent()) {
|
|
ndkPath = cargoNdk.get()
|
|
def ndkProperties = new Properties()
|
|
file("$ndkPath/source.properties").withInputStream { ndkProperties.load(it) }
|
|
ndkVersion = ndkProperties.getProperty('Pkg.Revision')
|
|
}
|
|
|
|
// Cargo also builds standalone cdylibs for these dependencies. Their code
|
|
// is linked into tsunagi_android; the JVM loads only the application library.
|
|
packaging.jniLibs.excludes += ['**/libboringtun.so', '**/libiroh.so', '**/libiroh_relay.so']
|
|
defaultConfig {
|
|
applicationId 'cy.hexor.tsunagi'
|
|
minSdk 26
|
|
targetSdk 35
|
|
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
|
|
versionCode providers.gradleProperty('tsunagiVersionCode').getOrElse('1').toInteger()
|
|
versionName providers.gradleProperty('tsunagiVersionName').getOrElse('1.0.9')
|
|
ndk { abiFilters abi }
|
|
}
|
|
}
|
|
|
|
// rustls ships its Android trust manager as an AAR in the locked Cargo package.
|
|
def metadata = providers.exec {
|
|
workingDir workspace
|
|
commandLine 'cargo', 'metadata', '--locked', '--format-version', '1', '--filter-platform', 'aarch64-linux-android'
|
|
}.standardOutput.asText.get()
|
|
def cargoMetadata = new JsonSlurper().parseText(metadata)
|
|
def verifier = cargoMetadata.packages.find { it.name == 'rustls-platform-verifier-android' }
|
|
repositories {
|
|
maven {
|
|
url new File(new File(verifier.manifest_path).parent, 'maven')
|
|
metadataSources { mavenPom() }
|
|
content { includeModule 'rustls', 'rustls-platform-verifier' }
|
|
}
|
|
google()
|
|
mavenCentral()
|
|
}
|
|
dependencies {
|
|
implementation "rustls:rustls-platform-verifier:${verifier.version}"
|
|
androidTestImplementation 'androidx.test:runner:1.5.2'
|
|
androidTestImplementation 'junit:junit:4.13.2'
|
|
}
|
|
|
|
abstract class BuildRust extends Exec {
|
|
@OutputDirectory abstract DirectoryProperty getJniLibs()
|
|
}
|
|
|
|
androidComponents.onVariants(androidComponents.selector().all()) { variant ->
|
|
def mode = variant.buildType
|
|
def libs = layout.buildDirectory.dir("generated/rust/${mode}")
|
|
def nativeBuild = tasks.register("cargo${mode.capitalize()}", BuildRust) {
|
|
workingDir workspace
|
|
inputs.files(fileTree(workspace) {
|
|
include 'Cargo.toml', 'Cargo.lock', '.cargo/**', 'crates/**/Cargo.toml', 'crates/**/src/**', 'vendor/**'
|
|
})
|
|
jniLibs.set(libs)
|
|
commandLine 'cargo', 'ndk', '--target', abi, '--platform', '26', '-o', libs.get().asFile,
|
|
'build', '--locked', '--lib', '-p', 'tsunagi-android'
|
|
if (mode == 'release') args '--release'
|
|
}
|
|
variant.sources.jniLibs.addGeneratedSourceDirectory(nativeBuild) { it.jniLibs }
|
|
if (variant.androidTest != null) {
|
|
def probe = tasks.register('cargoVpnSourceProbe', BuildRust) {
|
|
workingDir workspace
|
|
jniLibs.set(layout.buildDirectory.dir('generated/rust/vpnSourceTest'))
|
|
inputs.files(nativeBuild.map { it.inputs.files }, fileTree("${workspace}/crates/tsunagi-android/examples"))
|
|
commandLine 'cargo', 'ndk', '--target', abi, '--platform', '26',
|
|
'build', '--locked', '--example', 'vpn_source_probe', '-p', 'tsunagi-android'
|
|
doLast {
|
|
project.copy {
|
|
from "${cargoMetadata.target_directory}/aarch64-linux-android/debug/examples/libvpn_source_probe.so"
|
|
into jniLibs.dir(abi)
|
|
}
|
|
}
|
|
}
|
|
variant.androidTest.sources.jniLibs.addGeneratedSourceDirectory(probe) { it.jniLibs }
|
|
}
|
|
}
|