summaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorMartynas Mickevičius <mmartynas@gmail.com>2015-03-08 20:36:37 +0200
committerMartynas Mickevičius <mmartynas@gmail.com>2015-03-10 11:15:31 +0200
commitb6f70d7ed03ab25f184e6a9c14afbfea380b1dbc (patch)
treef10e17ab0a6eb42279bf97bf6adeba57145319be /src/main/java
parentcbccbd1f73aceea461b47a6b118a63b3a5804c9c (diff)
downloadandiodine-b6f70d7ed03ab25f184e6a9c14afbfea380b1dbc.tar.gz
andiodine-b6f70d7ed03ab25f184e6a9c14afbfea380b1dbc.zip
Allow to customize request hostname size and response fragment size.
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/xapek/andiodine/IodineClient.java4
-rw-r--r--src/main/java/org/xapek/andiodine/IodinePref.java5
-rw-r--r--src/main/java/org/xapek/andiodine/IodineVpnService.java3
-rw-r--r--src/main/java/org/xapek/andiodine/config/ConfigDatabase.java6
-rw-r--r--src/main/java/org/xapek/andiodine/config/IodineConfiguration.java16
5 files changed, 30 insertions, 4 deletions
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() + "]";