From d360837d494a86930b8323a99691dc52925eb7ea Mon Sep 17 00:00:00 2001 From: pacien Date: Fri, 16 Feb 2018 18:42:02 +0100 Subject: Cosmetic --- app/src/main/java/org/pacien/tincapp/commands/Command.kt | 3 --- app/src/main/java/org/pacien/tincapp/commands/Executor.kt | 2 -- app/src/main/java/org/pacien/tincapp/commands/Tinc.kt | 2 -- app/src/main/java/org/pacien/tincapp/commands/TincApp.kt | 2 -- app/src/main/java/org/pacien/tincapp/commands/Tincd.kt | 2 -- 5 files changed, 11 deletions(-) (limited to 'app/src/main/java/org/pacien/tincapp/commands') diff --git a/app/src/main/java/org/pacien/tincapp/commands/Command.kt b/app/src/main/java/org/pacien/tincapp/commands/Command.kt index cb95619..ccb5f10 100644 --- a/app/src/main/java/org/pacien/tincapp/commands/Command.kt +++ b/app/src/main/java/org/pacien/tincapp/commands/Command.kt @@ -6,7 +6,6 @@ import java.util.* * @author pacien */ internal class Command(private val cmd: String) { - private data class Option(val key: String, val value: String?) { fun toCommandLineOption(): String = if (value != null) "--$key=$value" else "--$key" } @@ -25,7 +24,5 @@ internal class Command(private val cmd: String) { } fun asList(): List = listOf(cmd) + opts.map { it.toCommandLineOption() } + args - fun asArray(): Array = this.asList().toTypedArray() - } diff --git a/app/src/main/java/org/pacien/tincapp/commands/Executor.kt b/app/src/main/java/org/pacien/tincapp/commands/Executor.kt index a3b5cea..eb04f6d 100644 --- a/app/src/main/java/org/pacien/tincapp/commands/Executor.kt +++ b/app/src/main/java/org/pacien/tincapp/commands/Executor.kt @@ -12,7 +12,6 @@ import java.io.InputStreamReader * @author pacien */ internal object Executor { - private const val FAILED = -1 class CommandExecutionException(msg: String) : Exception(msg) @@ -56,5 +55,4 @@ internal object Executor { fun runAsyncTask(r: () -> Unit) = CompletableFuture.runAsync(Runnable(r), AsyncTask.THREAD_POOL_EXECUTOR)!! fun supplyAsyncTask(s: () -> U) = CompletableFuture.supplyAsync(Supplier(s), AsyncTask.THREAD_POOL_EXECUTOR)!! - } diff --git a/app/src/main/java/org/pacien/tincapp/commands/Tinc.kt b/app/src/main/java/org/pacien/tincapp/commands/Tinc.kt index e0cdb12..556288a 100644 --- a/app/src/main/java/org/pacien/tincapp/commands/Tinc.kt +++ b/app/src/main/java/org/pacien/tincapp/commands/Tinc.kt @@ -7,7 +7,6 @@ import org.pacien.tincapp.context.AppPaths * @author pacien */ object Tinc { - private fun newCommand(netName: String): Command = Command(AppPaths.tinc().absolutePath) .withOption("config", AppPaths.confDir(netName).absolutePath) @@ -47,5 +46,4 @@ object Tinc { .withOption("config", AppPaths.confDir(netName).absolutePath) .withArguments("join", invitationUrl)) .thenApply { it.joinToString("\n") } - } diff --git a/app/src/main/java/org/pacien/tincapp/commands/TincApp.kt b/app/src/main/java/org/pacien/tincapp/commands/TincApp.kt index 11adb69..e5172c8 100644 --- a/app/src/main/java/org/pacien/tincapp/commands/TincApp.kt +++ b/app/src/main/java/org/pacien/tincapp/commands/TincApp.kt @@ -14,7 +14,6 @@ import java.io.FileNotFoundException * @author pacien */ object TincApp { - private val SCRIPT_SUFFIXES = listOf("-up", "-down", "-created", "-accepted") private val STATIC_SCRIPTS = listOf("tinc", "host", "subnet", "invitation").flatMap { s -> SCRIPT_SUFFIXES.map { s + it } } @@ -49,5 +48,4 @@ object TincApp { .map { Pair(if (newPassphrase?.isNotEmpty() == true) PemUtils.encrypt(it.first, newPassphrase) else it.first, it.second) } .forEach { PemUtils.write(it.first, it.second.writer()) } } - } diff --git a/app/src/main/java/org/pacien/tincapp/commands/Tincd.kt b/app/src/main/java/org/pacien/tincapp/commands/Tincd.kt index 44fcef5..9950b49 100644 --- a/app/src/main/java/org/pacien/tincapp/commands/Tincd.kt +++ b/app/src/main/java/org/pacien/tincapp/commands/Tincd.kt @@ -6,7 +6,6 @@ import org.pacien.tincapp.context.AppPaths * @author pacien */ object Tincd { - fun start(netName: String, deviceFd: Int, ed25519PrivateKeyFd: Int? = null, rsaPrivateKeyFd: Int? = null) = Executor.forkExec(Command(AppPaths.tincd().absolutePath) .withOption("no-detach") @@ -17,5 +16,4 @@ object Tincd { .withOption("option", "Device=" + deviceFd) .apply { if (ed25519PrivateKeyFd != null) withOption("option", "Ed25519PrivateKeyFile=/proc/self/fd/$ed25519PrivateKeyFd") } .apply { if (rsaPrivateKeyFd != null) withOption("option", "PrivateKeyFile=/proc/self/fd/$rsaPrivateKeyFd") }) - } -- cgit v1.2.3