From b6f70d7ed03ab25f184e6a9c14afbfea380b1dbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20Mickevi=C4=8Dius?= Date: Sun, 8 Mar 2015 20:36:37 +0200 Subject: Allow to customize request hostname size and response fragment size. --- src/main/java/org/xapek/andiodine/IodineClient.java | 4 ++-- src/main/java/org/xapek/andiodine/IodinePref.java | 5 +++++ src/main/java/org/xapek/andiodine/IodineVpnService.java | 3 ++- .../java/org/xapek/andiodine/config/ConfigDatabase.java | 6 +++++- .../org/xapek/andiodine/config/IodineConfiguration.java | 16 ++++++++++++++++ src/main/res/values-de/strings.xml | 2 ++ src/main/res/values/strings.xml | 6 ++++++ 7 files changed, 38 insertions(+), 4 deletions(-) (limited to 'src/main') diff --git a/src/main/java/org/xapek/andiodine/IodineClient.java b/src/main/java/org/xapek/andiodine/IodineClient.java index 37178b5..056a5a3 100644 --- a/src/main/java/org/xapek/andiodine/IodineClient.java +++ b/src/main/java/org/xapek/andiodine/IodineClient.java @@ -9,7 +9,7 @@ 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); public static native String getIp(); @@ -50,4 +50,4 @@ public class IodineClient { System.loadLibrary("iodine-client"); Log.d(TAG, "Native Library iodine-client loaded"); } -} \ No newline at end of file +} diff --git a/src/main/java/org/xapek/andiodine/IodinePref.java b/src/main/java/org/xapek/andiodine/IodinePref.java index cc21b59..11c79fb 100644 --- a/src/main/java/org/xapek/andiodine/IodinePref.java +++ b/src/main/java/org/xapek/andiodine/IodinePref.java @@ -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 diff --git a/src/main/java/org/xapek/andiodine/IodineVpnService.java b/src/main/java/org/xapek/andiodine/IodineVpnService.java index 2adad1c..80df946 100644 --- a/src/main/java/org/xapek/andiodine/IodineVpnService.java +++ b/src/main/java/org/xapek/andiodine/IodineVpnService.java @@ -219,7 +219,8 @@ public class IodineVpnService extends VpnService implements Runnable { } int ret = IodineClient.connect(tunnelNamesver, mConfiguration.getTopDomain(), mConfiguration.getRawMode(), - mConfiguration.getLazyMode(), password); + mConfiguration.getLazyMode(), password, mConfiguration.getRequestHostnameSize(), + mConfiguration.getResponseFragmentSize()); String errorMessage = ""; switch (ret) { diff --git a/src/main/java/org/xapek/andiodine/config/ConfigDatabase.java b/src/main/java/org/xapek/andiodine/config/ConfigDatabase.java index c4245ba..481d5e9 100644 --- a/src/main/java/org/xapek/andiodine/config/ConfigDatabase.java +++ b/src/main/java/org/xapek/andiodine/config/ConfigDatabase.java @@ -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) { diff --git a/src/main/java/org/xapek/andiodine/config/IodineConfiguration.java b/src/main/java/org/xapek/andiodine/config/IodineConfiguration.java index 21aac6c..d3e73f2 100644 --- a/src/main/java/org/xapek/andiodine/config/IodineConfiguration.java +++ b/src/main/java/org/xapek/andiodine/config/IodineConfiguration.java @@ -125,6 +125,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() + "]"; diff --git a/src/main/res/values-de/strings.xml b/src/main/res/values-de/strings.xml index 7b516bf..3c2af91 100644 --- a/src/main/res/values-de/strings.xml +++ b/src/main/res/values-de/strings.xml @@ -39,6 +39,8 @@ IP-Adresse eine speziellen Nameserver der gesetzt werden soll wenn Nameserver Modus = Custom ist. Typ der DNS Abfragen. Standardmäßig wird die beste Request type automatisch ausgewählt. Legt fest ob die Default Route gesetzt wird nachdem die Verbindung aufgebaut wurde + Maximale Größe des Upstream-Hostnamen. Die zulässigen Werte liegen zwischen 100 und 255. Der Standardwert ist 255. verkleinern, wenn Sie finden, einige DNS-Relais beantworten, um in voller Länge Anfragen unzuverlässig geben sehr unterschiedlichen Ergebnisse der Fragmentgröße autoprobe. + Antwort Fragmentgröße. Autoprobing, wenn auf 0 gesetzt, die ein Standardwert ist. Aktivieren Konfiguration ist unvollständig Kann das VPN nicht starten, es läuft bereits. diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index ffbbb15..21a3fed 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -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. + 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. + + Response fragment size. Autoprobed when set to 0 which is a default. + Enable Configuration is incomplete Cannot start VPN Service, VPN-Thread is already running -- cgit v1.2.1