summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2016-01-02 02:48:35 +0100
committerArne Schwabe <arne@rfc2549.org>2016-01-02 02:48:35 +0100
commitd51431a8871fc06796af0440463cfacc95110ec0 (patch)
tree8687db129575b4ba63e77372e96e85da9e0921e9 /main
parent0a4c9cda1dacb3541f17dbb8e097310a65555680 (diff)
Make push-peer-info selectable in the UI
Diffstat (limited to 'main')
-rw-r--r--main/src/main/java/de/blinkt/openvpn/VpnProfile.java9
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java3
-rw-r--r--main/src/main/java/de/blinkt/openvpn/fragments/Settings_Obscure.java4
-rwxr-xr-xmain/src/main/res/values/strings.xml2
-rw-r--r--main/src/main/res/xml/vpn_obscure.xml5
5 files changed, 22 insertions, 1 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/VpnProfile.java b/main/src/main/java/de/blinkt/openvpn/VpnProfile.java
index 6b9576bd..63a8ca9c 100644
--- a/main/src/main/java/de/blinkt/openvpn/VpnProfile.java
+++ b/main/src/main/java/de/blinkt/openvpn/VpnProfile.java
@@ -158,6 +158,7 @@ public class VpnProfile implements Serializable, Cloneable {
public String mServerName = "openvpn.blinkt.de";
public String mServerPort = "1194";
public boolean mUseUdp = true;
+ public boolean mPushPeerInfo=false;
public VpnProfile(String name) {
mUuid = UUID.randomUUID();
@@ -193,6 +194,7 @@ public class VpnProfile implements Serializable, Cloneable {
mCheckRemoteCN = false;
mPersistTun = false;
mAllowLocalLAN = true;
+ mPushPeerInfo =false;
mMssFix = 0;
}
@@ -262,8 +264,10 @@ public class VpnProfile implements Serializable, Cloneable {
cfg += "management-query-passwords\n";
cfg += "management-hold\n\n";
- if (!configForOvpn3)
+ if (!configForOvpn3) {
cfg += String.format("setenv IV_GUI_VER %s \n", openVpnEscape(getVersionEnvString(context)));
+ cfg += String.format("setenv IV_PLAT_VER %d \n", Build.VERSION.SDK_INT);
+ }
cfg += "machine-readable-output\n";
@@ -497,6 +501,9 @@ public class VpnProfile implements Serializable, Cloneable {
cfg += "preresolve\n";
}
+ if (mPushPeerInfo)
+ cfg+="push-peer-info\n";
+
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean usesystemproxy = prefs.getBoolean("usesystemproxy", true);
if (usesystemproxy) {
diff --git a/main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java b/main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java
index 652616af..cf801a46 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java
@@ -578,6 +578,9 @@ public class ConfigParser {
if (getOption("persist-tun", 0, 0) != null)
np.mPersistTun = true;
+ if (getOption("push-peer-info", 0, 0) != null)
+ np.mPushPeerInfo = true;
+
Vector<String> connectretry = getOption("connect-retry", 1, 1);
if (connectretry != null)
np.mConnectRetry = connectretry.get(1);
diff --git a/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Obscure.java b/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Obscure.java
index 98c39306..c925494b 100644
--- a/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Obscure.java
+++ b/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Obscure.java
@@ -23,6 +23,7 @@ public class Settings_Obscure extends OpenVpnPreferencesFragment implements OnPr
private EditTextPreference mCustomConfig;
private EditTextPreference mMssFixValue;
private CheckBoxPreference mMssFixCheckBox;
+ private CheckBoxPreference mPeerInfo;
private CheckBoxPreference mPersistent;
private ListPreference mConnectRetrymax;
@@ -33,6 +34,7 @@ public class Settings_Obscure extends OpenVpnPreferencesFragment implements OnPr
mPersistent = (CheckBoxPreference) findPreference("usePersistTun");
mConnectRetrymax = (ListPreference) findPreference("connectretrymax");
mConnectRetry = (EditTextPreference) findPreference("connectretry");
+ mPeerInfo = (CheckBoxPreference) findPreference("peerInfo");
mConnectRetrymax.setOnPreferenceChangeListener(this);
mConnectRetrymax.setSummary("%s");
@@ -45,6 +47,7 @@ public class Settings_Obscure extends OpenVpnPreferencesFragment implements OnPr
protected void loadSettingsBehaviour() {
mPersistent.setChecked(mProfile.mPersistTun);
+ mPeerInfo.setChecked(mProfile.mPushPeerInfo);
mConnectRetrymax.setValue(mProfile.mConnectRetryMax);
onPreferenceChange(mConnectRetrymax, mProfile.mConnectRetryMax);
@@ -58,6 +61,7 @@ public class Settings_Obscure extends OpenVpnPreferencesFragment implements OnPr
mProfile.mConnectRetryMax = mConnectRetrymax.getValue();
mProfile.mPersistTun = mPersistent.isChecked();
mProfile.mConnectRetry = mConnectRetry.getText();
+ mProfile.mPushPeerInfo = mPeerInfo.isChecked();
}
diff --git a/main/src/main/res/values/strings.xml b/main/src/main/res/values/strings.xml
index 251c1e8e..35076818 100755
--- a/main/src/main/res/values/strings.xml
+++ b/main/src/main/res/values/strings.xml
@@ -394,5 +394,7 @@
<string name="days_left">%d days left</string>
<string name="hours_left">%d hours left</string>
<string name="permission_revoked">VPN permission revoked by OS (e.g. other VPN program started), stopping VPN</string>
+ <string name="pushpeerinfo">Push Peer info</string>
+ <string name="pushpeerinfosummary">Send extra information to the server, e.g. SSL version and Android version</string>
</resources>
diff --git a/main/src/main/res/xml/vpn_obscure.xml b/main/src/main/res/xml/vpn_obscure.xml
index 288752aa..9da853a4 100644
--- a/main/src/main/res/xml/vpn_obscure.xml
+++ b/main/src/main/res/xml/vpn_obscure.xml
@@ -9,9 +9,14 @@
<CheckBoxPreference
android:key="usePersistTun"
+ android:persistent="false"
android:summary="@string/persisttun_summary"
android:title="@string/persistent_tun_title" />
+ <CheckBoxPreference
+ android:key="peerInfo"
+ android:summary="@string/pushpeerinfosummary"
+ android:title="@string/pushpeerinfo" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/reconnection_settings">
<ListPreference