From eb31e3770f8c79ee0debb866e0fd56f9c37eb1be Mon Sep 17 00:00:00 2001 From: pacien Date: Sat, 24 Feb 2018 14:23:31 +0100 Subject: Add template network.conf at conf. gen. --- .../java/org/pacien/tincapp/activities/ConfigureActivity.kt | 1 + app/src/main/java/org/pacien/tincapp/commands/TincApp.kt | 6 ++++++ app/src/main/res/raw/network.conf | 13 +++++++++++++ 3 files changed, 20 insertions(+) create mode 100644 app/src/main/res/raw/network.conf (limited to 'app/src') diff --git a/app/src/main/java/org/pacien/tincapp/activities/ConfigureActivity.kt b/app/src/main/java/org/pacien/tincapp/activities/ConfigureActivity.kt index e571cf5..64ed61d 100644 --- a/app/src/main/java/org/pacien/tincapp/activities/ConfigureActivity.kt +++ b/app/src/main/java/org/pacien/tincapp/activities/ConfigureActivity.kt @@ -100,6 +100,7 @@ class ConfigureActivity : BaseActivity() { R.string.message_generating_configuration, Tinc.init(netName, nodeName) .thenCompose { TincApp.removeScripts(netName) } + .thenCompose { TincApp.generateIfaceCfgTemplate(netName) } .thenCompose { TincApp.setPassphrase(netName, newPassphrase = passphrase) }) private fun joinNetwork(netName: String, url: String, passphrase: String? = null) = execAction( 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 3c2e27a..53e91db 100644 --- a/app/src/main/java/org/pacien/tincapp/commands/TincApp.kt +++ b/app/src/main/java/org/pacien/tincapp/commands/TincApp.kt @@ -39,6 +39,12 @@ object TincApp { .write(AppPaths.netConfFile(netName)) } + fun generateIfaceCfgTemplate(netName: String) = runAsyncTask { + App.getResources().openRawResource(R.raw.network).use { inputStream -> + AppPaths.netConfFile(netName).outputStream().use { inputStream.copyTo(it) } + } + } + fun setPassphrase(netName: String, currentPassphrase: String? = null, newPassphrase: String?) = runAsyncTask { listPrivateKeys(netName) .filter { it.exists() } diff --git a/app/src/main/res/raw/network.conf b/app/src/main/res/raw/network.conf new file mode 100644 index 0000000..0497009 --- /dev/null +++ b/app/src/main/res/raw/network.conf @@ -0,0 +1,13 @@ +# network.conf: VPN network interface configuration file +# Doc: http://tincapp.pacien.org/doc.html#network-interface + +# IP address of this node +#Address = 10.0.0.2/32 + +# Traffic to route through the VPN +#Route = 10.0.0.0/24 +# or +#Route = 0.0.0.0/0 + +# DNS server(s) +#DNSServer = 10.0.0.1 -- cgit v1.2.3