aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpacien2018-02-10 14:16:15 +0100
committerpacien2018-02-10 14:16:15 +0100
commit87ec3620d2259064831356c2f4000ae591756fd2 (patch)
tree9312da1d357fdd3790d5b80af221653696b23089
parentd1c39ba87bb32308c2d3a7a749abffeb773541ef (diff)
downloadtincapp-87ec3620d2259064831356c2f4000ae591756fd2.tar.gz
Reformat code
-rw-r--r--app/build.gradle94
-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
-rw-r--r--build.gradle28
-rw-r--r--gradle.properties4
42 files changed, 982 insertions, 931 deletions
diff --git a/app/build.gradle b/app/build.gradle
index 1e96fdc..4b11a3e 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -3,66 +3,66 @@ apply plugin: 'kotlin-android'
3apply plugin: 'kotlin-android-extensions' 3apply plugin: 'kotlin-android-extensions'
4 4
5android { 5android {
6 compileSdkVersion 25 6 compileSdkVersion 25
7 buildToolsVersion '26.0.2' 7 buildToolsVersion '26.0.2'
8 8
9 defaultConfig { 9 defaultConfig {
10 applicationId "org.pacien.tincapp" 10 applicationId "org.pacien.tincapp"
11 minSdkVersion 21 11 minSdkVersion 21
12 targetSdkVersion 21 12 targetSdkVersion 21
13 multiDexEnabled true 13 multiDexEnabled true
14 versionCode 7 14 versionCode 7
15 versionName "0.7" 15 versionName "0.7"
16 ndk { 16 ndk {
17 abiFilters 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'arm64-v8a' 17 abiFilters 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'arm64-v8a'
18 } 18 }
19 } 19 }
20 20
21 buildTypes { 21 buildTypes {
22 release { 22 release {
23 minifyEnabled true 23 minifyEnabled true
24 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 24 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
25 } 25 }
26 } 26 }
27 27
28 externalNativeBuild { 28 externalNativeBuild {
29 cmake { 29 cmake {
30 path "CMakeLists.txt" 30 path "CMakeLists.txt"
31 } 31 }
32 } 32 }
33 33
34 lintOptions { 34 lintOptions {
35 disable 'MissingTranslation' 35 disable 'MissingTranslation'
36 } 36 }
37} 37}
38 38
39dependencies { 39dependencies {
40 compile fileTree(dir: 'libs', include: ['*.jar']) 40 compile fileTree(dir: 'libs', include: ['*.jar'])
41 41
42 compile 'com.android.support:appcompat-v7:25.4.0' 42 compile 'com.android.support:appcompat-v7:25.4.0'
43 compile 'com.android.support:design:25.4.0' 43 compile 'com.android.support:design:25.4.0'
44 compile 'com.android.support:support-v4:25.4.0' 44 compile 'com.android.support:support-v4:25.4.0'
45 compile 'com.android.support:recyclerview-v7:25.4.0' 45 compile 'com.android.support:recyclerview-v7:25.4.0'
46 compile 'com.android.support.constraint:constraint-layout:1.0.2' 46 compile 'com.android.support.constraint:constraint-layout:1.0.2'
47 47
48 compile('org.apache.commons:commons-configuration2:2.1.1') { 48 compile('org.apache.commons:commons-configuration2:2.1.1') {
49 exclude group: 'commons-logging', module: 'commons-logging' 49 exclude group: 'commons-logging', module: 'commons-logging'
50 } 50 }
51 compile('commons-beanutils:commons-beanutils:1.9.3') { 51 compile('commons-beanutils:commons-beanutils:1.9.3') {
52 exclude group: 'commons-logging', module: 'commons-logging' 52 exclude group: 'commons-logging', module: 'commons-logging'
53 } 53 }
54 54
55 compile 'org.bouncycastle:bcpkix-jdk15on:1.57' 55 compile 'org.bouncycastle:bcpkix-jdk15on:1.57'
56 56
57 compile 'net.sourceforge.streamsupport:streamsupport-cfuture:1.5.5' 57 compile 'net.sourceforge.streamsupport:streamsupport-cfuture:1.5.5'
58 58
59 compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" 59 compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
60} 60}
61 61
62repositories { 62repositories {
63 mavenCentral() 63 mavenCentral()
64 jcenter() 64 jcenter()
65 maven { 65 maven {
66 url "https://maven.google.com" 66 url "https://maven.google.com"
67 } 67 }
68} 68}
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