Author SHA1 Message Date
Yves Fischer a53a746d98 Improve README file 2016-12-01 23:38:18 +01:00
Yves Fischer 52914b0f7b Pass the request-type (qtype) to iodine
Closes #18
2016-12-01 23:35:43 +01:00
Yves Fischer 13c7e0387f Extend .gitignore to ignore gradle/studio files 2016-12-01 23:35:43 +01:00
Will Szumski 04912777fd Use stable API to detect system nameservers
Motivation:
__system_get_property is a hidden api and has already been removed from the ndk once
2016-11-28 19:53:44 +01:00
Will Szumski d8e779e7d3 reduce visibility of IodineVpnException constructors 2016-11-28 19:53:44 +01:00
Will Szumski 7f21ccca2d Extract network device creation error message to strings.xml 2016-11-28 19:53:44 +01:00
Will Szumski ae6bf9d84c prevent NullPointerException when configurationId is invalid 2016-11-28 19:53:44 +01:00
Will Szumski 38050063b3 Inform user of error status when tunnel name server cannot be detected 2016-11-28 19:53:44 +01:00
Will Szumski 67c09b54d2 clone pre-installed ndk to depth of 1 to speed up travis build 2016-11-28 19:08:12 +01:00
Will Szumski cf97b16267 restore c89 compatability 2016-11-28 19:08:12 +01:00
Will Szumski b63fae572b Use Urho3d pre-installed ndk
As per:
   https://github.com/googlesamples/android-ndk/blob/1aaccfa48e9e66778bb9abd87c3b78c5a5605938/.travis.yml
2016-11-28 19:08:12 +01:00
Will Szumski 1a8871f3fe add iodine as a dependency 2016-11-28 19:08:12 +01:00
Will Szumski 8f68d963f9 fix indentation 2016-11-22 23:24:15 +01:00
Will Szumski ac2c930b67 fix bug with string equality test 2016-11-22 23:24:15 +01:00
Will Szumski 089c895f54 typo fix: tunnelNamesver -> tunnelNameserver 2016-11-22 23:24:15 +01:00
Will Szumski 8ce535e672 check for valid nameserver 2016-11-22 23:24:15 +01:00
Will Szumski 0aa036fd7f iterate through net.dns* and pick first valid IPv4 address 2016-11-22 23:24:15 +01:00
yvesf a330b3bf6d Merge pull request #30 from jovial/update_build
update build script

- use oracle jdk8 on travis
- provide gradle-wrapper bash/batch script
- update android gradle plugin
2016-11-22 20:47:32 +01:00
Will Szumski 25e734c2ad use oracle jdk8 2016-11-22 19:45:05 +00:00
Will Szumski 320b3caf47 add gradle-wrapper jar 2016-11-22 19:36:55 +00:00
Will Szumski a4a8171b41 update build script 2016-11-22 19:25:29 +00:00
yvesf 2dc04e8753 Merge pull request #29 from jovial/np_fix
make findViewById more robust
2016-11-22 20:23:09 +01:00
Will Szumski e7181a7507 make findViewById more robust 2016-11-22 19:21:00 +00:00
Yves 899ec173be Update values-de/strings.xml
Improve google-translate version
2015-03-12 18:37:23 +01:00
Yves cd2e99c0a6 Merge pull request #16 from 2m/wip-custom-sizes
Custom request hostname and response fragment sizes
2015-03-12 18:31:05 +01:00
Martynas Mickevičius b6f70d7ed0 Allow to customize request hostname size and response fragment size. 2015-03-10 11:15:31 +02:00
Yves Fischer cbccbd1f73 Small corrections to german translation 2015-03-09 22:30:25 +01:00
Yves 1fe7a0202d Merge pull request #15 from 2m/wip-gradle-build
Gradle build
2015-03-09 22:24:48 +01:00
Martynas Mickevičius 23d9368d16 Gradle build 2015-03-08 16:10:09 +02:00
Yves f08ea668c3 Update AndroidManifest.xml 2014-09-25 19:40:07 +02:00
59 changed files with 515 additions and 200 deletions

