aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/org/pacien/tincapp/commands/Tincd.kt
blob: 9f2491ef2718f976a16e0bbc49251db7938aba9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package org.pacien.tincapp.commands

import android.content.Context

import org.pacien.tincapp.context.AppPaths

import java.io.IOException

/**
 * @author pacien
 */
object Tincd {

    @Throws(IOException::class)
    fun start(ctx: Context, netName: String, fd: Int) {
        Executor.forkExec(Command(AppPaths.tincd(ctx).absolutePath)
                .withOption("no-detach")
                .withOption("config", AppPaths.confDir(ctx, netName).absolutePath)
                .withOption("pidfile", AppPaths.pidFile(ctx, netName).absolutePath)
                .withOption("logfile", AppPaths.logFile(ctx, netName).absolutePath)
                .withOption("option", "DeviceType=fd")
                .withOption("option", "Device=" + fd))
    }

}