diff options
Diffstat (limited to 'app/src/main/java/org/pacien/tincapp/commands/Tinc.kt')
-rw-r--r-- | app/src/main/java/org/pacien/tincapp/commands/Tinc.kt | 24 |
1 files changed, 12 insertions, 12 deletions
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 5116d63..22cbe71 100644 --- a/app/src/main/java/org/pacien/tincapp/commands/Tinc.kt +++ b/app/src/main/java/org/pacien/tincapp/commands/Tinc.kt | |||
@@ -8,16 +8,16 @@ import java.io.IOException | |||
8 | */ | 8 | */ |
9 | object Tinc { | 9 | object Tinc { |
10 | 10 | ||
11 | private fun newCommand(netConf: AppPaths.NetConf): Command = | 11 | private fun newCommand(netName: String): Command = |
12 | Command(AppPaths.tinc().absolutePath) | 12 | Command(AppPaths.tinc().absolutePath) |
13 | .withOption("config", AppPaths.confDir(netConf).absolutePath) | 13 | .withOption("config", AppPaths.confDir(netName).absolutePath) |
14 | .withOption("pidfile", AppPaths.pidFile(netConf).absolutePath) | 14 | .withOption("pidfile", AppPaths.pidFile(netName).absolutePath) |
15 | 15 | ||
16 | // independently runnable commands | 16 | // independently runnable commands |
17 | 17 | ||
18 | @Throws(IOException::class) | 18 | @Throws(IOException::class) |
19 | fun fsck(netConf: AppPaths.NetConf, fix: Boolean): List<String> { | 19 | fun fsck(netName: String, fix: Boolean): List<String> { |
20 | var cmd = newCommand(netConf).withArguments("fsck") | 20 | var cmd = newCommand(netName).withArguments("fsck") |
21 | if (fix) cmd = cmd.withOption("force") | 21 | if (fix) cmd = cmd.withOption("force") |
22 | return Executor.call(cmd) | 22 | return Executor.call(cmd) |
23 | } | 23 | } |
@@ -25,18 +25,18 @@ object Tinc { | |||
25 | // commands requiring a running tinc daemon | 25 | // commands requiring a running tinc daemon |
26 | 26 | ||
27 | @Throws(IOException::class) | 27 | @Throws(IOException::class) |
28 | fun stop(netConf: AppPaths.NetConf) { | 28 | fun stop(netName: String) { |
29 | Executor.call(newCommand(netConf).withArguments("stop")) | 29 | Executor.call(newCommand(netName).withArguments("stop")) |
30 | } | 30 | } |
31 | 31 | ||
32 | @Throws(IOException::class) | 32 | @Throws(IOException::class) |
33 | fun dumpNodes(netConf: AppPaths.NetConf, reachable: Boolean): List<String> = | 33 | fun dumpNodes(netName: String, reachable: Boolean): List<String> = |
34 | Executor.call( | 34 | Executor.call( |
35 | if (reachable) newCommand(netConf).withArguments("dump", "reachable", "nodes") | 35 | if (reachable) newCommand(netName).withArguments("dump", "reachable", "nodes") |
36 | else newCommand(netConf).withArguments("dump", "nodes")) | 36 | else newCommand(netName).withArguments("dump", "nodes")) |
37 | 37 | ||
38 | @Throws(IOException::class) | 38 | @Throws(IOException::class) |
39 | fun info(netConf: AppPaths.NetConf, node: String): String = | 39 | fun info(netName: String, node: String): String = |
40 | Executor.call(newCommand(netConf).withArguments("info", node)).joinToString("\n") | 40 | Executor.call(newCommand(netName).withArguments("info", node)).joinToString("\n") |
41 | 41 | ||
42 | } | 42 | } |