No files matched your search

+4
View File
@@ -1,4 +1,6 @@
/.gradle
/bin
/build
/jni/iodine/src/*.o
/jni/iodine/bin
/obj
@@ -14,6 +16,8 @@ tests/gen
# Android Studio
.idea
*.iml
.externalNativeBuild
# ant
out
+13
View File
@@ -0,0 +1,13 @@
language: android
jdk:
- oraclejdk8
android:
components:
- build-tools-21.1.2
- android-15
before_install:
- git clone --depth 1 https://github.com/urho3d/android-ndk.git $HOME/android-ndk-root
- export ANDROID_NDK_HOME=$HOME/android-ndk-root
-19
View File
@@ -1,19 +0,0 @@
E/AndroidRuntime( 1505): FATAL EXCEPTION: main
E/AndroidRuntime( 1505): java.lang.RuntimeException: Error receiving broadcast Intent { act=org.xapek.andiodine.IodineVpnService.STATUS_IDLE flg=0x10 } in org.xapek.andiodine.IodineMain$1@40f33f68
E/AndroidRuntime( 1505): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java)
E/AndroidRuntime( 1505): at android.os.Handler.handleCallback(Handler.java)
E/AndroidRuntime( 1505): at android.os.Handler.dispatchMessage(Handler.java)
E/AndroidRuntime( 1505): at android.os.Looper.loop(Looper.java)
E/AndroidRuntime( 1505): at android.app.ActivityThread.main(ActivityThread.java)
E/AndroidRuntime( 1505): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1505): at java.lang.reflect.Method.invoke(Method.java)
E/AndroidRuntime( 1505): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
E/AndroidRuntime( 1505): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
E/AndroidRuntime( 1505): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 1505): Caused by: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
E/AndroidRuntime( 1505): at android.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java)
E/AndroidRuntime( 1505): at android.app.FragmentManagerImpl.enqueueAction(FragmentManager.java)
E/AndroidRuntime( 1505): at android.app.BackStackRecord.commitInternal(BackStackRecord.java)
E/AndroidRuntime( 1505): at android.app.BackStackRecord.commit(BackStackRecord.java)
E/AndroidRuntime( 1505): at org.xapek.andiodine.IodineMain$1.onReceive(IodineMain.java:41)
E/AndroidRuntime( 1505): ... 10 more
+18 -6
View File
@@ -1,13 +1,26 @@
Dies ist eine Portierung von iodine (http://code.kryo.se/iodine/)
auf Android
![Logo](src/main/res/drawabe/logo.png)
This is a port of iodine (http://code.kryo.se/iodine/) to the Android VPN Framework.
It doesn't require "root" on the phone.
# Documentation
- (german)[Anwenderdokumentation](doc/anwenderdoku.html) [(PDF)](doc/anwenderdoku.pdf)
- (german)[Entwicklerdokumentation](doc/entwicklerdoku.html) [(PDF)](doc/entwicklerdoku.pdf)
The following two documents exist in German language only:
- [Anwenderdokumentation](doc/anwenderdoku.pdf)
- [Entwicklerdokumentation](doc/entwicklerdoku.pdf)
# Building
Requires the Android SDK and NDK to be installed.
``` bash
./gradlew build
```
Then find the APK files in folder `build/outputs/apk/`
# Authors and License
Android Iodine Copyright (c) 2013 Yves Fischer <yvesf+andiodine@xapek.org>
Android Iodine Copyright (c) 2016 Yves Fischer <yvesf+andiodine@xapek.org> and contributors
Same license as iodine.
Iodine Copyright (c) 2006-2009 Bjorn Andersson <flex@kryo.se>, Erik Ekman <yarrick@kryo.se>
@@ -28,4 +41,3 @@ PERFORMANCE OF THIS SOFTWARE.
MD5 implementation by L. Peter Deutsch (license and source in src/md5.[ch])
Copyright (C) 1999, 2000, 2002 Aladdin Enterprises. All rights reserved.
+38
View File
@@ -0,0 +1,38 @@
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
sourceSets.main {
jniLibs.srcDir 'libs'
}
productFlavors {
arm {
ndk {
abiFilters "armeabi"
}
}
x86 {
ndk {
abiFilter "x86"
}
}
}
externalNativeBuild {
ndkBuild {
path 'jni/Android.mk'
}
}
}
Binary file not shown.
+6
View File
@@ -0,0 +1,6 @@
#Mon Nov 21 21:42:02 GMT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
Vendored Executable
+160
View File
@@ -0,0 +1,160 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
Vendored
+90
View File
@@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
+1 -1
View File
@@ -26,7 +26,7 @@ $(LOCAL_PATH)/iodine/src/base64u.h: $(LOCAL_PATH)/iodine/src/base64.h
@echo '/* No use in editing, produced by Makefile! */' > $@
@sed -e 's/\([Bb][Aa][Ss][Ee]64\)/\1u/g ; s/0123456789+/0123456789_/' < $< >> $@
LOCAL_MODULE := iodine-client
LOCAL_MODULE := iodine-client
LOCAL_LDLIBS := -lz -llog
LOCAL_CFLAGS := -Wall
LOCAL_SRC_FILES := iodine-client.c \
+31 -9
View File
@@ -4,6 +4,7 @@
#include <time.h>
#include <unistd.h>
#include <netdb.h>
#include <stdio.h>
#include <jni.h>
@@ -17,6 +18,7 @@
#define IODINE_CLIENT_CLASS "org/xapek/andiodine/IodineClient"
#define IODINE_CLIENT_CLASS_LOG_CALLBACK "log_callback"
#define IODINE_CLIENT_CLASS_LOG_CALLBACK_SIG "(Ljava/lang/String;)V"
#define MAX_DNS_PROPERTIES 4
static int dns_fd;
@@ -85,7 +87,8 @@ JNIEXPORT jint JNICALL Java_org_xapek_andiodine_IodineClient_getDnsFd(
JNIEXPORT jint JNICALL Java_org_xapek_andiodine_IodineClient_connect(
JNIEnv *env, jclass klass, jstring j_nameserv_addr, jstring j_topdomain, jboolean j_raw_mode, jboolean j_lazy_mode,
jstring j_password) {
jstring j_password, jint j_request_hostname_size, jint j_response_fragment_size,
jstring j_request_type) {
// XXX strdup leaks
const char *__p_nameserv_addr = (*env)->GetStringUTFChars(env,
@@ -103,20 +106,30 @@ JNIEXPORT jint JNICALL Java_org_xapek_andiodine_IodineClient_connect(
(*env)->ReleaseStringUTFChars(env, j_topdomain, __p_topdomain);
__android_log_print(ANDROID_LOG_ERROR, "iodine", "Topdomain from vm: %s", p_topdomain);
// extract password parameter
const char *p_password = (*env)->GetStringUTFChars(env, j_password, NULL);
char passwordField[33];
memset(passwordField, 0, 33);
strncpy(passwordField, p_password, 32);
(*env)->ReleaseStringUTFChars(env, j_password, p_password);
tun_config_android.request_disconnect = 0;
// extract request type parameter
const char *p_requestType = (*env)->GetStringUTFChars(env, j_request_type, NULL);
char requestTypeField[8];
memset(requestTypeField, 0, 8);
strncpy(requestTypeField, p_requestType, 7);
(*env)->ReleaseStringUTFChars(env, j_request_type, p_requestType);
__android_log_print(ANDROID_LOG_ERROR, "iodine", "Request Type from vm: %s", requestTypeField);
tun_config_android.request_disconnect = 0;
int selecttimeout = 2; // original: 4
int lazy_mode;
int hostname_maxlen = 0xFF;
int hostname_maxlen = j_request_hostname_size;
int raw_mode;
int autodetect_frag_size = 1;
int max_downstream_frag_size = 3072;
int autodetect_frag_size = j_response_fragment_size == 0 ? 1 : 0;
int max_downstream_frag_size = j_response_fragment_size;
if (j_raw_mode) {
raw_mode = 1;
@@ -138,6 +151,7 @@ JNIEXPORT jint JNICALL Java_org_xapek_andiodine_IodineClient_connect(
client_set_topdomain(p_topdomain);
client_set_hostname_maxlen(hostname_maxlen);
client_set_password(passwordField);
client_set_qtype(requestTypeField);
if ((dns_fd = open_dns_from_host(NULL, 0, AF_INET, AI_PASSIVE)) == -1) {
printf("Could not open dns socket: %s", strerror(errno));
@@ -208,8 +222,16 @@ JNIEXPORT jint JNICALL Java_org_xapek_andiodine_IodineClient_getMtu(JNIEnv *env,
// String IodineClient.getPropertyNetDns1
JNIEXPORT jstring JNICALL Java_org_xapek_andiodine_IodineClient_getPropertyNetDns1(
JNIEnv *env, jclass klass) {
char value[PROP_VALUE_MAX];
__system_property_get("net.dns1", value);
return (*env)->NewStringUTF(env, value);
struct sockaddr_in sa;
int i;
for (i = 1; i <= MAX_DNS_PROPERTIES; i++) {
char prop_name[PROP_NAME_MAX];
char dns[PROP_VALUE_MAX];
snprintf(prop_name, sizeof(prop_name), "net.dns%d", i);
__system_property_get(prop_name, dns);
if (inet_pton(AF_INET, dns, &(sa.sin_addr)) == 1) {
return (*env)->NewStringUTF(env, dns);
}
}
return (*env)->NewStringUTF(env, "");
}
+1 -1
View File
@@ -90,7 +90,7 @@ base64_reverse_init()
}
}
static int
static int
base64_encode(char *buf, size_t *buflen, const void *data, size_t size)
/*
* Fills *buf with max. *buflen characters, encoding size bytes of *data.
+3
View File
@@ -187,6 +187,9 @@ client_set_qtype(char *qtype)
do_qtype = T_SRV;
else if (!strcasecmp(qtype, "TXT"))
do_qtype = T_TXT;
// Added for Andiodine:
else
do_qtype = T_UNSET;
return (do_qtype == T_UNSET);
}
-20
View File
@@ -1,20 +0,0 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
-14
View File
@@ -1,14 +0,0 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-15
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.xapek.andiodine"
android:versionCode="2"
android:versionName="1.1">
android:versionCode="3"
android:versionName="1.3">
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="16"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:debuggable="true"
android:allowBackup="false"
android:icon="@drawable/logo"
android:label="@string/app_name"
@@ -123,7 +123,7 @@ public class FragmentList extends Fragment {
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mConfigDatabase = new ConfigDatabase(getActivity());
mListView = (ListView) getActivity().findViewById(R.id.list_view);
mListView = (ListView) getView().findViewById(R.id.list_view);
mAdapter = new IodineConfigurationAdapter();
mListView.setAdapter(mAdapter);
@@ -134,6 +134,7 @@ public class FragmentList extends Fragment {
setHasOptionsMenu(true); //activate onCreateOptionsMenu
}
@Override
public void onDestroy() {
getActivity().unregisterReceiver(broadcastReceiverConfigurationChanged);
@@ -9,7 +9,8 @@ public class IodineClient {
public static native int getDnsFd();
public static native int connect(String nameserv_addr, String topdomain, boolean raw_mode, boolean lazy_mode,
String password);
String password, int request_hostname_size, int response_fragment_size,
String request_type);
public static native String getIp();
@@ -50,4 +51,4 @@ public class IodineClient {
System.loadLibrary("iodine-client");
Log.d(TAG, "Native Library iodine-client loaded");
}
}
}
@@ -73,6 +73,11 @@ public class IodinePref extends org.xapek.andiodine.preferences.PreferenceActivi
addPreference(ConfigDatabase.COLUMN_CONF_RAW_MODE, "Raw Mode", R.string.pref_help_raw, false);
// Default Route
addPreference(ConfigDatabase.COLUMN_CONF_DEFAULT_ROUTE, "Default Route", R.string.pref_help_default_route, true);
addPreference(ConfigDatabase.COLUMN_CONF_REQUEST_HOSTNAME_SIZE,
"Request Hostname Size", R.string.pref_request_hostname_size, "255");
addPreference(ConfigDatabase.COLUMN_CONF_RESPONSE_FRAGMENT_SIZE,
"Response Fragment Size", R.string.pref_response_fragment_size, "0");
}
@Override
@@ -1,10 +1,16 @@
package org.xapek.andiodine;
import android.annotation.TargetApi;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.LinkProperties;
import android.net.Network;
import android.net.NetworkInfo;
import android.net.VpnService;
import android.os.Build;
import android.os.ParcelFileDescriptor;
import android.util.Log;
@@ -12,18 +18,20 @@ import org.xapek.andiodine.config.ConfigDatabase;
import org.xapek.andiodine.config.IodineConfiguration;
import java.io.IOException;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.List;
public class IodineVpnService extends VpnService implements Runnable {
private class IodineVpnException extends Exception {
private static final long serialVersionUID = 32487871521160156L;
public IodineVpnException(String message, Throwable e) {
IodineVpnException(String message, Throwable e) {
super(message, e);
}
public IodineVpnException(String message) {
IodineVpnException(String message) {
super(message);
}
}
@@ -114,7 +122,7 @@ public class IodineVpnService extends VpnService implements Runnable {
mConfiguration = configDatabase.selectById(configurationId);
if (mConfiguration == null) {
setStatus(ACTION_STATUS_ERROR, mConfiguration.getId(),
setStatus(ACTION_STATUS_ERROR, configurationId,
getString(R.string.vpnservice_error_configuration_incomplete));
return;
}
@@ -203,23 +211,71 @@ public class IodineVpnService extends VpnService implements Runnable {
}
}
@TargetApi(21)
private Network getActiveNetwork() {
ConnectivityManager cm =
(ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo defaultNetworkInfo = cm.getActiveNetworkInfo();
for (Network n : cm.getAllNetworks()) {
NetworkInfo info = cm.getNetworkInfo(n);
if (info.getType() == defaultNetworkInfo.getType() &&
info.getSubtype() == defaultNetworkInfo.getSubtype() &&
info.isConnected()) {
return n;
}
}
return null;
}
@Override
public void run() {
try {
Log.d(TAG, "VPN Thread enter");
setStatus(ACTION_STATUS_CONNECT, mConfiguration.getId(), null);
String tunnelNamesver = IodineClient.getPropertyNetDns1();
String tunnelNameserver = "";
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
ConnectivityManager cm =
(ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
Network activeNetwork = getActiveNetwork();
if (activeNetwork == null) {
String errorMessage = getString(R.string.vpnservice_error_no_active_network);
setStatus(ACTION_STATUS_ERROR, mConfiguration.getId(), errorMessage);
Log.e(TAG, "No active network. Aborting...");
return;
}
LinkProperties prop = cm.getLinkProperties(activeNetwork);
List<InetAddress> servers = prop.getDnsServers();
for (InetAddress candidate : servers) {
Log.d(TAG, "detected dns server: " + candidate);
if (candidate instanceof Inet4Address) {
tunnelNameserver = candidate.getHostAddress();
break;
}
}
} else {
tunnelNameserver = IodineClient.getPropertyNetDns1();
}
if (tunnelNameserver.isEmpty()) {
String errorMessage = getString(R.string.vpnservice_error_dns_detect_failed);
setStatus(ACTION_STATUS_ERROR, mConfiguration.getId(), errorMessage);
Log.e(TAG, "No valid IPv4 name servers detected. Aborting...");
return;
}
Log.d(TAG, "using name server: " + tunnelNameserver);
if (!"".equals(mConfiguration.getTunnelNameserver())) {
tunnelNamesver = mConfiguration.getTunnelNameserver();
tunnelNameserver = mConfiguration.getTunnelNameserver();
}
String password = "";
if (!"".equals(mConfiguration.getPassword())) {
password = mConfiguration.getPassword();
}
int ret = IodineClient.connect(tunnelNamesver, mConfiguration.getTopDomain(), mConfiguration.getRawMode(),
mConfiguration.getLazyMode(), password);
int ret = IodineClient.connect(tunnelNameserver, mConfiguration.getTopDomain(), mConfiguration.getRawMode(),
mConfiguration.getLazyMode(), password, mConfiguration.getRequestHostnameSize(),
mConfiguration.getResponseFragmentSize(), mConfiguration.getRequestType().getIodineName());
String errorMessage = "";
switch (ret) {
@@ -247,7 +303,7 @@ public class IodineVpnService extends VpnService implements Runnable {
} catch (IllegalStateException e) {
String errorMessage = "IllegalStateException";
if (e.getMessage().contains("Cannot create interface")) {
errorMessage = "Failed to create tunnel network device";
errorMessage = getString(R.string.vpnservice_error_create_interface_string);
} else {
e.printStackTrace();
}
@@ -30,6 +30,8 @@ public class ConfigDatabase extends SQLiteOpenHelper {
static public final String COLUMN_CONF_LAZY_MODE = "lazy_mode";
static public final String COLUMN_CONF_DEFAULT_ROUTE = "default_route";
static public final String COLUMN_CONF_REQUEST_TYPE = "request_type";
static public final String COLUMN_CONF_REQUEST_HOSTNAME_SIZE = "request_hostname_size";
static public final String COLUMN_CONF_RESPONSE_FRAGMENT_SIZE = "response_fragment_size";
private static final String createStmt = "CREATE TABLE " + TABLE_NAME_CONF + " (" + //
COLUMN_CONF_ID + " INTEGER PRIMARY KEY," + //
@@ -43,7 +45,9 @@ public class ConfigDatabase extends SQLiteOpenHelper {
COLUMN_CONF_RAW_MODE + " INTEGER," + // Boolean stored as 1=true / 0=false
COLUMN_CONF_LAZY_MODE + " INTEGER," + //
COLUMN_CONF_DEFAULT_ROUTE + " INTEGER," + //
COLUMN_CONF_REQUEST_TYPE + " TEXT" + //
COLUMN_CONF_REQUEST_TYPE + " TEXT," + //
COLUMN_CONF_REQUEST_HOSTNAME_SIZE + " INTEGER," + //
COLUMN_CONF_RESPONSE_FRAGMENT_SIZE + " INTEGER" + //
");";
public ConfigDatabase(Context context) {
@@ -11,7 +11,15 @@ public class IodineConfiguration {
}
public static enum RequestType {
AUTODETECT, NULL, TXT, SRV, MX, CNAME, A
AUTODETECT, NULL, TXT, SRV, MX, CNAME, A;
public String getIodineName() {
if (this == AUTODETECT) {
return "";
} else {
return name();
}
}
}
private final ContentValues v;
@@ -125,6 +133,22 @@ public class IodineConfiguration {
return v;
}
public int getRequestHostnameSize() {
return v.getAsInteger(ConfigDatabase.COLUMN_CONF_REQUEST_HOSTNAME_SIZE);
}
public void setRequestHostnameSize(int requestHostnameFragmentSize) {
v.put(ConfigDatabase.COLUMN_CONF_REQUEST_HOSTNAME_SIZE, requestHostnameFragmentSize);
}
public int getResponseFragmentSize() {
return v.getAsInteger(ConfigDatabase.COLUMN_CONF_RESPONSE_FRAGMENT_SIZE);
}
public void setResponseFragmentSize(int responseFragmentSize) {
v.put(ConfigDatabase.COLUMN_CONF_RESPONSE_FRAGMENT_SIZE, responseFragmentSize);
}
@Override
public String toString() {
return "[IodineConfiguration name=" + getName() + "]";
File renamed without changes.

Before

Width:  |  Height:  |  Size: 693 B

After

Width:  |  Height:  |  Size: 693 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 956 B

After

Width:  |  Height:  |  Size: 956 B

File renamed without changes.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

@@ -1,6 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">AndIodine</string>
<string name="app_about">Über</string>
<string-array name="pref_entries_dnstype">
<item>automatisch</item>
<item>NULL</item>
<item>TXT</item>
<item>SRV</item>
<item>MX</item>
<item>CNAME</item>
<item>A</item>
</string-array>
<string-array name="pref_entries_nameserver_mode">
<item>Netzstandard</item>
<item>Brauch</item>
<item>Tunnel-Endpunkt</item>
</string-array>
<string name="main_description_add_account">Konto hinzufügen</string>
<string name="pref_description_cancel">Abbrechen</string>
<string name="configitem_description_close">Tunnel schliessen</string>
<string name="pref_text_password_label">Passwort</string>
<string name="pref_text_topdomain_label">Tunnel Toplevel Domain</string>
<string name="pref_text_tunnel_nameserver_label">Tunnel Nameserver</string>
@@ -18,6 +39,8 @@
<string name="pref_help_nameserver">IP-Adresse eine speziellen Nameserver der gesetzt werden soll wenn Nameserver Modus = Custom ist.</string>
<string name="pref_help_request_type">Typ der DNS Abfragen. Standardmäßig wird die beste Request type automatisch ausgewählt.</string>
<string name="pref_help_default_route">Legt fest ob die Default Route gesetzt wird nachdem die Verbindung aufgebaut wurde</string>
<string name="pref_request_hostname_size">Maximale Größe des Upstream-Hostnamen. Die zulässigen Werte liegen zwischen 100 und 255. Der Standardwert ist 255. Verkleinere den Wert wenn der DNS Relay unzuverlässig reagiert.</string>
<string name="pref_response_fragment_size">Maximale Größe des Antwortfragments. Autoprobing, wenn auf 0 gesetzt, dies ist der Standardwert.</string>
<string name="enable">Aktivieren</string>
<string name="vpnservice_error_configuration_incomplete">Konfiguration ist unvollständig</string>
<string name="vpnservice_error_already_running">Kann das VPN nicht starten, es läuft bereits.</string>
@@ -26,9 +49,17 @@
<string name="vpnservice_error_handshake_failed">Handshake fehlgeschlagen</string>
<string name="vpnservice_error_unknown_error_code">Unbekannter Fehler. Kode %d</string>
<string name="vpnservice_error_unknown_error_string">Unbekannter Fehler. Grund: %s</string>
<string name="vpnservice_error_dns_detect_failed">Es wurden keine gültigen IPv4-Nameserver erkannt</string>
<string name="vpnservice_error_create_interface_string">Das Tunnel-Netzwerkgerät konnte nicht erstellt werden</string>
<string name="vpnservice_error_no_active_network">Kein aktives Netzwerk</string>
<string name="idle">Leerlauf</string>
<string name="warning">Warnung</string>
<string name="error">Fehler</string>
<string name="configitem_description_manage">Konfiguriere dieses Verbindungsprofil</string>
<string name="pref_title">Verbindungseinstellungen</string>
<string name="main_create_tunnel">Erstelle DNS-Tunnel von Konfiguration %s</string>
<string name="fragment_list_add">Neues Konto</string>
<string name="main_about">Über</string>
<string name="pref_delete">Löschen</string>
</resources>
</resources>
@@ -60,6 +60,12 @@
(returning CNAME). Note that SRV, MX and A may/will cause additional lookups by "smart" caching nameservers to
get an actual IP address, which may either slow down or fail completely.
</string>
<string name="pref_request_hostname_size">Maximum size of upstream hostnames. Valid values are from 100 to 255.
Default is 255. Decrease if you find some DNS relays answer to full-length queries unreliably giving widely
varying results of fragment size autoprobe.
</string>
<string name="pref_response_fragment_size">Response fragment size. Autoprobed when set to 0 which is a default.
</string>
<string name="enable">Enable</string>
<string name="vpnservice_error_configuration_incomplete">Configuration is incomplete</string>
<string name="vpnservice_error_already_running">Cannot start VPN Service, VPN-Thread is already running</string>
@@ -68,6 +74,9 @@
<string name="vpnservice_error_handshake_failed">Handshake failed</string>
<string name="vpnservice_error_unknown_error_code">Unknown Error. Code %d</string>
<string name="vpnservice_error_unknown_error_string">Unknown Error. Reason: %s</string>
<string name="vpnservice_error_dns_detect_failed">No valid IPv4 name servers detected</string>
<string name="vpnservice_error_create_interface_string">Failed to create tunnel network device</string>
<string name="vpnservice_error_no_active_network">No active network</string>
<string name="idle">Idle</string>
<string name="warning">Warning</string>
<string name="error">Error</string>
@@ -79,4 +88,5 @@
<string name="main_about">About</string>
<string name="pref_delete">Delete</string>
</resources>
</resources>
-30
View File
@@ -1,30 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- package name must be unique so suffix with "tests" so package loader doesn't ignore us -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.xapek.andiodine.tests"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="16" />
<!--
We add an application tag here just so that we can indicate that
this package needs to link against the android.test library,
which is needed when building test cases.
-->
<application>
<uses-library android:name="android.test.runner" />
</application>
<!--
This declares that this application uses the instrumentation test runner targeting
the package of com.example.HelloJni. To run the tests use the command:
"adb shell am instrument -w com.example.HelloJni.tests/android.test.InstrumentationTestRunner"
-->
<instrumentation
android:name="android.test.InstrumentationTestRunner"
android:label="Tests for Andiodine"
android:targetPackage="org.xapek.andiodine" />
</manifest>
-20
View File
@@ -1,20 +0,0 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
-14
View File
@@ -1,14 +0,0 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-3
@@ -1,22 +0,0 @@
package org.xapek.andiodine;
import android.test.ActivityInstrumentationTestCase2;
import org.xapek.andiodine.IodineMain;
/**
* This is a simple framework for a test of an Application. See
* {@link android.test.ApplicationTestCase ApplicationTestCase} for more information on
* how to write and extend Application tests.
* <p/>
* To run this test, you can type:
* adb shell am instrument -w \
* -e class org.xapek.andiodine.HelloJniTest \
* com.example.HelloJni.tests/android.test.InstrumentationTestRunner
*/
public class HelloJniTest extends ActivityInstrumentationTestCase2<org.xapek.andiodine.IodineMain> {
public HelloJniTest() {
super(IodineMain.class);
}
}
-26
View File
@@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android" name="Android">
<configuration>
<notImportedProperties>
<property>MANIFEST_FILE_PATH</property>
<property>RESOURCES_DIR_PATH</property>
<property>ASSETS_DIR_PATH</property>
<property>NATIVE_LIBS_DIR_PATH</property>
</notImportedProperties>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="andiodine" scope="PROVIDED" />
</component>
</module>