feat: socle initial Gastinel Connect et greffon WireGuard Android

- Greffon Tauri Kotlin base sur le composant officiel com.wireguard.android:tunnel (Apache-2.0)
- Support du VpnService Android avec GoBackend
- Interface web conformement a la charte Gastinel (theme clair, Inter local, 0 coin arrondi)
- Fichier LICENCES-TIERCES.md avec mentions legales de marque WireGuard
- Sous-reseau de test dedie 10.250.0.0/24
Cette révision appartient à :
Theo Gastinel a révisé 2026-10-21 19:04:29 +02:00
révision f60f1e865e
102 fichiers modifiés
+17774

Aucun fichier ne correspond à votre recherche

+23
Voir le fichier
@@ -0,0 +1,23 @@
plugins {
`kotlin-dsl`
}
gradlePlugin {
plugins {
create("pluginsForCoolKids") {
id = "rust"
implementationClass = "RustPlugin"
}
}
}
repositories {
google()
mavenCentral()
}
dependencies {
compileOnly(gradleApi())
implementation("com.android.tools.build:gradle:8.11.0")
}
@@ -0,0 +1,113 @@
import java.io.File
import org.apache.tools.ant.taskdefs.condition.Os
import org.gradle.api.DefaultTask
import org.gradle.api.GradleException
import org.gradle.api.logging.LogLevel
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.TaskAction
open class BuildTask : DefaultTask() {
@Input
var rootDirRel: String? = null
@Input
var target: String? = null
@Input
var release: Boolean? = null
@TaskAction
fun assemble() {
val userCargo = File(System.getProperty("user.home"), ".cargo/bin/cargo.exe")
val executable = if (userCargo.exists()) userCargo.absolutePath else "cargo"
var tauriCliException: Exception? = null
try {
runTauriCli(executable)
} catch (e: Exception) {
tauriCliException = e
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
val fallbacks = listOf(
if (userCargo.exists()) userCargo.absolutePath else "cargo.exe",
"cargo.exe",
"cargo.cmd",
"cargo.bat",
)
for (fallback in fallbacks) {
try {
runTauriCli(fallback)
tauriCliException = null
break
} catch (fallbackException: Exception) {
tauriCliException = fallbackException
}
}
}
}
val copied = ensureSoCopied()
if (!copied && tauriCliException != null) {
throw tauriCliException
}
}
private fun ensureSoCopied(): Boolean {
val rootDirRel = rootDirRel ?: return false
val target = target ?: return false
val isRelease = release ?: false
val profile = if (isRelease) "release" else "debug"
val targetTriple = when (target) {
"aarch64" -> "aarch64-linux-android"
"armv7" -> "armv7-linux-androideabi"
"i686" -> "i686-linux-android"
"x86_64" -> "x86_64-linux-android"
else -> target
}
val abi = when (target) {
"aarch64" -> "arm64-v8a"
"armv7" -> "armeabi-v7a"
"i686" -> "x86"
"x86_64" -> "x86_64"
else -> target
}
val srcDir = File(project.projectDir, "$rootDirRel/target/$targetTriple/$profile")
val soFile = File(srcDir, "libgastinel_connect_lib.so")
if (soFile.exists()) {
val destDir = File(project.projectDir, "src/main/jniLibs/$abi")
destDir.mkdirs()
val destFile = File(destDir, "libgastinel_connect_lib.so")
try {
soFile.copyTo(destFile, overwrite = true)
project.logger.lifecycle("Copie de libgastinel_connect_lib.so vers jniLibs/$abi/libgastinel_connect_lib.so réussie")
return true
} catch (e: Exception) {
project.logger.warn("Échec de copie de libgastinel_connect_lib.so: ${e.message}")
}
}
return false
}
fun runTauriCli(executable: String) {
val rootDirRel = rootDirRel ?: throw GradleException("rootDirRel cannot be null")
val target = target ?: throw GradleException("target cannot be null")
val release = release ?: throw GradleException("release cannot be null")
val args = listOf("tauri", "android", "android-studio-script")
project.exec {
workingDir(File(project.projectDir, rootDirRel))
executable(executable)
args(args)
if (project.logger.isEnabled(LogLevel.DEBUG)) {
args("-vv")
} else if (project.logger.isEnabled(LogLevel.INFO)) {
args("-v")
}
if (release) {
args("--release")
}
args(listOf("--target", target))
}.assertNormalExitValue()
}
}
@@ -0,0 +1,85 @@
import com.android.build.api.dsl.ApplicationExtension
import org.gradle.api.DefaultTask
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.get
const val TASK_GROUP = "rust"
open class Config {
lateinit var rootDirRel: String
}
open class RustPlugin : Plugin<Project> {
private lateinit var config: Config
override fun apply(project: Project) = with(project) {
config = extensions.create("rust", Config::class.java)
val defaultAbiList = listOf("arm64-v8a", "armeabi-v7a", "x86", "x86_64");
val abiList = (findProperty("abiList") as? String)?.split(',') ?: defaultAbiList
val defaultArchList = listOf("arm64", "arm", "x86", "x86_64");
val archList = (findProperty("archList") as? String)?.split(',') ?: defaultArchList
val targetsList = (findProperty("targetList") as? String)?.split(',') ?: listOf("aarch64", "armv7", "i686", "x86_64")
extensions.configure<ApplicationExtension> {
@Suppress("UnstableApiUsage")
flavorDimensions.add("abi")
productFlavors {
create("universal") {
dimension = "abi"
ndk {
abiFilters += abiList
}
}
defaultArchList.forEachIndexed { index, arch ->
create(arch) {
dimension = "abi"
ndk {
abiFilters.add(defaultAbiList[index])
}
}
}
}
}
afterEvaluate {
for (profile in listOf("debug", "release")) {
val profileCapitalized = profile.replaceFirstChar { it.uppercase() }
val buildTask = tasks.maybeCreate(
"rustBuildUniversal$profileCapitalized",
DefaultTask::class.java
).apply {
group = TASK_GROUP
description = "Build dynamic library in $profile mode for all targets"
}
tasks["mergeUniversal${profileCapitalized}JniLibFolders"].dependsOn(buildTask)
for (targetPair in targetsList.withIndex()) {
val targetName = targetPair.value
val targetArch = archList[targetPair.index]
val targetArchCapitalized = targetArch.replaceFirstChar { it.uppercase() }
val targetBuildTask = project.tasks.maybeCreate(
"rustBuild$targetArchCapitalized$profileCapitalized",
BuildTask::class.java
).apply {
group = TASK_GROUP
description = "Build dynamic library in $profile mode for $targetArch"
rootDirRel = config.rootDirRel
target = targetName
release = profile == "release"
}
buildTask.dependsOn(targetBuildTask)
tasks["merge$targetArchCapitalized${profileCapitalized}JniLibFolders"].dependsOn(
targetBuildTask
)
}
}
}
}
}