diff options
Diffstat (limited to 'app/src/main/java/org/pacien/tincapp/commands/TincApp.kt')
-rw-r--r-- | app/src/main/java/org/pacien/tincapp/commands/TincApp.kt | 7 |
1 files changed, 3 insertions, 4 deletions
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 e5172c8..3c2e27a 100644 --- a/app/src/main/java/org/pacien/tincapp/commands/TincApp.kt +++ b/app/src/main/java/org/pacien/tincapp/commands/TincApp.kt | |||
@@ -1,6 +1,5 @@ | |||
1 | package org.pacien.tincapp.commands | 1 | package org.pacien.tincapp.commands |
2 | 2 | ||
3 | import java8.util.concurrent.CompletableFuture | ||
4 | import org.pacien.tincapp.R | 3 | import org.pacien.tincapp.R |
5 | import org.pacien.tincapp.commands.Executor.runAsyncTask | 4 | import org.pacien.tincapp.commands.Executor.runAsyncTask |
6 | import org.pacien.tincapp.context.App | 5 | import org.pacien.tincapp.context.App |
@@ -30,17 +29,17 @@ object TincApp { | |||
30 | throw FileNotFoundException(App.getResources().getString(R.string.message_network_config_not_found_format, e.message!!)) | 29 | throw FileNotFoundException(App.getResources().getString(R.string.message_network_config_not_found_format, e.message!!)) |
31 | } | 30 | } |
32 | 31 | ||
33 | fun removeScripts(netName: String): CompletableFuture<Void> = runAsyncTask { | 32 | fun removeScripts(netName: String) = runAsyncTask { |
34 | listScripts(netName).forEach { it.delete() } | 33 | listScripts(netName).forEach { it.delete() } |
35 | } | 34 | } |
36 | 35 | ||
37 | fun generateIfaceCfg(netName: String): CompletableFuture<Void> = runAsyncTask { | 36 | fun generateIfaceCfg(netName: String) = runAsyncTask { |
38 | VpnInterfaceConfiguration | 37 | VpnInterfaceConfiguration |
39 | .fromInvitation(AppPaths.invitationFile(netName)) | 38 | .fromInvitation(AppPaths.invitationFile(netName)) |
40 | .write(AppPaths.netConfFile(netName)) | 39 | .write(AppPaths.netConfFile(netName)) |
41 | } | 40 | } |
42 | 41 | ||
43 | fun setPassphrase(netName: String, currentPassphrase: String? = null, newPassphrase: String?): CompletableFuture<Void> = runAsyncTask { | 42 | fun setPassphrase(netName: String, currentPassphrase: String? = null, newPassphrase: String?) = runAsyncTask { |
44 | listPrivateKeys(netName) | 43 | listPrivateKeys(netName) |
45 | .filter { it.exists() } | 44 | .filter { it.exists() } |
46 | .map { Pair(PemUtils.read(it), it) } | 45 | .map { Pair(PemUtils.read(it), it) } |