aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/AndroidManifest.xml4
-rw-r--r--app/src/main/c/exec.c36
-rw-r--r--app/src/main/java/org/pacien/tincapp/activities/BaseActivity.kt52
-rw-r--r--app/src/main/java/org/pacien/tincapp/activities/ConfigureActivity.kt190
-rw-r--r--app/src/main/java/org/pacien/tincapp/activities/LaunchActivity.kt118
-rw-r--r--app/src/main/java/org/pacien/tincapp/activities/StartActivity.kt100
-rw-r--r--app/src/main/java/org/pacien/tincapp/activities/StatusActivity.kt212
-rw-r--r--app/src/main/java/org/pacien/tincapp/commands/Command.kt30
-rw-r--r--app/src/main/java/org/pacien/tincapp/commands/Executor.kt48
-rw-r--r--app/src/main/java/org/pacien/tincapp/commands/Tinc.kt70
-rw-r--r--app/src/main/java/org/pacien/tincapp/commands/TincApp.kt62
-rw-r--r--app/src/main/java/org/pacien/tincapp/commands/Tincd.kt22
-rw-r--r--app/src/main/java/org/pacien/tincapp/context/App.kt36
-rw-r--r--app/src/main/java/org/pacien/tincapp/context/AppInfo.kt30
-rw-r--r--app/src/main/java/org/pacien/tincapp/context/AppPaths.kt54
-rw-r--r--app/src/main/java/org/pacien/tincapp/data/CidrAddress.kt18
-rw-r--r--app/src/main/java/org/pacien/tincapp/data/TincConfiguration.kt16
-rw-r--r--app/src/main/java/org/pacien/tincapp/data/VpnInterfaceConfiguration.kt82
-rw-r--r--app/src/main/java/org/pacien/tincapp/extensions/Android.kt20
-rw-r--r--app/src/main/java/org/pacien/tincapp/extensions/ApacheConfiguration.kt8
-rw-r--r--app/src/main/java/org/pacien/tincapp/extensions/Java.kt12
-rw-r--r--app/src/main/java/org/pacien/tincapp/extensions/VpnServiceBuilder.kt74
-rw-r--r--app/src/main/java/org/pacien/tincapp/service/TincVpnService.kt210
-rw-r--r--app/src/main/java/org/pacien/tincapp/utils/PemUtils.kt82
-rw-r--r--app/src/main/res/drawable/ic_build_primary_24dp.xml14
-rw-r--r--app/src/main/res/drawable/ic_help_primary_24dp.xml14
-rw-r--r--app/src/main/res/drawable/ic_photo_camera_primary_24dp.xml8
-rw-r--r--app/src/main/res/drawable/ic_stop_primary_24dp.xml8
-rw-r--r--app/src/main/res/icon.svg56
-rw-r--r--app/src/main/res/layout/base.xml14
-rw-r--r--app/src/main/res/layout/dialog_decrypt_keys.xml14
-rw-r--r--app/src/main/res/layout/dialog_encrypt_decrypt_keys.xml14
-rw-r--r--app/src/main/res/layout/dialog_network_generate.xml14
-rw-r--r--app/src/main/res/layout/dialog_network_join.xml14
-rw-r--r--app/src/main/res/layout/dialog_node_details.xml12
-rw-r--r--app/src/main/res/menu/menu_base.xml6
-rw-r--r--app/src/main/res/menu/menu_start.xml6
-rw-r--r--app/src/main/res/menu/menu_status.xml6
-rw-r--r--app/src/main/res/values-v21/styles.xml1
39 files changed, 921 insertions, 866 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3ccc9e6..f03a640 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,7 +1,7 @@
1<?xml version="1.0" encoding="utf-8"?> 1<?xml version="1.0" encoding="utf-8"?>
2<manifest xmlns:android="http://schemas.android.com/apk/res/android" 2<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3 xmlns:tools="http://schemas.android.com/tools" 3 xmlns:tools="http://schemas.android.com/tools"
4 package="org.pacien.tincapp"> 4 package="org.pacien.tincapp">
5 5
6 <uses-permission android:name="android.permission.INTERNET"/> 6 <uses-permission android:name="android.permission.INTERNET"/>
7 <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> 7 <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
diff --git a/app/src/main/c/exec.c b/app/src/main/c/exec.c
index fdaec0f..a9871a5 100644
--- a/app/src/main/c/exec.c
+++ b/app/src/main/c/exec.c
@@ -3,32 +3,32 @@
3#include <stdlib.h> 3#include <stdlib.h>
4 4
5static inline const char **to_string_array(JNIEnv *env, jobjectArray ja) { 5static inline const char **to_string_array(JNIEnv *env, jobjectArray ja) {
6 const int len = (*env)->GetArrayLength(env, ja); 6 const int len = (*env)->GetArrayLength(env, ja);
7 const char **ca = calloc((size_t) len + 1, sizeof(char *)); 7 const char **ca = calloc((size_t) len + 1, sizeof(char *));
8 8
9 for (int i = 0; i < len; ++i) { 9 for (int i = 0; i < len; ++i) {
10 jstring jstr = (jstring) (*env)->GetObjectArrayElement(env, ja, i); 10 jstring jstr = (jstring) (*env)->GetObjectArrayElement(env, ja, i);
11 ca[i] = (*env)->GetStringUTFChars(env, jstr, NULL); 11 ca[i] = (*env)->GetStringUTFChars(env, jstr, NULL);
12 } 12 }
13 13
14 ca[len] = NULL; 14 ca[len] = NULL;
15 return ca; 15 return ca;
16} 16}
17 17
18static inline void exec(const char **argcv) { 18static inline void exec(const char **argcv) {
19 execv(argcv[0], (char *const *) argcv); 19 execv(argcv[0], (char *const *) argcv);
20 exit(1); 20 exit(1);
21} 21}
22 22
23JNIEXPORT jint JNICALL 23JNIEXPORT jint JNICALL
24Java_org_pacien_tincapp_commands_Executor_forkExec(JNIEnv *env, jclass class, jobjectArray argcv) { 24Java_org_pacien_tincapp_commands_Executor_forkExec(JNIEnv *env, jclass class, jobjectArray argcv) {
25 pid_t pid = fork(); 25 pid_t pid = fork();
26 switch (pid) { 26 switch (pid) {
27 case 0: 27 case 0:
28 exec(to_string_array(env, argcv)); 28 exec(to_string_array(env, argcv));
29 return 0; 29 return 0;
30 30
31 default: 31 default:
32 return pid; 32 return pid;
33 } 33 }
34} 34}
diff --git a/app/src/main/java/org/pacien/tincapp/activities/BaseActivity.kt b/app/src/main/java/org/pacien/tincapp/activities/BaseActivity.kt
index 4904a66..c092111 100644
--- a/app/src/main/java/org/pacien/tincapp/activities/BaseActivity.kt
+++ b/app/src/main/java/org/pacien/tincapp/activities/BaseActivity.kt
@@ -19,34 +19,34 @@ import org.pacien.tincapp.context.AppInfo
19 */ 19 */
20abstract class BaseActivity : AppCompatActivity() { 20abstract class BaseActivity : AppCompatActivity() {
21 21
22 override fun onCreate(savedInstanceState: Bundle?) { 22 override fun onCreate(savedInstanceState: Bundle?) {
23 super.onCreate(savedInstanceState) 23 super.onCreate(savedInstanceState)
24 setContentView(R.layout.base) 24 setContentView(R.layout.base)
25 setSupportActionBar(toolbar) 25 setSupportActionBar(toolbar)
26 } 26 }
27 27
28 override fun onCreateOptionsMenu(m: Menu): Boolean { 28 override fun onCreateOptionsMenu(m: Menu): Boolean {
29 menuInflater.inflate(R.menu.menu_base, m) 29 menuInflater.inflate(R.menu.menu_base, m)
30 return true 30 return true
31 } 31 }
32 32
33 fun aboutDialog(@Suppress("UNUSED_PARAMETER") i: MenuItem) { 33 fun aboutDialog(@Suppress("UNUSED_PARAMETER") i: MenuItem) {
34 AlertDialog.Builder(this) 34 AlertDialog.Builder(this)
35 .setTitle(BuildConfig.APPLICATION_ID) 35 .setTitle(BuildConfig.APPLICATION_ID)
36 .setMessage(resources.getString(R.string.app_short_desc) + "\n\n" + 36 .setMessage(resources.getString(R.string.app_short_desc) + "\n\n" +
37 resources.getString(R.string.app_copyright) + " " + 37 resources.getString(R.string.app_copyright) + " " +
38 resources.getString(R.string.app_license) + "\n\n" + 38 resources.getString(R.string.app_license) + "\n\n" +
39 AppInfo.all()) 39 AppInfo.all())
40 .setNeutralButton(R.string.action_open_project_website) { _, _ -> App.openURL(resources.getString(R.string.app_website_url)) } 40 .setNeutralButton(R.string.action_open_project_website) { _, _ -> App.openURL(resources.getString(R.string.app_website_url)) }
41 .setPositiveButton(R.string.action_close, App.dismissAction) 41 .setPositiveButton(R.string.action_close, App.dismissAction)
42 .show() 42 .show()
43 } 43 }
44 44
45 protected fun notify(@StringRes msg: Int) = Snackbar.make(activity_base, msg, Snackbar.LENGTH_LONG).show() 45 protected fun notify(@StringRes msg: Int) = Snackbar.make(activity_base, msg, Snackbar.LENGTH_LONG).show()
46 protected fun notify(msg: String) = Snackbar.make(activity_base, msg, Snackbar.LENGTH_LONG).show() 46 protected fun notify(msg: String) = Snackbar.make(activity_base, msg, Snackbar.LENGTH_LONG).show()
47 protected fun showProgressDialog(@StringRes msg: Int): ProgressDialog = ProgressDialog.show(this, null, getString(msg), true, false) 47 protected fun showProgressDialog(@StringRes msg: Int): ProgressDialog = ProgressDialog.show(this, null, getString(msg), true, false)
48 protected fun showErrorDialog(msg: String): AlertDialog = AlertDialog.Builder(this) 48 protected fun showErrorDialog(msg: String): AlertDialog = AlertDialog.Builder(this)
49 .setTitle(R.string.title_error).setMessage(msg) 49 .setTitle(R.string.title_error).setMessage(msg)
50 .setPositiveButton(R.string.action_close, App.dismissAction).show() 50 .setPositiveButton(R.string.action_close, App.dismissAction).show()
51 51
52} 52}
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 6c29a53..ec17c11 100644
--- a/app/src/main/java/org/pacien/tincapp/activities/ConfigureActivity.kt
+++ b/app/src/main/java/org/pacien/tincapp/activities/ConfigureActivity.kt
@@ -26,102 +26,102 @@ import org.pacien.tincapp.extensions.Java.exceptionallyAccept
26 */ 26 */
27class ConfigureActivity : BaseActivity() { 27class ConfigureActivity : BaseActivity() {
28 28
29 companion object { 29 companion object {
30 val REQUEST_SCAN = 0 30 val REQUEST_SCAN = 0
31 val SCAN_PROVIDER = "com.google.zxing.client.android" 31 val SCAN_PROVIDER = "com.google.zxing.client.android"
32 }
33
34 private var joinDialog: View? = null
35
36 override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
37 super.onActivityResult(requestCode, resultCode, data)
38
39 if (requestCode ==