aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorpacien2018-02-24 14:23:31 +0100
committerpacien2018-02-24 14:23:31 +0100
commiteb31e3770f8c79ee0debb866e0fd56f9c37eb1be (patch)
treecfe4b5282a4dcfca884b38d83d8985f58ea77c50 /app
parent4f41dc1d2f33223f7051b12d7525d5f0a0e62997 (diff)
downloadtincapp-eb31e3770f8c79ee0debb866e0fd56f9c37eb1be.tar.gz
Add template network.conf at conf. gen.
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/org/pacien/tincapp/activities/ConfigureActivity.kt1
-rw-r--r--app/src/main/java/org/pacien/tincapp/commands/TincApp.kt6
-rw-r--r--app/src/main/res/raw/network.conf13
3 files changed, 20 insertions, 0 deletions
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() {
100 R.string.message_generating_configuration, 100 R.string.message_generating_configuration,
101 Tinc.init(netName, nodeName) 101 Tinc.init(netName, nodeName)
102 .thenCompose { TincApp.removeScripts(netName) } 102 .thenCompose { TincApp.removeScripts(netName) }
103 .thenCompose { TincApp.generateIfaceCfgTemplate(netName) }
103 .thenCompose { TincApp.setPassphrase(netName, newPassphrase = passphrase) }) 104 .thenCompose { TincApp.setPassphrase(netName, newPassphrase = passphrase) })
104 105
105 private fun joinNetwork(netName: String, url: String, passphrase: String? = null) = execAction( 106 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 {
39 .write(AppPaths.netConfFile(netName)) 39 .write(AppPaths.netConfFile(netName))
40 } 40 }
41 41
42 fun generateIfaceCfgTemplate(netName: String) = runAsyncTask {
43 App.getResources().openRawResource(R.raw.network).use { inputStream ->
44 AppPaths.netConfFile(netName).outputStream().use { inputStream.copyTo(it) }
45 }
46 }
47
42 fun setPassphrase(netName: String, currentPassphrase: String? = null, newPassphrase: String?) = runAsyncTask { 48 fun setPassphrase(netName: String, currentPassphrase: String? = null, newPassphrase: String?) = runAsyncTask {
43 listPrivateKeys(netName) 49 listPrivateKeys(netName)
44 .filter { it.exists() } 50 .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 @@
1# network.conf: VPN network interface configuration file
2# Doc: http://tincapp.pacien.org/doc.html#network-interface
3
4# IP address of this node
5#Address = 10.0.0.2/32
6
7# Traffic to route through the VPN
8#Route = 10.0.0.0/24
9# or
10#Route = 0.0.0.0/0
11
12# DNS server(s)
13#DNSServer = 10.0.0.1