From d51431a8871fc06796af0440463cfacc95110ec0 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Sat, 2 Jan 2016 02:48:35 +0100 Subject: Make push-peer-info selectable in the UI --- main/src/main/java/de/blinkt/openvpn/VpnProfile.java | 9 ++++++++- main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java | 3 +++ .../main/java/de/blinkt/openvpn/fragments/Settings_Obscure.java | 4 ++++ main/src/main/res/values/strings.xml | 2 ++ main/src/main/res/xml/vpn_obscure.xml | 5 +++++ 5 files changed, 22 insertions(+), 1 deletion(-) (limited to 'main') 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 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 @@ %d days left %d hours left VPN permission revoked by OS (e.g. other VPN program started), stopping VPN + Push Peer info + Send extra information to the server, e.g. SSL version and Android version 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 @@ +