diff options
Diffstat (limited to 'app/src/main/java/org/pacien/tincapp/commands/Tincd.kt')
-rw-r--r-- | app/src/main/java/org/pacien/tincapp/commands/Tincd.kt | 6 |
1 files changed, 4 insertions, 2 deletions
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 db113cc..d44d930 100644 --- a/app/src/main/java/org/pacien/tincapp/commands/Tincd.kt +++ b/app/src/main/java/org/pacien/tincapp/commands/Tincd.kt | |||
@@ -7,14 +7,16 @@ import org.pacien.tincapp.context.AppPaths | |||
7 | */ | 7 | */ |
8 | object Tincd { | 8 | object Tincd { |
9 | 9 | ||
10 | fun start(netName: String, fd: Int) { | 10 | fun start(netName: String, deviceFd: Int, ed25519PrivateKeyFd: Int? = null, rsaPrivateKeyFd: Int? = null) { |
11 | Executor.forkExec(Command(AppPaths.tincd().absolutePath) | 11 | Executor.forkExec(Command(AppPaths.tincd().absolutePath) |
12 | .withOption("no-detach") | 12 | .withOption("no-detach") |
13 | .withOption("config", AppPaths.confDir(netName).absolutePath) | 13 | .withOption("config", AppPaths.confDir(netName).absolutePath) |
14 | .withOption("pidfile", AppPaths.pidFile(netName).absolutePath) | 14 | .withOption("pidfile", AppPaths.pidFile(netName).absolutePath) |
15 | .withOption("logfile", AppPaths.logFile(netName).absolutePath) | 15 | .withOption("logfile", AppPaths.logFile(netName).absolutePath) |
16 | .withOption("option", "DeviceType=fd") | 16 | .withOption("option", "DeviceType=fd") |
17 | .withOption("option", "Device=" + fd)) | 17 | .withOption("option", "Device=" + deviceFd) |
18 | .apply { if (ed25519PrivateKeyFd != null) withOption("option", "Ed25519PrivateKeyFile=/proc/self/fd/$ed25519PrivateKeyFd") } | ||
19 | .apply { if (rsaPrivateKeyFd != null) withOption("option", "PrivateKeyFile=/proc/self/fd/$rsaPrivateKeyFd") }) | ||
18 | } | 20 | } |
19 | 21 | ||
20 | } | 22 | } |