summaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorcyberta <cyberta@riseup.net>2022-07-31 04:26:51 +0000
committercyberta <cyberta@riseup.net>2022-07-31 04:26:51 +0000
commit3bdbe09ffd7f4039f37af93b0da6b0965e09e0bd (patch)
tree5de20333b567084efe8e260145c7d5ca374f8232 /app/src
parent2382b154db69a186e5fcf6600e5c4dceb11fb031 (diff)
parent897278b0fe93552108d3b7b6a75ccd92818a3b83 (diff)
Merge branch 'obfuscation_gateway_pinning' into 'master'1.1.5RC1
Beta Release - Obfuscation gateway pinning See merge request leap/bitmask_android!201
Diffstat (limited to 'app/src')
-rw-r--r--app/src/custom/res/values-pt-rBR/strings.xml4
-rw-r--r--app/src/main/java/de/blinkt/openvpn/core/ConfigParser.java9
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/fragments/ObfuscationProxyDialog.java119
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/fragments/SettingsFragment.java53
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/models/Constants.java8
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/models/Transport.java49
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/utils/ConfigHelper.java27
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/utils/PreferenceHelper.java80
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java56
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java58
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java173
-rw-r--r--app/src/main/res/layout-port/f_eip.xml4
-rw-r--r--app/src/main/res/layout-xlarge-port/a_add_provider.xml3
-rw-r--r--app/src/main/res/layout-xlarge-port/a_custom_provider_setup.xml3
-rw-r--r--app/src/main/res/layout-xlarge-port/a_provider_credentials.xml3
-rw-r--r--app/src/main/res/layout-xlarge-port/a_provider_detail.xml3
-rw-r--r--app/src/main/res/layout-xlarge-port/a_provider_list.xml3
-rw-r--r--app/src/main/res/layout-xlarge-port/f_eip.xml1
-rw-r--r--app/src/main/res/layout-xlarge-port/f_log.xml3
-rw-r--r--app/src/main/res/layout-xlarge/a_add_provider.xml3
-rw-r--r--app/src/main/res/layout-xlarge/a_custom_provider_setup.xml3
-rw-r--r--app/src/main/res/layout-xlarge/a_provider_credentials.xml3
-rw-r--r--app/src/main/res/layout-xlarge/a_provider_detail.xml3
-rw-r--r--app/src/main/res/layout-xlarge/a_provider_list.xml3
-rw-r--r--app/src/main/res/layout-xlarge/f_about.xml3
-rw-r--r--app/src/main/res/layout-xlarge/f_eip.xml1
-rw-r--r--app/src/main/res/layout-xlarge/f_log.xml2
-rw-r--r--app/src/main/res/layout-xlarge/v_icon_text_list_item.xml3
-rw-r--r--app/src/main/res/layout-xlarge/v_loading_screen.xml1
-rw-r--r--app/src/main/res/layout-xlarge/v_provider_header.xml4
-rw-r--r--app/src/main/res/layout-xlarge/v_provider_list_item.xml3
-rw-r--r--app/src/main/res/layout-xlarge/v_single_list_item.xml4
-rw-r--r--app/src/main/res/layout-xlarge/v_switch_list_item.xml1
-rw-r--r--app/src/main/res/layout-xlarge/v_vpn_status.xml3
-rw-r--r--app/src/main/res/layout/a_add_provider.xml4
-rw-r--r--app/src/main/res/layout/a_add_provider_tablet_scrollview.xml7
-rw-r--r--app/src/main/res/layout/a_custom_provider_setup.xml4
-rw-r--r--app/src/main/res/layout/a_custom_provider_setup_tablet_linear_layout.xml4
-rw-r--r--app/src/main/res/layout/a_main.xml4
-rw-r--r--app/src/main/res/layout/a_provider_credentials.xml7
-rw-r--r--app/src/main/res/layout/a_provider_credentials_tablet_linear_layout.xml7
-rw-r--r--app/src/main/res/layout/a_provider_detail.xml4
-rw-r--r--app/src/main/res/layout/a_provider_detail_tablet_linear_layout.xml7
-rw-r--r--app/src/main/res/layout/a_provider_list.xml3
-rw-r--r--app/src/main/res/layout/a_provider_list_tablet_linear_layout.xml4
-rw-r--r--app/src/main/res/layout/allowed_application_layout.xml4
-rw-r--r--app/src/main/res/layout/allowed_vpn_apps.xml4
-rw-r--r--app/src/main/res/layout/custom_toast.xml4
-rw-r--r--app/src/main/res/layout/d_checkbox_confirm.xml6
-rw-r--r--app/src/main/res/layout/d_list_selection.xml4
-rw-r--r--app/src/main/res/layout/d_obfuscation_proxy.xml129
-rw-r--r--app/src/main/res/layout/donation_reminder_dialog.xml4
-rw-r--r--app/src/main/res/layout/f_about.xml3
-rw-r--r--app/src/main/res/layout/f_drawer_main.xml1
-rw-r--r--app/src/main/res/layout/f_eip.xml4
-rw-r--r--app/src/main/res/layout/f_gateway_selection.xml4
-rw-r--r--app/src/main/res/layout/f_log.xml1
-rw-r--r--app/src/main/res/layout/f_log_sliders.xml3
-rw-r--r--app/src/main/res/layout/f_settings.xml13
-rw-r--r--app/src/main/res/layout/v_custom_notification.xml1
-rw-r--r--app/src/main/res/layout/v_icon_select_text_list_item.xml3
-rw-r--r--app/src/main/res/layout/v_icon_text_list_item.xml3
-rw-r--r--app/src/main/res/layout/v_loading_screen.xml1
-rw-r--r--app/src/main/res/layout/v_location_button.xml4
-rw-r--r--app/src/main/res/layout/v_location_status_indicator.xml1
-rw-r--r--app/src/main/res/layout/v_log_item.xml1
-rw-r--r--app/src/main/res/layout/v_main_btn.xml4
-rw-r--r--app/src/main/res/layout/v_provider_credentials.xml4
-rw-r--r--app/src/main/res/layout/v_provider_header.xml4
-rw-r--r--app/src/main/res/layout/v_provider_list_item.xml3
-rw-r--r--app/src/main/res/layout/v_select_text_list_item.xml3
-rw-r--r--app/src/main/res/layout/v_simple_checkbox.xml6
-rw-r--r--app/src/main/res/layout/v_single_list_item.xml4
-rw-r--r--app/src/main/res/layout/v_switch_list_item.xml1
-rw-r--r--app/src/main/res/layout/v_vpn_status.xml3
-rw-r--r--app/src/main/res/values-es-rAR/strings.xml1
-rw-r--r--app/src/main/res/values-es/strings.xml1
-rw-r--r--app/src/main/res/values-fr/strings.xml1
-rw-r--r--app/src/main/res/values-pt-rBR/strings.xml64
-rw-r--r--app/src/main/res/values-ru/strings.xml73
-rw-r--r--app/src/production/res/layout-xlarge/d_new_provider.xml5
-rw-r--r--app/src/production/res/layout/d_new_provider.xml4
-rw-r--r--app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java36
-rw-r--r--app/src/test/java/se/leap/bitmaskclient/eip/VpnConfigGeneratorTest.java163
-rw-r--r--app/src/test/resources/ptdemo_misconfigured_kcp_gateways.json160
-rw-r--r--app/src/test/resources/ptdemo_misconfigured_udp2.json65
86 files changed, 1346 insertions, 211 deletions
diff --git a/app/src/custom/res/values-pt-rBR/strings.xml b/app/src/custom/res/values-pt-rBR/strings.xml
index 4d42ea1c..43a64de0 100644
--- a/app/src/custom/res/values-pt-rBR/strings.xml
+++ b/app/src/custom/res/values-pt-rBR/strings.xml
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<resources>
- <string name="donate_message">RiseupVPN é um serviço VPN fácil, rápido e seguro da riseup.net. RiseupVPN não requer uma conta de usuário, nem mantém registros ou rastreia você de qualquer forma. Este serviço é pago inteiramente por doações de usuários como você. Por favor, doe em https://riseup.net/vpn/donate.</string>
- <string name="terms_of_service">Ao usar esse aplicativo você concorda com os Termos de Serviço disponíveis em https://riseup.net/tos. Esse serviço é fornecido da maneira que está, sem garantia, e destina-se a pessoas que trabalham para tornar o mundo um lugar melhor.</string>
+ <string name="donate_message">RiseupVPN é um serviço de VPN fácil, rápido e seguro mantido por riseup.net. RiseupVPN não requer a criação de uma conta, não mantém logs nem te rastreia de forma alguma. O serviço é financiado inteiramente por doações de pessoas como você.Por favor, faça uma doação em https://riseup.net/vpn/donate.</string>
+ <string name="terms_of_service">Ao usar este aplicativo, você concorda com os Termos de Serviço disponível em https://riseup.net/tos. Este serviço é fornecido \"no estado\", sem nenhuma garantia, e tem como público alvo pessoas que trabalham para tornar o mundo um lugar melhor.</string>
</resources>
diff --git a/app/src/main/java/de/blinkt/openvpn/core/ConfigParser.java b/app/src/main/java/de/blinkt/openvpn/core/ConfigParser.java
index 10dd7033..6063ea53 100644
--- a/app/src/main/java/de/blinkt/openvpn/core/ConfigParser.java
+++ b/app/src/main/java/de/blinkt/openvpn/core/ConfigParser.java
@@ -5,10 +5,13 @@
package de.blinkt.openvpn.core;
+import static de.blinkt.openvpn.core.connection.Connection.TransportType.PT;
+
import android.os.Build;
-import androidx.core.util.Pair;
import android.text.TextUtils;
+import androidx.core.util.Pair;
+
import java.io.BufferedReader;
import java.io.IOException;
import java.io.Reader;
@@ -27,8 +30,6 @@ import de.blinkt.openvpn.core.connection.Obfs4Connection;
import de.blinkt.openvpn.core.connection.OpenvpnConnection;
import se.leap.bitmaskclient.pluggableTransports.Obfs4Options;
-import static de.blinkt.openvpn.core.connection.Connection.TransportType.OBFS4;
-
//! Openvpn Config FIle Parser, probably not 100% accurate but close enough
// And remember, this is valid :)
@@ -807,7 +808,7 @@ public class ConfigParser {
return null;
}
else
- conn = transportType == OBFS4 ? new Obfs4Connection(obfs4Options) : new OpenvpnConnection();
+ conn = transportType.getMetaType() == PT ? new Obfs4Connection(obfs4Options) : new OpenvpnConnection();
Vector<String> port = getOption("port", 1, 1);
if (port != null) {
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/ObfuscationProxyDialog.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/ObfuscationProxyDialog.java
new file mode 100644
index 00000000..df78214d
--- /dev/null
+++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/ObfuscationProxyDialog.java
@@ -0,0 +1,119 @@
+package se.leap.bitmaskclient.base.fragments;
+
+import static android.view.View.GONE;
+import static android.view.View.VISIBLE;
+
+import android.app.Dialog;
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.view.View;
+import android.widget.ArrayAdapter;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AlertDialog;
+import androidx.appcompat.app.AppCompatDialogFragment;
+import androidx.appcompat.widget.AppCompatButton;
+import androidx.appcompat.widget.AppCompatEditText;
+import androidx.appcompat.widget.AppCompatSpinner;
+
+import java.util.ArrayList;
+
+import se.leap.bitmaskclient.base.utils.ConfigHelper.ObfsVpnHelper;
+import se.leap.bitmaskclient.base.utils.PreferenceHelper;
+import se.leap.bitmaskclient.base.views.IconSwitchEntry;
+import se.leap.bitmaskclient.databinding.DObfuscationProxyBinding;
+import se.leap.bitmaskclient.eip.GatewaysManager;
+
+public class ObfuscationProxyDialog extends AppCompatDialogFragment {
+ public static final String TAG = ObfuscationProxyDialog.class.getSimpleName();
+ DObfuscationProxyBinding binding;
+ AppCompatEditText ipField;
+ AppCompatEditText portField;
+ AppCompatEditText certificateField;
+ AppCompatSpinner gatewayHost;
+ AppCompatButton saveButton;
+ AppCompatButton useDefaultsButton;
+ AppCompatButton cancelButton;
+ IconSwitchEntry kcpSwitch;
+ ArrayAdapter<String> gatewayHosts;
+
+ @NonNull
+ @Override
+ public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ binding = DObfuscationProxyBinding.inflate(getLayoutInflater());
+ View view = binding.getRoot();
+ AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+ builder.setView(view);
+ ipField = binding.ipField;
+ portField = binding.portField;
+ certificateField = binding.certField;
+ gatewayHost = binding.gatewayHost;
+ saveButton = binding.buttonSave;
+ useDefaultsButton = binding.buttonDefaults;
+ cancelButton = binding.buttonCancel;
+ kcpSwitch = binding.kcpSwitch;
+
+ ipField.setText(PreferenceHelper.getObfuscationPinningIP(getContext()));
+ portField.setText(PreferenceHelper.getObfuscationPinningPort(getContext()));
+ certificateField.setText(PreferenceHelper.getObfuscationPinningCert(getContext()));
+ kcpSwitch.setChecked(PreferenceHelper.getObfuscationPinningKCP(getContext()));
+
+ GatewaysManager gatewaysManager = new GatewaysManager(getContext());
+ ArrayList<String> hostsList = gatewaysManager.getHosts();
+
+ hostsList.add(0, "Select a Gateway");
+ gatewayHosts = new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_item, hostsList);
+ gatewayHosts.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+ gatewayHost.setAdapter(gatewayHosts);
+ String selectedHost = PreferenceHelper.getObfuscationPinningGatewayHost(getContext());
+ if (selectedHost != null) {
+ gatewayHost.setSelection(gatewayHosts.getPosition(selectedHost));
+ }
+
+ saveButton.setOnClickListener(v -> {
+ String ip = TextUtils.isEmpty(ipField.getText()) ? null : ipField.getText().toString();
+ PreferenceHelper.setObfuscationPinningIP(v.getContext(), ip);
+ String port = TextUtils.isEmpty(portField.getText()) ? null : portField.getText().toString();
+ PreferenceHelper.setObfuscationPinningPort(v.getContext(), port);
+ String cert = TextUtils.isEmpty(certificateField.getText()) ? null : certificateField.getText().toString();
+ PreferenceHelper.setObfuscationPinningCert(v.getContext(), cert);
+ String gatewayHostName = gatewayHost.getSelectedItemPosition() == 0 ? null : gatewayHosts.getItem(gatewayHost.getSelectedItemPosition());
+ PreferenceHelper.setObfuscationPinningGatewayHost(v.getContext(), gatewayHostName);
+ PreferenceHelper.setObfuscationPinningGatewayIP(v.getContext(), gatewaysManager.getIpForHost(gatewayHostName));
+ PreferenceHelper.setObfuscationPinningKCP(v.getContext(), kcpSwitch.isChecked());
+ PreferenceHelper.setUseObfuscationPinning(v.getContext(), ip != null && port != null && cert != null && gatewayHostName != null);
+ PreferenceHelper.setObfuscationPinningGatewayLocation(v.getContext(), gatewaysManager.getLocationNameForHost(gatewayHostName));
+ dismiss();
+ });
+
+ useDefaultsButton.setVisibility(ObfsVpnHelper.hasObfuscationPinningDefaults() ? VISIBLE : GONE);
+ useDefaultsButton.setOnClickListener(v -> {
+ ipField.setText(ObfsVpnHelper.obfsvpnIP());
+ portField.setText(ObfsVpnHelper.obfsvpnPort());
+ certificateField.setText(ObfsVpnHelper.obfsvpnCert());
+ int position = gatewayHosts.getPosition(ObfsVpnHelper.gatewayHost());
+ if (position == -1) {
+ position = 0;
+ }
+ gatewayHost.setSelection(position);
+ kcpSwitch.setChecked(ObfsVpnHelper.useKcp());
+ });
+
+ cancelButton.setOnClickListener(v -> {
+ boolean allowPinning = !TextUtils.isEmpty(ipField.getText()) && !TextUtils.isEmpty(portField.getText()) && !TextUtils.isEmpty(certificateField.getText());
+ PreferenceHelper.setUseObfuscationPinning(
+ v.getContext(), allowPinning);
+ dismiss();
+ });
+
+ return builder.create();
+ }
+
+ @Override
+ public void onDestroyView() {
+ super.onDestroyView();
+ binding = null;
+ }
+}
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/SettingsFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/SettingsFragment.java
index 9d15f839..f7d20aa9 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/SettingsFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/SettingsFragment.java
@@ -9,9 +9,10 @@ import static se.leap.bitmaskclient.base.models.Constants.PREFER_UDP;
import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES;
import static se.leap.bitmaskclient.base.models.Constants.USE_BRIDGES;
import static se.leap.bitmaskclient.base.models.Constants.USE_IPv6_FIREWALL;
+import static se.leap.bitmaskclient.base.models.Constants.USE_OBFUSCATION_PINNING;
import static se.leap.bitmaskclient.base.utils.ConfigHelper.ObfsVpnHelper.useObfsVpn;
-import static se.leap.bitmaskclient.base.utils.PreferenceHelper.allowExperimentalTransports;
import static se.leap.bitmaskclient.base.utils.ConfigHelper.isCalyxOSWithTetheringSupport;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.allowExperimentalTransports;
import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getPreferUDP;
import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getShowAlwaysOnDialog;
import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getUseBridges;
@@ -19,7 +20,9 @@ import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getUseSnowflake;
import static se.leap.bitmaskclient.base.utils.PreferenceHelper.hasSnowflakePrefs;
import static se.leap.bitmaskclient.base.utils.PreferenceHelper.preferUDP;
import static se.leap.bitmaskclient.base.utils.PreferenceHelper.setAllowExperimentalTransports;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.setUseObfuscationPinning;
import static se.leap.bitmaskclient.base.utils.PreferenceHelper.useBridges;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.useObfuscationPinning;
import static se.leap.bitmaskclient.base.utils.PreferenceHelper.useSnowflake;
import static se.leap.bitmaskclient.base.utils.ViewHelper.setActionBarTitle;
@@ -86,6 +89,7 @@ public class SettingsFragment extends Fragment implements SharedPreferences.OnSh
initTetheringEntry(view);
initGatewayPinningEntry(view);
initExperimentalTransportsEntry(view);
+ initObfuscationPinningEntry(view);
setActionBarTitle(this, advanced_settings);
return view;
}
@@ -260,6 +264,47 @@ public class SettingsFragment extends Fragment implements SharedPreferences.OnSh
});
}
+ public void initObfuscationPinningEntry(View rootView) {
+ IconSwitchEntry obfuscationPinning = rootView.findViewById(R.id.obfuscation_proxy_pinning);
+ if (useObfsVpn()) {
+ obfuscationPinning.setVisibility(VISIBLE);
+ boolean useBridges = getUseBridges(getContext());
+ obfuscationPinning.setEnabled(useBridges);
+ obfuscationPinning.setSubtitle(useBridges ? "Connect to a specific obfuscation proxy for debugging purposes" : "Enable Bridges to use this option");
+ obfuscationPinning.setChecked(useObfuscationPinning(getContext()));
+ obfuscationPinning.setOnCheckedChangeListener((buttonView, isChecked) -> {
+ if (!buttonView.isPressed()) {
+ return;
+ }
+ if (!isChecked) {
+ setUseObfuscationPinning(getContext(), false);
+ } else {
+ showObfuscationPinningDialog();
+ }
+ });
+ obfuscationPinning.setOnClickListener(v -> {
+ if (obfuscationPinning.isChecked()) {
+ showObfuscationPinningDialog();
+ }
+ });
+ } else {
+ obfuscationPinning.setVisibility(GONE);
+ }
+ }
+
+ public void showObfuscationPinningDialog() {
+ try {
+ FragmentTransaction fragmentTransaction = new FragmentManagerEnhanced(
+ getActivity().getSupportFragmentManager()).removePreviousFragment(
+ ObfuscationProxyDialog.TAG);
+ DialogFragment newFragment = new ObfuscationProxyDialog();
+ newFragment.setCancelable(false);
+ newFragment.show(fragmentTransaction, ObfuscationProxyDialog.TAG);
+ } catch (IllegalStateException | NullPointerException e) {
+ e.printStackTrace();
+ }
+ }
+
public void initExperimentalTransportsEntry(View rootView) {
IconSwitchEntry experimentalTransports = rootView.findViewById(R.id.experimental_transports);
if (useObfsVpn() && ProviderObservable.getInstance().getCurrentProvider().supportsExperimentalPluggableTransports()) {
@@ -315,9 +360,13 @@ public class SettingsFragment extends Fragment implements SharedPreferences.OnSh
initPreferUDPEntry(rootView);
} else if (key.equals(USE_IPv6_FIREWALL)) {
initFirewallEntry(getView());
- } if (key.equals(GATEWAY_PINNING)) {
+ } else if (key.equals(GATEWAY_PINNING)) {
initGatewayPinningEntry(rootView);
}
+
+ if (key.equals(USE_OBFUSCATION_PINNING) || key.equals(USE_BRIDGES)) {
+ initObfuscationPinningEntry(rootView);
+ }
}
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/models/Constants.java b/app/src/main/java/se/leap/bitmaskclient/base/models/Constants.java
index b34a31eb..8fbac35e 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/models/Constants.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/models/Constants.java
@@ -45,6 +45,14 @@ public interface Constants {
String PREFER_UDP = "prefer_UDP";
String GATEWAY_PINNING = "gateway_pinning";
String ALLOW_EXPERIMENTAL_TRANSPORTS = "allow_experimental_transports";
+ String USE_OBFUSCATION_PINNING = "use_obfuscation_pinning";
+ String OBFUSCATION_PINNING_IP = "obfuscation_pinning_ip";
+ String OBFUSCATION_PINNING_PORT = "obfuscation_pinning_port";
+ String OBFUSCATION_PINNING_CERT = "obfuscation_pinning_cert";
+ String OBFUSCATION_PINNING_KCP = "obfuscation_pinning_udp";
+ String OBFUSCATION_PINNING_GW_HOST = "obfuscation_pinning_gw_host";
+ String OBFUSCATION_PINNING_GW_IP = "obfuscation_pinning_gw_ip";
+ String OBFUSCATION_PINNING_LOCATION = "obfuscation_pinning_location";
//////////////////////////////////////////////
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/models/Transport.java b/app/src/main/java/se/leap/bitmaskclient/base/models/Transport.java
new file mode 100644
index 00000000..90a033dd
--- /dev/null
+++ b/app/src/main/java/se/leap/bitmaskclient/base/models/Transport.java
@@ -0,0 +1,49 @@
+package se.leap.bitmaskclient.base.models;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
+import org.json.JSONObject;
+
+public class Transport {
+ private String type;
+ private String[] protocols;
+ private String[] ports;
+ private Options options;
+
+ public Transport(String type, String[] protocols, String[] ports, String cert) {
+ this.type = type;
+ this.protocols = protocols;
+ this.ports = ports;
+ this.options = new Options(cert);
+ }
+
+ @Override
+ public String toString() {
+ return new Gson().toJson(this);
+ }
+
+ public static Transport fromJson(JSONObject json) {
+ GsonBuilder builder = new GsonBuilder();
+ return builder.create().fromJson(json.toString(), Transport.class);
+ }
+
+ public static class Options {
+ private String cert;
+ private String iatMode;
+
+ public Options(String cert) {
+ this.cert = cert;
+ this.iatMode = "0";
+ }
+
+ @Override
+ public String toString() {
+ return new Gson().toJson(this);
+ }
+ }
+
+
+}
+
+
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/utils/ConfigHelper.java b/app/src/main/java/se/leap/bitmaskclient/base/utils/ConfigHelper.java
index 102756c4..c4e2fb17 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/utils/ConfigHelper.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/utils/ConfigHelper.java
@@ -285,5 +285,32 @@ public class ConfigHelper {
public static boolean useObfsVpn() {
return BuildConfig.use_obfsvpn;
}
+
+ public static boolean hasObfuscationPinningDefaults() {
+ return BuildConfig.obfsvpn_ip != null &&
+ BuildConfig.obfsvpn_port != null &&
+ BuildConfig.obfsvpn_cert != null &&
+ BuildConfig.obfsvpn_gateway_host != null &&
+ !BuildConfig.obfsvpn_ip.isEmpty() &&
+ !BuildConfig.obfsvpn_port.isEmpty() &&
+ !BuildConfig.obfsvpn_cert.isEmpty() &&
+ !BuildConfig.obfsvpn_gateway_host.isEmpty();
+ }
+ public static String obfsvpnIP() {
+ return BuildConfig.obfsvpn_ip;
+ }
+ public static String obfsvpnPort() {
+ return BuildConfig.obfsvpn_port;
+ }
+ public static String obfsvpnCert() {
+ return BuildConfig.obfsvpn_cert;
+ }
+ public static String gatewayHost() {
+ return BuildConfig.obfsvpn_gateway_host;
+ }
+
+ public static boolean useKcp() {
+ return BuildConfig.obfsvpn_use_kcp;
+ }
}
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/utils/PreferenceHelper.java b/app/src/main/java/se/leap/bitmaskclient/base/utils/PreferenceHelper.java
index 22fe42ff..d9beffd3 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/utils/PreferenceHelper.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/utils/PreferenceHelper.java
@@ -11,6 +11,13 @@ import static se.leap.bitmaskclient.base.models.Constants.EXCLUDED_APPS;
import static se.leap.bitmaskclient.base.models.Constants.GATEWAY_PINNING;
import static se.leap.bitmaskclient.base.models.Constants.LAST_UPDATE_CHECK;
import static se.leap.bitmaskclient.base.models.Constants.LAST_USED_PROFILE;
+import static se.leap.bitmaskclient.base.models.Constants.OBFUSCATION_PINNING_CERT;
+import static se.leap.bitmaskclient.base.models.Constants.OBFUSCATION_PINNING_GW_HOST;
+import static se.leap.bitmaskclient.base.models.Constants.OBFUSCATION_PINNING_GW_IP;
+import static se.leap.bitmaskclient.base.models.Constants.OBFUSCATION_PINNING_IP;
+import static se.leap.bitmaskclient.base.models.Constants.OBFUSCATION_PINNING_KCP;
+import static se.leap.bitmaskclient.base.models.Constants.OBFUSCATION_PINNING_LOCATION;
+import static se.leap.bitmaskclient.base.models.Constants.OBFUSCATION_PINNING_PORT;
import static se.leap.bitmaskclient.base.models.Constants.PREFERRED_CITY;
import static se.leap.bitmaskclient.base.models.Constants.PREFER_UDP;
import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_CONFIGURED;
@@ -22,10 +29,12 @@ import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES;
import static se.leap.bitmaskclient.base.models.Constants.SHOW_EXPERIMENTAL;
import static se.leap.bitmaskclient.base.models.Constants.USE_BRIDGES;
import static se.leap.bitmaskclient.base.models.Constants.USE_IPv6_FIREWALL;
+import static se.leap.bitmaskclient.base.models.Constants.USE_OBFUSCATION_PINNING;
import static se.leap.bitmaskclient.base.models.Constants.USE_SNOWFLAKE;
import android.content.Context;
import android.content.SharedPreferences;
+import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.annotation.WorkerThread;
@@ -260,6 +269,77 @@ public class PreferenceHelper {
return getBoolean(context, ALLOW_EXPERIMENTAL_TRANSPORTS, false);
}
+ public static void setUseObfuscationPinning(Context context, Boolean pinning) {
+ putBoolean(context, USE_OBFUSCATION_PINNING, pinning);
+ }
+
+ public static boolean useObfuscationPinning(Context context) {
+ return ConfigHelper.ObfsVpnHelper.useObfsVpn() &&
+ getUseBridges(context) &&
+ getBoolean(context, USE_OBFUSCATION_PINNING, false) &&
+ !TextUtils.isEmpty(getObfuscationPinningIP(context)) &&
+ !TextUtils.isEmpty(getObfuscationPinningCert(context)) &&
+ !TextUtils.isEmpty(getObfuscationPinningPort(context)) &&
+ !TextUtils.isEmpty(getObfuscationPinningGatewayHost(context));
+ }
+
+ public static void setObfuscationPinningIP(Context context, String ip) {
+ putString(context, OBFUSCATION_PINNING_IP, ip);
+ }
+
+ public static String getObfuscationPinningIP(Context context) {
+ return getString(context, OBFUSCATION_PINNING_IP, null);
+ }
+
+ public static void setObfuscationPinningPort(Context context, String port) {
+ putString(context, OBFUSCATION_PINNING_PORT, port);
+ }
+
+ public static String getObfuscationPinningPort(Context context) {
+ return getString(context, OBFUSCATION_PINNING_PORT, null);
+ }
+
+ public static void setObfuscationPinningCert(Context context, String cert) {
+ putString(context, OBFUSCATION_PINNING_CERT, cert);
+ }
+
+ public static String getObfuscationPinningCert(Context context) {
+ return getString(context, OBFUSCATION_PINNING_CERT, null);
+ }
+
+ public static void setObfuscationPinningGatewayHost(Context context, String gatewayIP) {
+ putString(context, OBFUSCATION_PINNING_GW_HOST, gatewayIP);
+ }
+
+ public static String getObfuscationPinningGatewayHost(Context context) {
+ return getString(context, OBFUSCATION_PINNING_GW_HOST, null);
+ }
+
+
+ public static void setObfuscationPinningGatewayIP(Context context, String ipForHost) {
+ putString(context, OBFUSCATION_PINNING_GW_IP, ipForHost);
+ }
+
+ public static String getObfuscationPinningGatewayIP(Context context) {
+ return getString(context, OBFUSCATION_PINNING_GW_IP, null);
+ }
+
+ public static void setObfuscationPinningGatewayLocation(Context context, String location) {
+ putString(context, OBFUSCATION_PINNING_LOCATION, location);
+ }
+
+ public static String getObfuscationPinningGatewayLocation(Context context) {
+ return getString(context, OBFUSCATION_PINNING_LOCATION, null);
+ }
+
+ public static Boolean getObfuscationPinningKCP(Context context) {
+ return getBoolean(context, OBFUSCATION_PINNING_KCP, false);
+ }
+
+ public static void setObfuscationPinningKCP(Context context, boolean isKCP) {
+ putBoolean(context, OBFUSCATION_PINNING_KCP, isKCP);
+ }
+
public static void setUseIPv6Firewall(Context context, boolean useFirewall) {
putBoolean(context, USE_IPv6_FIREWALL, useFirewall);
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java b/app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java
index e9281609..ff1dd05e 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/Gateway.java
@@ -26,6 +26,17 @@ import static se.leap.bitmaskclient.base.models.Constants.OPENVPN_CONFIGURATION;
import static se.leap.bitmaskclient.base.models.Constants.OVERLOAD;
import static se.leap.bitmaskclient.base.models.Constants.TIMEZONE;
import static se.leap.bitmaskclient.base.models.Constants.VERSION;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.allowExperimentalTransports;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getExcludedApps;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getObfuscationPinningCert;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getObfuscationPinningGatewayHost;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getObfuscationPinningGatewayIP;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getObfuscationPinningGatewayLocation;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getObfuscationPinningIP;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getObfuscationPinningKCP;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getObfuscationPinningPort;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getPreferUDP;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.useObfuscationPinning;
import android.content.Context;
@@ -45,7 +56,6 @@ import de.blinkt.openvpn.VpnProfile;
import de.blinkt.openvpn.core.ConfigParser;
import de.blinkt.openvpn.core.connection.Connection;
import se.leap.bitmaskclient.base.utils.ConfigHelper;
-import se.leap.bitmaskclient.base.utils.PreferenceHelper;
/**
* Gateway provides objects defining gateways and their metadata.
@@ -87,28 +97,37 @@ public class Gateway {
this.secrets = secrets;
this.load = load;
+ apiVersion = getApiVersion(eipDefinition);
+ VpnConfigGenerator.Configuration configuration = getProfileConfig(context, eipDefinition, apiVersion);
generalConfiguration = getGeneralConfiguration(eipDefinition);
timezone = getTimezone(eipDefinition);
- name = locationAsName(eipDefinition);
- apiVersion = getApiVersion(eipDefinition);
- vpnProfiles = createVPNProfiles(context);
+ name = configuration.profileName;
+ vpnProfiles = createVPNProfiles(configuration);
+ }
+
+ private VpnConfigGenerator.Configuration getProfileConfig(Context context, JSONObject eipDefinition, int apiVersion) {
+ VpnConfigGenerator.Configuration config = new VpnConfigGenerator.Configuration();
+ config.apiVersion = apiVersion;
+ config.preferUDP = getPreferUDP(context);
+ config.experimentalTransports = allowExperimentalTransports(context);
+ config.excludedApps = getExcludedApps(context);
+
+ config.useObfuscationPinning = useObfuscationPinning(context);
+ config.profileName = config.useObfuscationPinning ? getObfuscationPinningGatewayLocation(context) : locationAsName(eipDefinition);
+ config.remoteGatewayIP = config.useObfuscationPinning ? getObfuscationPinningGatewayIP(context) : gateway.optString(IP_ADDRESS);
+ if (config.useObfuscationPinning) {
+ config.obfuscationProxyIP = getObfuscationPinningIP(context);
+ config.obfuscationProxyPort = getObfuscationPinningPort(context);
+ config.obfuscationProxyCert = getObfuscationPinningCert(context);
+ config.obfuscationProxyKCP = getObfuscationPinningKCP(context);
+ }
+ return config;
}
public void updateLoad(JSONObject load) {
this.load = load;
}
- private void addProfileInfos(Context context, HashMap<Connection.TransportType, VpnProfile> profiles) {
- Set<String> excludedAppsVpn = PreferenceHelper.getExcludedApps(context);
- for (VpnProfile profile : profiles.values()) {
- profile.mName = name;
- profile.mGatewayIp = gateway.optString(IP_ADDRESS);
- if (excludedAppsVpn != null) {
- profile.mAllowedAppsVpn = new HashSet<>(excludedAppsVpn);
- }
- }
- }
-
private JSONObject getGeneralConfiguration(JSONObject eipDefinition) {
try {
return eipDefinition.getJSONObject(OPENVPN_CONFIGURATION);
@@ -172,13 +191,10 @@ public class Gateway {
/**
* Create and attach the VpnProfile to our gateway object
*/
- private @NonNull HashMap<Connection.TransportType, VpnProfile> createVPNProfiles(Context context)
+ private @NonNull HashMap<Connection.TransportType, VpnProfile> createVPNProfiles(VpnConfigGenerator.Configuration profileConfig)
throws ConfigParser.ConfigParseError, IOException, JSONException {
- boolean preferUDP = PreferenceHelper.getPreferUDP(context);
- boolean allowExperimentalTransports = PreferenceHelper.allowExperimentalTransports(context);
- VpnConfigGenerator vpnConfigurationGenerator = new VpnConfigGenerator(generalConfiguration, secrets, gateway, apiVersion, preferUDP, allowExperimentalTransports);
+ VpnConfigGenerator vpnConfigurationGenerator = new VpnConfigGenerator(generalConfiguration, secrets, gateway, profileConfig);
HashMap<Connection.TransportType, VpnProfile> profiles = vpnConfigurationGenerator.generateVpnProfiles();
- addProfileInfos(context, profiles);
return profiles;
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
index db7dd38c..7bcd0def 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java
@@ -16,6 +16,20 @@
*/
package se.leap.bitmaskclient.eip;
+import static de.blinkt.openvpn.core.connection.Connection.TransportType.OBFS4;
+import static de.blinkt.openvpn.core.connection.Connection.TransportType.OBFS4_KCP;
+import static de.blinkt.openvpn.core.connection.Connection.TransportType.OPENVPN;
+import static de.blinkt.openvpn.core.connection.Connection.TransportType.PT;
+import static se.leap.bitmaskclient.base.models.Constants.GATEWAYS;
+import static se.leap.bitmaskclient.base.models.Constants.HOST;
+import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_PRIVATE_KEY;
+import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_VPN_CERTIFICATE;
+import static se.leap.bitmaskclient.base.models.Constants.SORTED_GATEWAYS;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getObfuscationPinningKCP;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getPreferredCity;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getUseBridges;
+import static se.leap.bitmaskclient.base.utils.PreferenceHelper.useObfuscationPinning;
+
import android.content.Context;
import android.util.Log;
@@ -48,18 +62,6 @@ import se.leap.bitmaskclient.base.models.Provider;
import se.leap.bitmaskclient.base.models.ProviderObservable;
import se.leap.bitmaskclient.base.utils.PreferenceHelper;
-import static de.blinkt.openvpn.core.connection.Connection.TransportType.OBFS4;
-import static de.blinkt.openvpn.core.connection.Connection.TransportType.OBFS4_KCP;
-import static de.blinkt.openvpn.core.connection.Connection.TransportType.OPENVPN;
-import static de.blinkt.openvpn.core.connection.Connection.TransportType.PT;
-import static se.leap.bitmaskclient.base.models.Constants.GATEWAYS;
-import static se.leap.bitmaskclient.base.models.Constants.HOST;
-import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_PRIVATE_KEY;
-import static se.leap.bitmaskclient.base.models.Constants.PROVIDER_VPN_CERTIFICATE;
-import static se.leap.bitmaskclient.base.models.Constants.SORTED_GATEWAYS;
-import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getPreferredCity;
-import static se.leap.bitmaskclient.base.utils.PreferenceHelper.getUseBridges;
-
/**
* @author parmegv
*/
@@ -115,6 +117,13 @@ public class GatewaysManager {
* @return the n closest Gateway
*/
public Pair<Gateway, TransportType> select(int nClosest) {
+ if (PreferenceHelper.useObfuscationPinning(context)) {
+ Gateway gateway = gateways.get(PreferenceHelper.getObfuscationPinningGatewayHost(context));
+ if (gateway == null) {
+ return null;
+ }
+ return new Pair<>(gateway, getObfuscationPinningKCP(context) ? OBFS4_KCP : OBFS4);
+ }
String selectedCity = getPreferredCity(context);
return select(nClosest, selectedCity);
}
@@ -135,6 +144,23 @@ public class GatewaysManager {
}
}
+ public ArrayList<String> getHosts() {
+ ArrayList<String> hosts = new ArrayList<>();
+ for (Gateway gateway : gateways.values()) {
+ hosts.add(gateway.getHost());
+ }
+ return hosts;
+ }
+
+
+ public String getIpForHost(String gatewayHostName) {
+ Gateway gateway = gateways.get(gatewayHostName);
+ if (gateway == null) {
+ return null;
+ }
+ return gateway.getRemoteIP();
+ }
+
public List<Location> getGatewayLocations() {
return getSortedGatewayLocations(null);
}
@@ -202,6 +228,14 @@ public class GatewaysManager {
}
}
+ public String getLocationNameForHost(String name) {
+ Gateway gateway = gateways.get(name);
+ if (gateway != null) {
+ return gateway.getName();
+ }
+ return "Unknown Location";
+ }
+
@Nullable
public Location getLocation(String name) {
List <Location> locations = getGatewayLocations();
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java b/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java
index 58732713..a7df99bf 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java
@@ -19,6 +19,7 @@ package se.leap.bitmaskclient.eip;
import static de.blinkt.openvpn.core.connection.Connection.TransportType.OBFS4;
import static de.blinkt.openvpn.core.connection.Connection.TransportType.OBFS4_KCP;
import static de.blinkt.openvpn.core.connection.Connection.TransportType.OPENVPN;
+import static de.blinkt.openvpn.core.connection.Connection.TransportType.PT;
import static se.leap.bitmaskclient.base.models.Constants.CAPABILITIES;
import static se.leap.bitmaskclient.base.models.Constants.IP_ADDRESS;
import static se.leap.bitmaskclient.base.models.Constants.IP_ADDRESS6;
@@ -44,14 +45,17 @@ import org.json.JSONObject;
import java.io.IOException;
import java.io.StringReader;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
+import java.util.Set;
import de.blinkt.openvpn.VpnProfile;
import de.blinkt.openvpn.core.ConfigParser;
import de.blinkt.openvpn.core.VpnStatus;
import de.blinkt.openvpn.core.connection.Connection;
-import se.leap.bitmaskclient.BuildConfig;
+import de.blinkt.openvpn.core.connection.Connection.TransportType;
import se.leap.bitmaskclient.base.models.Provider;
+import se.leap.bitmaskclient.base.models.Transport;
import se.leap.bitmaskclient.base.utils.ConfigHelper;
import se.leap.bitmaskclient.pluggableTransports.Obfs4Options;
@@ -64,23 +68,65 @@ public class VpnConfigGenerator {
private final int apiVersion;
private final boolean preferUDP;
private final boolean experimentalTransports;
+ private final boolean useObfuscationPinning;
+ private final String obfuscationPinningIP;
+ private final String obfuscationPinningPort;
+ private final String obfuscationPinningCert;
+ private final boolean obfuscationPinningKCP;
+ private final String remoteGatewayIP;
+ private final String profileName;
+ private final Set<String> excludedApps;
public final static String TAG = VpnConfigGenerator.class.getSimpleName();
private final String newLine = System.getProperty("line.separator"); // Platform new line
- public VpnConfigGenerator(JSONObject generalConfiguration, JSONObject secrets, JSONObject gateway, int apiVersion, boolean preferUDP, boolean experimentalTransports) throws ConfigParser.ConfigParseError {
+ public static class Configuration {
+ int apiVersion;
+ boolean preferUDP;
+ boolean experimentalTransports;
+ String remoteGatewayIP = "";
+ String profileName = "";
+ Set<String> excludedApps = null;
+
+ boolean useObfuscationPinning;
+ boolean obfuscationProxyKCP;
+ String obfuscationProxyIP = "";
+ String obfuscationProxyPort = "";
+ String obfuscationProxyCert = "";
+ }
+
+ public VpnConfigGenerator(JSONObject generalConfiguration, JSONObject secrets, JSONObject gateway, Configuration config) throws ConfigParser.ConfigParseError {
this.generalConfiguration = generalConfiguration;
this.gateway = gateway;
this.secrets = secrets;
- this.apiVersion = apiVersion;
- this.preferUDP = preferUDP;
- this.experimentalTransports = experimentalTransports;
+ this.apiVersion = config.apiVersion;
+ this.preferUDP = config.preferUDP;
+ this.experimentalTransports = config.experimentalTransports;
+ this.useObfuscationPinning = config.useObfuscationPinning;
+ this.obfuscationPinningIP = config.obfuscationProxyIP;
+ this.obfuscationPinningPort = config.obfuscationProxyPort;
+ this.obfuscationPinningCert = config.obfuscationProxyCert;
+ this.obfuscationPinningKCP = config.obfuscationProxyKCP;
+ this.remoteGatewayIP = config.remoteGatewayIP;
+ this.profileName = config.profileName;
+ this.excludedApps = config.excludedApps;
checkCapabilities();
}
public void checkCapabilities() throws ConfigParser.ConfigParseError {
try {
+ if (useObfuscationPinning) {
+ if (obfuscationPinningKCP) {
+ // the protocol TCP refers to the allowed openvpn protocol
+ obfs4TKcpTransport = new JSONObject(new Transport(OBFS4_KCP.toString(), new String[]{"tcp"}, new String[]{obfuscationPinningPort}, obfuscationPinningCert).toString());
+ } else {
+ String jsonTransportString = new Transport(OBFS4.toString(), new String[]{"tcp"}, new String[]{obfuscationPinningPort}, obfuscationPinningCert).toString();
+ obfs4Transport = new JSONObject(jsonTransportString);
+ }
+ return;
+ }
+
if (apiVersion >= 3) {
JSONArray supportedTransports = gateway.getJSONObject(CAPABILITIES).getJSONArray(TRANSPORT);
for (int i = 0; i < supportedTransports.length(); i++) {
@@ -101,7 +147,7 @@ public class VpnConfigGenerator {
}
}
- public HashMap<Connection.TransportType, VpnProfile> generateVpnProfiles() throws
+ public HashMap<TransportType, VpnProfile> generateVpnProfiles() throws
ConfigParser.ConfigParseError,
NumberFormatException,
JSONException,
@@ -133,7 +179,7 @@ public class VpnConfigGenerator {
return obfs4TKcpTransport != null;
}
- private String getConfigurationString(Connection.TransportType transportType) {
+ private String getConfigurationString(TransportType transportType) {
return generalConfiguration()
+ newLine
+ gatewayConfiguration(transportType)
@@ -144,7 +190,7 @@ public class VpnConfigGenerator {
}
@VisibleForTesting
- protected VpnProfile createProfile(Connection.TransportType transportType) throws IOException, ConfigParser.ConfigParseError, JSONException {
+ protected VpnProfile createProfile(TransportType transportType) throws IOException, ConfigParser.ConfigParseError, JSONException {
String configuration = getConfigurationString(transportType);
ConfigParser icsOpenvpnConfigParser = new ConfigParser();
icsOpenvpnConfigParser.parseConfig(new StringReader(configuration));
@@ -153,22 +199,30 @@ public class VpnConfigGenerator {
} else if (transportType == OBFS4_KCP) {
icsOpenvpnConfigParser.setObfs4Options(getObfs4Options(obfs4TKcpTransport, true));
}
- return icsOpenvpnConfigParser.convertProfile(transportType);
+
+ VpnProfile profile = icsOpenvpnConfigParser.convertProfile(transportType);
+ profile.mName = profileName;
+ profile.mGatewayIp = remoteGatewayIP;
+ if (excludedApps != null) {
+ profile.mAllowedAppsVpn = new HashSet<>(excludedApps);
+ }
+ return profile;
}
+ // TODO: whad does
private Obfs4Options getObfs4Options(JSONObject transportJson, boolean useUdp) throws JSONException {
JSONObject transportOptions = transportJson.getJSONObject(OPTIONS);
String iatMode = transportOptions.getString("iatMode");
String cert = transportOptions.getString("cert");
- String port = obfs4Transport.getJSONArray(PORTS).getString(0);
+ String port = transportJson.getJSONArray(PORTS).getString(0);
String ip = gateway.getString(IP_ADDRESS);
boolean udp = useUdp;
- if (BuildConfig.obfsvpn_pinning) {
- cert = BuildConfig.obfsvpn_cert;
- port = BuildConfig.obfsvpn_port;
- ip = BuildConfig.obfsvpn_port;
- udp = BuildConfig.obfsvpn_use_kcp;
+ if (useObfuscationPinning) {
+ cert = obfuscationPinningCert;
+ port = obfuscationPinningPort;
+ ip = obfuscationPinningIP;
+ udp = obfuscationPinningKCP;
}
return new Obfs4Options(ip, port, cert, iatMode, udp);
}
@@ -196,7 +250,7 @@ public class VpnConfigGenerator {
return commonOptions;
}
- private String gatewayConfiguration(Connection.TransportType transportType) {
+ private String gatewayConfiguration(TransportType transportType) {
String remotes = "";
StringBuilder stringBuilder = new StringBuilder();
@@ -217,6 +271,7 @@ public class VpnConfigGenerator {
String[] ipAddresses = ipAddress6.isEmpty() ?
new String[]{ipAddress} :
new String[]{ipAddress6, ipAddress};
+
JSONArray transports = capabilities.getJSONArray(TRANSPORT);
gatewayConfigMinApiv3(transportType, stringBuilder, ipAddresses, transports);
break;
@@ -234,9 +289,9 @@ public class VpnConfigGenerator {
return remotes;
}
- private void gatewayConfigMinApiv3(Connection.TransportType transportType, StringBuilder stringBuilder, String[] ipAddresses, JSONArray transports) throws JSONException {
- if (transportType == OBFS4) {
- obfs4GatewayConfigMinApiv3(stringBuilder, ipAddresses, transports);
+ private void gatewayConfigMinApiv3(TransportType transportType, StringBuilder stringBuilder, String[] ipAddresses, JSONArray transports) throws JSONException {
+ if (transportType.getMetaType() == PT) {
+ ptGatewayConfigMinApiv3(stringBuilder, ipAddresses, transportType, transports);
} else {
ovpnGatewayConfigMinApi3(stringBuilder, ipAddresses, transports);
}
@@ -296,7 +351,7 @@ public class VpnConfigGenerator {
}
}
- private JSONObject getTransport(JSONArray transports, Connection.TransportType transportType) throws JSONException {
+ private JSONObject getTransport(JSONArray transports, TransportType transportType) throws JSONException {
JSONObject selectedTransport = new JSONObject();
for (int i = 0; i < transports.length(); i++) {
JSONObject transport = transports.getJSONObject(i);
@@ -308,9 +363,35 @@ public class VpnConfigGenerator {
return selectedTransport;
}
- private void obfs4GatewayConfigMinApiv3(StringBuilder stringBuilder, String[] ipAddresses, JSONArray transports) throws JSONException {
- JSONObject obfs4Transport = getTransport(transports, OBFS4);
- JSONArray protocols = obfs4Transport.getJSONArray(PROTOCOLS);
+ private boolean isAllowedProtocol(TransportType transportType, String protocol) {
+ switch (transportType) {
+ case OPENVPN:
+ return "tcp".equals(protocol) || "udp".equals(protocol);
+ case OBFS4:
+ case OBFS4_KCP:
+ return "tcp".equals(protocol);
+ }
+ return false;
+ }
+
+ private void ptGatewayConfigMinApiv3(StringBuilder stringBuilder, String[] ipAddresses, TransportType transportType, JSONArray transports) throws JSONException {
+ if (useObfuscationPinning) {
+ JSONArray pinnedTransports = new JSONArray();
+ for (int i = 0; i < transports.length(); i++) {
+ if (OPENVPN.toString().equals(transports.getJSONObject(i).get(TYPE))) {
+ pinnedTransports.put(transports.getJSONObject(i));
+ break;
+ }
+ }
+ pinnedTransports.put(supportsObfs4() ? obfs4Transport : obfs4TKcpTransport);
+ transports = pinnedTransports;
+ }
+
+ JSONObject ptTransport = getTransport(transports, transportType);
+ JSONArray ptProtocols = ptTransport.getJSONArray(PROTOCOLS);
+ JSONObject openvpnTransport = getTransport(transports, OPENVPN);
+ JSONArray gatewayProtocols = openvpnTransport.getJSONArray(PROTOCOLS);
+
//for now only use ipv4 gateway the syntax route remote_host 255.255.255.255 net_gateway is not yet working
// https://community.openvpn.net/openvpn/ticket/1161
/*for (String ipAddress : ipAddresses) {
@@ -337,41 +418,55 @@ public class VpnConfigGenerator {
return;
}
- // check if at least one protocol is TCP, UDP is currently not supported for obfs4
- boolean hasTcp = false;
- for (int i = 0; i < protocols.length(); i++) {
- String protocol = protocols.getString(i);
+ // check if at least one openvpn protocol is TCP, openvpn in UDP is currently not supported for obfs4,
+ // however on the wire UDP might be used
+ boolean hasOpenvpnTcp = false;
+ for (int i = 0; i < gatewayProtocols.length(); i++) {
+ String protocol = gatewayProtocols.getString(i);
if (protocol.contains("tcp")) {
- hasTcp = true;
+ hasOpenvpnTcp = true;
+ break;
+ }
+ }
+
+ if (!hasOpenvpnTcp) {
+ VpnStatus.logError("obfs4 currently only allows openvpn in TCP mode! Skipping obfs4 config for ip " + ipAddress);
+ return;
+ }
+
+ boolean hasAllowedPTProtocol = false;
+ for (int i = 0; i < ptProtocols.length(); i++) {
+ String protocol = ptProtocols.getString(i);
+ if (isAllowedProtocol(transportType, protocol)) {
+ hasAllowedPTProtocol = true;
+ break;
}
}
- if (!hasTcp) {
- VpnStatus.logError("obfs4 currently only allows TCP! Skipping obfs4 config for ip " + ipAddress);
+ if (!hasAllowedPTProtocol) {
+ VpnStatus.logError("Misconfigured provider: wrong protocol defined in " + transportType.toString()+ " transport JSON.");
return;
}
- JSONArray ports = obfs4Transport.getJSONArray(PORTS);
+ JSONArray ports = ptTransport.getJSONArray(PORTS);
if (ports.isNull(0)){
- VpnStatus.logError("Misconfigured provider: no ports defined in obfs4 transport JSON.");
+ VpnStatus.logError("Misconfigured provider: no ports defined in " + transportType.toString()+ " transport JSON.");
return;
}
String route = "route " + ipAddress + " 255.255.255.255 net_gateway" + newLine;
stringBuilder.append(route);
+ String remote;
if (useObfsVpn()) {
- String remote;
- if (BuildConfig.obfsvpn_pinning) {
- remote = REMOTE + " " + BuildConfig.obfsvpn_ip + " " + BuildConfig.obfsvpn_port + newLine;
+ if (useObfuscationPinning) {
+ remote = REMOTE + " " + obfuscationPinningIP + " " + obfuscationPinningPort + newLine;
} else {
remote = REMOTE + " " + ipAddress + " " + ports.getString(0) + newLine;
}
-
- stringBuilder.append(remote);
} else {
- String remote = REMOTE + " " + DISPATCHER_IP + " " + DISPATCHER_PORT + " tcp" + newLine;
- stringBuilder.append(remote);
+ remote = REMOTE + " " + DISPATCHER_IP + " " + DISPATCHER_PORT + " tcp" + newLine;
}
+ stringBuilder.append(remote);
}
private String secretsConfiguration() {
diff --git a/app/src/main/res/layout-port/f_eip.xml b/app/src/main/res/layout-port/f_eip.xml
index 99004387..cb99a700 100644
--- a/app/src/main/res/layout-port/f_eip.xml
+++ b/app/src/main/res/layout-port/f_eip.xml
@@ -4,7 +4,9 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/eipServiceFragment">
+ android:id="@+id/eipServiceFragment"
+ tools:viewBindingIgnore="true"
+ >
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline_vertical_left"
diff --git a/app/src/main/res/layout-xlarge-port/a_add_provider.xml b/app/src/main/res/layout-xlarge-port/a_add_provider.xml
index 9d1614aa..80eef3c3 100644
--- a/app/src/main/res/layout-xlarge-port/a_add_provider.xml
+++ b/app/src/main/res/layout-xlarge-port/a_add_provider.xml
@@ -5,7 +5,8 @@
style="@style/BitmaskActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context=".providersetup.activities.ProviderCredentialsBaseActivity">
+ tools:context=".providersetup.activities.ProviderCredentialsBaseActivity"
+ tools:viewBindingIgnore="true">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="match_parent"
diff --git a/app/src/main/res/layout-xlarge-port/a_custom_provider_setup.xml b/app/src/main/res/layout-xlarge-port/a_custom_provider_setup.xml
index da813a23..dfb58b8c 100644
--- a/app/src/main/res/layout-xlarge-port/a_custom_provider_setup.xml
+++ b/app/src/main/res/layout-xlarge-port/a_custom_provider_setup.xml
@@ -6,7 +6,8 @@
style="@style/BitmaskActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context=".providersetup.activities.CustomProviderSetupActivity">
+ tools:context=".providersetup.activities.CustomProviderSetupActivity"
+ tools:viewBindingIgnore="true">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="match_parent"
diff --git a/app/src/main/res/layout-xlarge-port/a_provider_credentials.xml b/app/src/main/res/layout-xlarge-port/a_provider_credentials.xml
index 75f6244a..e1295853 100644
--- a/app/src/main/res/layout-xlarge-port/a_provider_credentials.xml
+++ b/app/src/main/res/layout-xlarge-port/a_provider_credentials.xml
@@ -5,7 +5,8 @@
style="@style/BitmaskActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context=".providersetup.activities.ProviderCredentialsBaseActivity">
+ tools:context=".providersetup.activities.ProviderCredentialsBaseActivity"
+ tools:viewBindingIgnore="true">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="match_parent"
diff --git a/app/src/main/res/layout-xlarge-port/a_provider_detail.xml b/app/src/main/res/layout-xlarge-port/a_provider_detail.xml
index 7d1e8444..34719df9 100644
--- a/app/src/main/res/layout-xlarge-port/a_provider_detail.xml
+++ b/app/src/main/res/layout-xlarge-port/a_provider_detail.xml
@@ -6,7 +6,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".providersetup.ProviderDetailActivity"
- style="@style/BitmaskActivity">
+ style="@style/BitmaskActivity"
+ tools:viewBindingIgnore="true">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="match_parent"
diff --git a/app/src/main/res/layout-xlarge-port/a_provider_list.xml b/app/src/main/res/layout-xlarge-port/a_provider_list.xml
index 87ca6427..184cbf93 100644
--- a/app/src/main/res/layout-xlarge-port/a_provider_list.xml
+++ b/app/src/main/res/layout-xlarge-port/a_provider_list.xml
@@ -6,7 +6,8 @@
style="@style/BitmaskActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context=".providersetup.ProviderListActivity">
+ tools:context=".providersetup.ProviderListActivity"
+ tools:viewBindingIgnore="true">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="match_parent"
diff --git a/app/src/main/res/layout-xlarge-port/f_eip.xml b/app/src/main/res/layout-xlarge-port/f_eip.xml
index c3d3fd36..10b7a7e3 100644
--- a/app/src/main/res/layout-xlarge-port/f_eip.xml
+++ b/app/src/main/res/layout-xlarge-port/f_eip.xml
@@ -5,6 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/eipServiceFragment"
+ tools:viewBindingIgnore="true"
>
<androidx.constraintlayout.widget.Guideline
diff --git a/app/src/main/res/layout-xlarge-port/f_log.xml b/app/src/main/res/layout-xlarge-port/f_log.xml
index ebadeb74..56848206 100644
--- a/app/src/main/res/layout-xlarge-port/f_log.xml
+++ b/app/src/main/res/layout-xlarge-port/f_log.xml
@@ -10,7 +10,8 @@
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:padding="@dimen/activity_margin"
- android:id="@+id/log_layout">
+ android:id="@+id/log_layout"
+ tools:viewBindingIgnore="true">
<LinearLayout
android:background="@drawable/white_rect"
diff --git a/app/src/main/res/layout-xlarge/a_add_provider.xml b/app/src/main/res/layout-xlarge/a_add_provider.xml
index e4ebdadf..db63b32c 100644
--- a/app/src/main/res/layout-xlarge/a_add_provider.xml
+++ b/app/src/main/res/layout-xlarge/a_add_provider.xml
@@ -5,7 +5,8 @@
style="@style/BitmaskActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context=".providersetup.activities.ProviderCredentialsBaseActivity">
+ tools:context=".providersetup.activities.ProviderCredentialsBaseActivity"
+ tools:viewBindingIgnore="true">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="match_parent"
diff --git a/app/src/main/res/layout-xlarge/a_custom_provider_setup.xml b/app/src/main/res/layout-xlarge/a_custom_provider_setup.xml
index 23bf7d40..130ad95a 100644
--- a/app/src/main/res/layout-xlarge/a_custom_provider_setup.xml
+++ b/app/src/main/res/layout-xlarge/a_custom_provider_setup.xml
@@ -6,7 +6,8 @@
style="@style/BitmaskActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context=".providersetup.activities.CustomProviderSetupActivity">
+ tools:context=".providersetup.activities.CustomProviderSetupActivity"
+ tools:viewBindingIgnore="true">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="match_parent"
diff --git a/app/src/main/res/layout-xlarge/a_provider_credentials.xml b/app/src/main/res/layout-xlarge/a_provider_credentials.xml
index c5b35fdc..61a638d4 100644
--- a/app/src/main/res/layout-xlarge/a_provider_credentials.xml
+++ b/app/src/main/res/layout-xlarge/a_provider_credentials.xml
@@ -5,7 +5,8 @@
style="@style/BitmaskActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context=".providersetup.activities.ProviderCredentialsBaseActivity">
+ tools:context=".providersetup.activities.ProviderCredentialsBaseActivity"
+ tools:viewBindingIgnore="true">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="match_parent"
diff --git a/app/src/main/res/layout-xlarge/a_provider_detail.xml b/app/src/main/res/layout-xlarge/a_provider_detail.xml
index 59e9c18d..74a0c72c 100644
--- a/app/src/main/res/layout-xlarge/a_provider_detail.xml
+++ b/app/src/main/res/layout-xlarge/a_provider_detail.xml
@@ -6,7 +6,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".providersetup.ProviderDetailActivity"
- style="@style/BitmaskActivity">
+ style="@style/BitmaskActivity"
+ tools:viewBindingIgnore="true">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="match_parent"
diff --git a/app/src/main/res/layout-xlarge/a_provider_list.xml b/app/src/main/res/layout-xlarge/a_provider_list.xml
index 6504db10..c8c7a763 100644
--- a/app/src/main/res/layout-xlarge/a_provider_list.xml
+++ b/app/src/main/res/layout-xlarge/a_provider_list.xml
@@ -6,7 +6,8 @@
style="@style/BitmaskActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context=".providersetup.ProviderListActivity">
+ tools:context=".providersetup.ProviderListActivity"
+ tools:viewBindingIgnore="true">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="match_parent"
diff --git a/app/src/main/res/layout-xlarge/f_about.xml b/app/src/main/res/layout-xlarge/f_about.xml
index 96156a71..ed7f4f1a 100644
--- a/app/src/main/res/layout-xlarge/f_about.xml
+++ b/app/src/main/res/layout-xlarge/f_about.xml
@@ -8,7 +8,8 @@
android:layout_marginStart="@dimen/stdpadding"
android:layout_marginEnd="@dimen/stdpadding"
android:layout_marginRight="@dimen/stdpadding"
- tools:context=".base.MainActivity" >
+ tools:context=".base.MainActivity"
+ tools:viewBindingIgnore="true">
<LinearLayout
android:layout_width="match_parent"
diff --git a/app/src/main/res/layout-xlarge/f_eip.xml b/app/src/main/res/layout-xlarge/f_eip.xml
index 4042933e..e6b28c67 100644
--- a/app/src/main/res/layout-xlarge/f_eip.xml
+++ b/app/src/main/res/layout-xlarge/f_eip.xml
@@ -9,6 +9,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/eipServiceFragment"
+ tools:viewBindingIgnore="true"
>
<androidx.constraintlayout.widget.Guideline
diff --git a/app/src/main/res/layout-xlarge/f_log.xml b/app/src/main/res/layout-xlarge/f_log.xml
index b014ee9d..f1ccc23a 100644
--- a/app/src/main/res/layout-xlarge/f_log.xml
+++ b/app/src/main/res/layout-xlarge/f_log.xml
@@ -5,11 +5,13 @@
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:padding="20dp"
android:id="@+id/log_layout"
+ tools:viewBindingIgnore="true"
>
<LinearLayout
diff --git a/app/src/main/res/layout-xlarge/v_icon_text_list_item.xml b/app/src/main/res/layout-xlarge/v_icon_text_list_item.xml
index 530660af..dd7dc37a 100644
--- a/app/src/main/res/layout-xlarge/v_icon_text_list_item.xml
+++ b/app/src/main/res/layout-xlarge/v_icon_text_list_item.xml
@@ -3,7 +3,8 @@
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="vertical"
- xmlns:tools="http://schemas.android.com/tools">
+ xmlns:tools="http://schemas.android.com/tools"
+ tools:viewBindingIgnore="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
diff --git a/app/src/main/res/layout-xlarge/v_loading_screen.xml b/app/src/main/res/layout-xlarge/v_loading_screen.xml
index 2ecb8f42..22b72f29 100644
--- a/app/src/main/res/layout-xlarge/v_loading_screen.xml
+++ b/app/src/main/res/layout-xlarge/v_loading_screen.xml
@@ -8,6 +8,7 @@
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible"
+ tools:viewBindingIgnore="true"
>
<androidx.appcompat.widget.AppCompatImageView
diff --git a/app/src/main/res/layout-xlarge/v_provider_header.xml b/app/src/main/res/layout-xlarge/v_provider_header.xml
index 6d826783..28bcaa6c 100644
--- a/app/src/main/res/layout-xlarge/v_provider_header.xml
+++ b/app/src/main/res/layout-xlarge/v_provider_header.xml
@@ -2,7 +2,9 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
android:layout_width="match_parent"
- xmlns:app="http://schemas.android.com/apk/res-auto" >
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ tools:viewBindingIgnore="true">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/provider_header_logo"
diff --git a/app/src/main/res/layout-xlarge/v_provider_list_item.xml b/app/src/main/res/layout-xlarge/v_provider_list_item.xml
index eea55be2..2e3506b5 100644
--- a/app/src/main/res/layout-xlarge/v_provider_list_item.xml
+++ b/app/src/main/res/layout-xlarge/v_provider_list_item.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:paddingTop="2dip"
android:paddingBottom="2dip"
@@ -8,7 +9,7 @@
android:layout_height="wrap_content"
android:background="?android:attr/activatedBackgroundIndicator"
android:minHeight="?android:attr/listPreferredItemHeight"
->
+ tools:viewBindingIgnore="true">
<androidx.appcompat.widget.AppCompatTextView android:id="@+id/provider_domain"
android:layout_width="match_parent"
diff --git a/app/src/main/res/layout-xlarge/v_single_list_item.xml b/app/src/main/res/layout-xlarge/v_single_list_item.xml
index 6a318ff5..44cd16e5 100644
--- a/app/src/main/res/layout-xlarge/v_single_list_item.xml
+++ b/app/src/main/res/layout-xlarge/v_single_list_item.xml
@@ -15,6 +15,7 @@
-->
<androidx.appcompat.widget.AppCompatTextView xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -25,4 +26,5 @@
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:paddingRight="?android:attr/listPreferredItemPaddingRight"
android:background="?android:attr/activatedBackgroundIndicator"
- android:minHeight="?android:attr/listPreferredItemHeight" />
+ android:minHeight="?android:attr/listPreferredItemHeight"
+ tools:viewBindingIgnore="true" />
diff --git a/app/src/main/res/layout-xlarge/v_switch_list_item.xml b/app/src/main/res/layout-xlarge/v_switch_list_item.xml
index a24f5089..4a112139 100644
--- a/app/src/main/res/layout-xlarge/v_switch_list_item.xml
+++ b/app/src/main/res/layout-xlarge/v_switch_list_item.xml
@@ -4,6 +4,7 @@
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="vertical"
+ tools:viewBindingIgnore="true"
>
<RelativeLayout
android:layout_width="match_parent"
diff --git a/app/src/main/res/layout-xlarge/v_vpn_status.xml b/app/src/main/res/layout-xlarge/v_vpn_status.xml
index ce8e6928..02f0659a 100644
--- a/app/src/main/res/layout-xlarge/v_vpn_status.xml
+++ b/app/src/main/res/layout-xlarge/v_vpn_status.xml
@@ -5,7 +5,8 @@
-->
<merge xmlns:tools="http://schemas.android.com/tools"
- xmlns:android="http://schemas.android.com/apk/res/android">
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ tools:viewBindingIgnore="true">
<Space
android:layout_weight="1"
diff --git a/app/src/main/res/layout/a_add_provider.xml b/app/src/main/res/layout/a_add_provider.xml
index c78db432..517c8c19 100644
--- a/app/src/main/res/layout/a_add_provider.xml
+++ b/app/src/main/res/layout/a_add_provider.xml
@@ -6,7 +6,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/stdpadding"
- tools:context=".providersetup.AddProviderActivity">
+ tools:context=".providersetup.AddProviderActivity"
+ tools:viewBindingIgnore="true"
+ >
<LinearLayout
android:id="@+id/content"
diff --git a/app/src/main/res/layout/a_add_provider_tablet_scrollview.xml b/app/src/main/res/layout/a_add_provider_tablet_scrollview.xml
index 4debbf9f..d3b8fc58 100644
--- a/app/src/main/res/layout/a_add_provider_tablet_scrollview.xml
+++ b/app/src/main/res/layout/a_add_provider_tablet_scrollview.xml
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<ScrollView
- android:orientation="vertical"
+<ScrollView android:orientation="vertical"
style="@style/BitmaskActivity"
android:layout_width="0dp"
android:layout_height="0dp"
@@ -15,7 +14,9 @@
android:isScrollContainer="true"
android:fadeScrollbars="false"
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto">
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ tools:viewBindingIgnore="true"
+ xmlns:tools="http://schemas.android.com/tools">
<LinearLayout
android:id="@+id/content"
diff --git a/app/src/main/res/layout/a_custom_provider_setup.xml b/app/src/main/res/layout/a_custom_provider_setup.xml
index 782537d9..0e4e3edf 100644
--- a/app/src/main/res/layout/a_custom_provider_setup.xml
+++ b/app/src/main/res/layout/a_custom_provider_setup.xml
@@ -6,7 +6,9 @@
android:layout_height="match_parent"
tools:context=".providersetup.activities.CustomProviderSetupActivity"
android:padding="@dimen/stdpadding"
- style="@style/BitmaskActivity" >
+ style="@style/BitmaskActivity"
+ tools:viewBindingIgnore="true"
+ >
<!-- a "content" view that is required for
ConfigWizardBaseActivities -->
diff --git a/app/src/main/res/layout/a_custom_provider_setup_tablet_linear_layout.xml b/app/src/main/res/layout/a_custom_provider_setup_tablet_linear_layout.xml
index 4879c76f..7e8cd51d 100644
--- a/app/src/main/res/layout/a_custom_provider_setup_tablet_linear_layout.xml
+++ b/app/src/main/res/layout/a_custom_provider_setup_tablet_linear_layout.xml
@@ -1,5 +1,6 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="0dp"
android:layout_height="0dp"
@@ -10,7 +11,8 @@
app:layout_constraintEnd_toStartOf="@+id/guideline_right"
app:layout_constraintHeight_min="411dp"
app:layout_constraintStart_toStartOf="@+id/guideline_left"
- app:layout_constraintTop_toTopOf="@+id/guideline_top">
+ app:layout_constraintTop_toTopOf="@+id/guideline_top"
+ tools:viewBindingIgnore="true">
<!-- a "content" view that is required for
ConfigWizardBaseActivities -->
<LinearLayout
diff --git a/app/src/main/res/layout/a_main.xml b/app/src/main/res/layout/a_main.xml
index 0e30d2a8..92e0a3c0 100644
--- a/app/src/main/res/layout/a_main.xml
+++ b/app/src/main/res/layout/a_main.xml
@@ -5,7 +5,9 @@
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context="se.leap.bitmaskclient.base.MainActivity">
+ tools:context="se.leap.bitmaskclient.base.MainActivity"
+ tools:viewBindingIgnore="true"
+ >
<!-- As the main content view, the view below consumes the entire
diff --git a/app/src/main/res/layout/a_provider_credentials.xml b/app/src/main/res/layout/a_provider_credentials.xml
index b5dfa088..c5ff5f99 100644
--- a/app/src/main/res/layout/a_provider_credentials.xml
+++ b/app/src/main/res/layout/a_provider_credentials.xml
@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/stdpadding"
- style="@style/BitmaskActivity">
+ style="@style/BitmaskActivity"
+ tools:viewBindingIgnore="true">
<include layout="@layout/v_loading_screen" />
diff --git a/app/src/main/res/layout/a_provider_credentials_tablet_linear_layout.xml b/app/src/main/res/layout/a_provider_credentials_tablet_linear_layout.xml
index ea0b6dd4..56222813 100644
--- a/app/src/main/res/layout/a_provider_credentials_tablet_linear_layout.xml
+++ b/app/src/main/res/layout/a_provider_credentials_tablet_linear_layout.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
style="@style/BitmaskActivity"
android:layout_width="0dp"
@@ -13,7 +13,8 @@
app:layout_constraintEnd_toStartOf="@+id/guideline_right"
app:layout_constraintHeight_min="411dp"
app:layout_constraintStart_toStartOf="@+id/guideline_left"
- app:layout_constraintTop_toTopOf="@+id/guideline_top">
+ app:layout_constraintTop_toTopOf="@+id/guideline_top"
+ tools:viewBindingIgnore="true">
<include layout="@layout/v_loading_screen" />
diff --git a/app/src/main/res/layout/a_provider_detail.xml b/app/src/main/res/layout/a_provider_detail.xml
index bdc17ee9..4a456c32 100644
--- a/app/src/main/res/layout/a_provider_detail.xml
+++ b/app/src/main/res/layout/a_provider_detail.xml
@@ -1,11 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/provider_detail_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/stdpadding"
android:orientation="vertical"
- style="@style/BitmaskActivity" >
+ style="@style/BitmaskActivity"
+ tools:viewBindingIgnore="true">
<include layout="@layout/v_loading_screen" />
diff --git a/app/src/main/res/layout/a_provider_detail_tablet_linear_layout.xml b/app/src/main/res/layout/a_provider_detail_tablet_linear_layout.xml
index 0c7e02d1..5601a3d5 100644
--- a/app/src/main/res/layout/a_provider_detail_tablet_linear_layout.xml
+++ b/app/src/main/res/layout/a_provider_detail_tablet_linear_layout.xml
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout
- android:orientation="vertical"
+<LinearLayout android:orientation="vertical"
android:padding="@dimen/stdpadding"
style="@style/BitmaskActivity"
android:layout_width="0dp"
@@ -13,7 +12,9 @@
app:layout_constraintStart_toStartOf="@+id/guideline_left"
app:layout_constraintTop_toTopOf="@+id/guideline_top"
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto">
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ tools:viewBindingIgnore="true"
+ xmlns:tools="http://schemas.android.com/tools">
<include layout="@layout/v_loading_screen" />
diff --git a/app/src/main/res/layout/a_provider_list.xml b/app/src/main/res/layout/a_provider_list.xml
index 5d7efae7..867d6d8d 100644
--- a/app/src/main/res/layout/a_provider_list.xml
+++ b/app/src/main/res/layout/a_provider_list.xml
@@ -5,7 +5,8 @@
android:layout_height="match_parent"
tools:context=".providersetup.ProviderListActivity"
android:padding="@dimen/stdpadding"
- style="@style/BitmaskActivity" >
+ style="@style/BitmaskActivity"
+ tools:viewBindingIgnore="true">
<include layout="@layout/v_loading_screen" />
diff --git a/app/src/main/res/layout/a_provider_list_tablet_linear_layout.xml b/app/src/main/res/layout/a_provider_list_tablet_linear_layout.xml
index 487edd1d..67f82976 100644
--- a/app/src/main/res/layout/a_provider_list_tablet_linear_layout.xml
+++ b/app/src/main/res/layout/a_provider_list_tablet_linear_layout.xml
@@ -12,7 +12,9 @@
app:layout_constraintStart_toStartOf="@+id/guideline_left"
app:layout_constraintTop_toTopOf="@+id/guideline_top"
xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto">
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ tools:viewBindingIgnore="true">
<include layout="@layout/v_loading_screen" />
diff --git a/app/src/main/res/layout/allowed_application_layout.xml b/app/src/main/res/layout/allowed_application_layout.xml
index 61fc12c3..671a54fc 100644
--- a/app/src/main/res/layout/allowed_application_layout.xml
+++ b/app/src/main/res/layout/allowed_application_layout.xml
@@ -14,7 +14,9 @@
android:paddingTop="8dip"
android:paddingBottom="8dip"
android:columnCount="4"
- tools:ignore="RtlCompat">
+ tools:ignore="RtlCompat"
+ tools:viewBindingIgnore="true"
+ >
<ImageView
android:id="@+id/app_icon"
diff --git a/app/src/main/res/layout/allowed_vpn_apps.xml b/app/src/main/res/layout/allowed_vpn_apps.xml
index f76b5f4f..1930adf2 100644
--- a/app/src/main/res/layout/allowed_vpn_apps.xml
+++ b/app/src/main/res/layout/allowed_vpn_apps.xml
@@ -8,7 +8,9 @@
android:orientation="vertical"
android:layout_width="match_parent"
tools:ignore="RtlCompat"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ tools:viewBindingIgnore="true"
+ >
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
diff --git a/app/src/main/res/layout/custom_toast.xml b/app/src/main/res/layout/custom_toast.xml
index c267fb86..b333a9b0 100644
--- a/app/src/main/res/layout/custom_toast.xml
+++ b/app/src/main/res/layout/custom_toast.xml
@@ -6,7 +6,9 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="16dp"
- android:background="@drawable/cust_toast_background">
+ android:background="@drawable/cust_toast_background"
+ tools:viewBindingIgnore="true"
+ >
<ImageView android:src="@drawable/retry"
android:layout_width="24dp"
android:layout_height="24dp"
diff --git a/app/src/main/res/layout/d_checkbox_confirm.xml b/app/src/main/res/layout/d_checkbox_confirm.xml
index f8aace6e..d8811226 100644
--- a/app/src/main/res/layout/d_checkbox_confirm.xml
+++ b/app/src/main/res/layout/d_checkbox_confirm.xml
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
-<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="wrap_content">
+ android:layout_height="wrap_content"
+ xmlns:tools="http://schemas.android.com/tools"
+ tools:viewBindingIgnore="true">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
diff --git a/app/src/main/res/layout/d_list_selection.xml b/app/src/main/res/layout/d_list_selection.xml
index d9a1b013..908c228f 100644
--- a/app/src/main/res/layout/d_list_selection.xml
+++ b/app/src/main/res/layout/d_list_selection.xml
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="wrap_content">
+ android:layout_height="wrap_content"
+ xmlns:tools="http://schemas.android.com/tools"
+ tools:viewBindingIgnore="true">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
diff --git a/app/src/main/res/layout/d_obfuscation_proxy.xml b/app/src/main/res/layout/d_obfuscation_proxy.xml
new file mode 100644
index 00000000..e8f61ebd
--- /dev/null
+++ b/app/src/main/res/layout/d_obfuscation_proxy.xml
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:scrollbars="none">
+ <androidx.appcompat.widget.LinearLayoutCompat
+ android:orientation = "vertical"
+ android:layout_height="wrap_content"
+ android:layout_width="match_parent"
+ android:padding="@dimen/activity_margin"
+ >
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="Obfuscation Proxy Pinning"
+ android:textStyle="bold"
+ android:gravity="center_horizontal"
+ android:textAppearance="@android:style/TextAppearance.Large"
+ />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="Proxy IP"
+ android:paddingTop="@dimen/activity_margin"
+ android:textStyle="bold"
+ android:textAppearance="@android:style/TextAppearance.DeviceDefault" />
+ <androidx.appcompat.widget.AppCompatEditText
+ android:id="@+id/ip_field"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="Proxy Port"
+ android:paddingTop="@dimen/activity_margin"
+ android:textStyle="bold"
+ android:textAppearance="@android:style/TextAppearance.DeviceDefault"
+
+ />
+ <androidx.appcompat.widget.AppCompatEditText
+ android:id="@+id/port_field"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"/>
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="Certificate"
+ android:textStyle="bold"
+ android:paddingTop="@dimen/activity_margin"
+ android:textAppearance="@android:style/TextAppearance.DeviceDefault" />
+ <androidx.appcompat.widget.AppCompatEditText
+ android:id="@+id/cert_field"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"/>
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="Gateway Host Name"
+ android:textStyle="bold"
+ android:paddingTop="@dimen/activity_margin"
+ android:textAppearance="@android:style/TextAppearance.DeviceDefault" />
+ <!--<androidx.appcompat.widget.AppCompatEditText
+ android:id="@+id/gateway_ip_field"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"/>-->
+ <androidx.appcompat.widget.AppCompatSpinner
+ android:id="@+id/gateway_host"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ />
+
+ <se.leap.bitmaskclient.base.views.IconSwitchEntry
+ android:id="@+id/kcp_switch"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:text="KCP"
+ app:subtitle="UDP based network protocol"
+ app:icon="@drawable/ic_multiple_stop"
+ >
+
+ </se.leap.bitmaskclient.base.views.IconSwitchEntry>
+
+ <androidx.appcompat.widget.LinearLayoutCompat
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="end"
+ android:layout_marginTop="@dimen/activity_margin"
+ android:gravity="right"
+ android:orientation="vertical">
+ <androidx.appcompat.widget.AppCompatButton
+ android:id="@+id/button_defaults"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Use defaults"
+ android:background="@drawable/cust_button_secondary"
+ android:layout_marginHorizontal="@dimen/stdpadding"
+ />
+ <androidx.appcompat.widget.LinearLayoutCompat
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="@dimen/stdpadding"
+ android:orientation="horizontal">
+ <androidx.appcompat.widget.AppCompatButton
+ android:id="@+id/button_cancel"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginHorizontal="@dimen/stdpadding"
+ android:text="@string/cancel"
+ />
+
+ <androidx.appcompat.widget.AppCompatButton
+ android:id="@+id/button_save"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginHorizontal="@dimen/stdpadding"
+ android:text="@string/save"
+ />
+ </androidx.appcompat.widget.LinearLayoutCompat>
+
+ </androidx.appcompat.widget.LinearLayoutCompat>
+
+ </androidx.appcompat.widget.LinearLayoutCompat>
+</ScrollView> \ No newline at end of file
diff --git a/app/src/main/res/layout/donation_reminder_dialog.xml b/app/src/main/res/layout/donation_reminder_dialog.xml
index d6b6ea80..0a93c867 100644
--- a/app/src/main/res/layout/donation_reminder_dialog.xml
+++ b/app/src/main/res/layout/donation_reminder_dialog.xml
@@ -3,7 +3,9 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
- android:scrollbars="none">
+ xmlns:tools="http://schemas.android.com/tools"
+ android:scrollbars="none"
+ tools:viewBindingIgnore="true">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
diff --git a/app/src/main/res/layout/f_about.xml b/app/src/main/res/layout/f_about.xml
index b73d2191..e0193c1b 100644
--- a/app/src/main/res/layout/f_about.xml
+++ b/app/src/main/res/layout/f_about.xml
@@ -8,7 +8,8 @@
android:layout_marginStart="@dimen/stdpadding"
android:layout_marginRight="@dimen/stdpadding"
android:layout_marginEnd="@dimen/stdpadding"
- tools:context=".base.MainActivity">
+ tools:context=".base.MainActivity"
+ tools:viewBindingIgnore="true">
<LinearLayout
android:layout_width="match_parent"
diff --git a/app/src/main/res/layout/f_drawer_main.xml b/app/src/main/res/layout/f_drawer_main.xml
index bf418bc0..a948d9ce 100644
--- a/app/src/main/res/layout/f_drawer_main.xml
+++ b/app/src/main/res/layout/f_drawer_main.xml
@@ -8,6 +8,7 @@
android:clickable="true"
android:focusable="true"
android:fillViewport="true"
+ tools:viewBindingIgnore="true"
>
<LinearLayout
diff --git a/app/src/main/res/layout/f_eip.xml b/app/src/main/res/layout/f_eip.xml
index fa2d4ded..9a823b65 100644
--- a/app/src/main/res/layout/f_eip.xml
+++ b/app/src/main/res/layout/f_eip.xml
@@ -8,7 +8,9 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/eipServiceFragment">
+ android:id="@+id/eipServiceFragment"
+ tools:viewBindingIgnore="true"
+ >
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline_horizontal_top"
diff --git a/app/src/main/res/layout/f_gateway_selection.xml b/app/src/main/res/layout/f_gateway_selection.xml
index 8ab2b1c3..5a614ce9 100644
--- a/app/src/main/res/layout/f_gateway_selection.xml
+++ b/app/src/main/res/layout/f_gateway_selection.xml
@@ -4,7 +4,9 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/stdpadding"
- tools:context=".base.fragments.GatewaySelectionFragment">
+ tools:context=".base.fragments.GatewaySelectionFragment"
+ tools:viewBindingIgnore="true"
+ >
<LinearLayout
android:id="@+id/current_location_container"
diff --git a/app/src/main/res/layout/f_log.xml b/app/src/main/res/layout/f_log.xml
index ac77abd5..792770f6 100644
--- a/app/src/main/res/layout/f_log.xml
+++ b/app/src/main/res/layout/f_log.xml
@@ -11,6 +11,7 @@
android:orientation="vertical"
android:padding="16dp"
android:id="@+id/log_layout"
+ tools:viewBindingIgnore="true"
>
<LinearLayout
diff --git a/app/src/main/res/layout/f_log_sliders.xml b/app/src/main/res/layout/f_log_sliders.xml
index ea444b3d..3e4bbee4 100644
--- a/app/src/main/res/layout/f_log_sliders.xml
+++ b/app/src/main/res/layout/f_log_sliders.xml
@@ -14,7 +14,8 @@
android:visibility="gone"
tools:visibility="visible"
android:layout_width="wrap_content"
- android:layout_height="wrap_content">
+ android:layout_height="wrap_content"
+ tools:viewBindingIgnore="true">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
diff --git a/app/src/main/res/layout/f_settings.xml b/app/src/main/res/layout/f_settings.xml
index f89dc956..3ce19797 100644
--- a/app/src/main/res/layout/f_settings.xml
+++ b/app/src/main/res/layout/f_settings.xml
@@ -4,8 +4,9 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ xmlns:tools="http://schemas.android.com/tools"
android:padding="@dimen/stdpadding"
- >
+ tools:viewBindingIgnore="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -123,5 +124,15 @@
app:subtitle="These transports might circumvent censorship, but are still in a testing phase"
/>
+ <se.leap.bitmaskclient.base.views.IconSwitchEntry
+ android:id="@+id/obfuscation_proxy_pinning"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:text="Obfuscation proxy pinning"
+ app:singleLine="false"
+ app:subtitle="Connect to a specific obfuscation proxy for debugging purposes"
+ android:visibility="gone"
+ />
+
</LinearLayout>
</ScrollView> \ No newline at end of file
diff --git a/app/src/main/res/layout/v_custom_notification.xml b/app/src/main/res/layout/v_custom_notification.xml
index e97fcbe2..c9854ff3 100644
--- a/app/src/main/res/layout/v_custom_notification.xml
+++ b/app/src/main/res/layout/v_custom_notification.xml
@@ -5,6 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@android:style/TextAppearance.StatusBar.EventContent"
+ tools:viewBindingIgnore="true"
>
<ImageView
diff --git a/app/src/main/res/layout/v_icon_select_text_list_item.xml b/app/src/main/res/layout/v_icon_select_text_list_item.xml
index 801a372a..60c5908c 100644
--- a/app/src/main/res/layout/v_icon_select_text_list_item.xml
+++ b/app/src/main/res/layout/v_icon_select_text_list_item.xml
@@ -3,7 +3,8 @@
android:layout_height="?android:attr/listPreferredItemHeightSmall"
android:layout_width="match_parent"
android:orientation="horizontal"
- xmlns:tools="http://schemas.android.com/tools">
+ xmlns:tools="http://schemas.android.com/tools"
+ tools:viewBindingIgnore="true">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/material_icon"
diff --git a/app/src/main/res/layout/v_icon_text_list_item.xml b/app/src/main/res/layout/v_icon_text_list_item.xml
index d183864d..814fd4d5 100644
--- a/app/src/main/res/layout/v_icon_text_list_item.xml
+++ b/app/src/main/res/layout/v_icon_text_list_item.xml
@@ -3,7 +3,8 @@
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="vertical"
- xmlns:tools="http://schemas.android.com/tools">
+ xmlns:tools="http://schemas.android.com/tools"
+ tools:viewBindingIgnore="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
diff --git a/app/src/main/res/layout/v_loading_screen.xml b/app/src/main/res/layout/v_loading_screen.xml
index 26ab25cc..dd83aa38 100644
--- a/app/src/main/res/layout/v_loading_screen.xml
+++ b/app/src/main/res/layout/v_loading_screen.xml
@@ -8,6 +8,7 @@
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible"
+ tools:viewBindingIgnore="true"
>
<androidx.appcompat.widget.AppCompatImageView
diff --git a/app/src/main/res/layout/v_location_button.xml b/app/src/main/res/layout/v_location_button.xml
index 7f16a6b1..d304d429 100644
--- a/app/src/main/res/layout/v_location_button.xml
+++ b/app/src/main/res/layout/v_location_button.xml
@@ -7,7 +7,9 @@
android:layout_gravity="center_vertical"
android:padding="@dimen/stdpadding"
android:background="@drawable/cust_button_primary_rect"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ tools:viewBindingIgnore="true"
+ >
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/world_icn"
diff --git a/app/src/main/res/layout/v_location_status_indicator.xml b/app/src/main/res/layout/v_location_status_indicator.xml
index a8ba905e..af831cb0 100644
--- a/app/src/main/res/layout/v_location_status_indicator.xml
+++ b/app/src/main/res/layout/v_location_status_indicator.xml
@@ -5,6 +5,7 @@
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ tools:viewBindingIgnore="true"
>
<androidx.constraintlayout.widget.Guideline
diff --git a/app/src/main/res/layout/v_log_item.xml b/app/src/main/res/layout/v_log_item.xml
index 5f809523..91bb99fd 100644
--- a/app/src/main/res/layout/v_log_item.xml
+++ b/app/src/main/res/layout/v_log_item.xml
@@ -3,6 +3,7 @@
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_width="match_parent"
+ tools:viewBindingIgnore="true"
>
<androidx.appcompat.widget.AppCompatTextView
android:id="@android:id/text1"
diff --git a/app/src/main/res/layout/v_main_btn.xml b/app/src/main/res/layout/v_main_btn.xml
index c561e4cd..3ab62e5a 100644
--- a/app/src/main/res/layout/v_main_btn.xml
+++ b/app/src/main/res/layout/v_main_btn.xml
@@ -4,7 +4,9 @@
android:layout_height="wrap_content"
android:id="@+id/vpn_btn_container"
xmlns:app="http://schemas.android.com/apk/res-auto"
- xmlns:tools="http://schemas.android.com/tools">
+ xmlns:tools="http://schemas.android.com/tools"
+ tools:viewBindingIgnore="true"
+ >
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/vpn_btn_glow"
diff --git a/app/src/main/res/layout/v_provider_credentials.xml b/app/src/main/res/layout/v_provider_credentials.xml
index be40c233..189bace6 100644
--- a/app/src/main/res/layout/v_provider_credentials.xml
+++ b/app/src/main/res/layout/v_provider_credentials.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto">
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/provider_credentials_user_message"
@@ -9,6 +10,7 @@
style="@style/TextAppearance.Design.Error"
android:visibility="gone"
android:linksClickable="true"
+ tools:viewBindingIgnore="true"
/>
<com.google.android.material.textfield.TextInputLayout
diff --git a/app/src/main/res/layout/v_provider_header.xml b/app/src/main/res/layout/v_provider_header.xml
index e0961ea6..42f4f783 100644
--- a/app/src/main/res/layout/v_provider_header.xml
+++ b/app/src/main/res/layout/v_provider_header.xml
@@ -2,7 +2,9 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
android:layout_width="match_parent"
- xmlns:app="http://schemas.android.com/apk/res-auto" >
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ tools:viewBindingIgnore="true">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/provider_header_logo"
diff --git a/app/src/main/res/layout/v_provider_list_item.xml b/app/src/main/res/layout/v_provider_list_item.xml
index b4f41793..0e7cc7f3 100644
--- a/app/src/main/res/layout/v_provider_list_item.xml
+++ b/app/src/main/res/layout/v_provider_list_item.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:paddingTop="2dip"
android:paddingBottom="2dip"
@@ -8,7 +9,7 @@
android:layout_height="wrap_content"
android:background="?android:attr/activatedBackgroundIndicator"
android:minHeight="?android:attr/listPreferredItemHeight"
->
+ tools:viewBindingIgnore="true">
<androidx.appcompat.widget.AppCompatTextView android:id="@+id/provider_domain"
android:layout_width="match_parent"
diff --git a/app/src/main/res/layout/v_select_text_list_item.xml b/app/src/main/res/layout/v_select_text_list_item.xml
index 44e82906..47a1f4ad 100644
--- a/app/src/main/res/layout/v_select_text_list_item.xml
+++ b/app/src/main/res/layout/v_select_text_list_item.xml
@@ -4,7 +4,8 @@
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="vertical"
- android:background="?attr/selectableItemBackground">
+ android:background="?attr/selectableItemBackground"
+ tools:viewBindingIgnore="true">
<LinearLayout
android:layout_width="match_parent"
diff --git a/app/src/main/res/layout/v_simple_checkbox.xml b/app/src/main/res/layout/v_simple_checkbox.xml
index 8bae20b9..a5520341 100644
--- a/app/src/main/res/layout/v_simple_checkbox.xml
+++ b/app/src/main/res/layout/v_simple_checkbox.xml
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
- android:layout_width="match_parent" android:layout_height="match_parent"
- >
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ xmlns:tools="http://schemas.android.com/tools">
<View
android:layout_width="wrap_content"
@@ -18,6 +19,7 @@
android:layout_marginRight="8dp"
android:layout_marginBottom="2dp"
android:background="@drawable/cust_checkbox"
+ tools:viewBindingIgnore="true"
/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/check_view"
diff --git a/app/src/main/res/layout/v_single_list_item.xml b/app/src/main/res/layout/v_single_list_item.xml
index 7b35bf7f..7bf772da 100644
--- a/app/src/main/res/layout/v_single_list_item.xml
+++ b/app/src/main/res/layout/v_single_list_item.xml
@@ -1,4 +1,5 @@
<androidx.appcompat.widget.AppCompatTextView xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -9,4 +10,5 @@
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:paddingRight="?android:attr/listPreferredItemPaddingRight"
android:background="?android:attr/activatedBackgroundIndicator"
- android:minHeight="?android:attr/listPreferredItemHeightSmall" /> \ No newline at end of file
+ android:minHeight="?android:attr/listPreferredItemHeightSmall"
+ tools:viewBindingIgnore="true" /> \ No newline at end of file
diff --git a/app/src/main/res/layout/v_switch_list_item.xml b/app/src/main/res/layout/v_switch_list_item.xml
index 3ba37b81..514f28e7 100644
--- a/app/src/main/res/layout/v_switch_list_item.xml
+++ b/app/src/main/res/layout/v_switch_list_item.xml
@@ -4,6 +4,7 @@
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="vertical"
+ tools:viewBindingIgnore="true"
>
<RelativeLayout
android:layout_width="match_parent"
diff --git a/app/src/main/res/layout/v_vpn_status.xml b/app/src/main/res/layout/v_vpn_status.xml
index ce8e6928..02f0659a 100644
--- a/app/src/main/res/layout/v_vpn_status.xml
+++ b/app/src/main/res/layout/v_vpn_status.xml
@@ -5,7 +5,8 @@
-->
<merge xmlns:tools="http://schemas.android.com/tools"
- xmlns:android="http://schemas.android.com/apk/res/android">
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ tools:viewBindingIgnore="true">
<Space
android:layout_weight="1"
diff --git a/app/src/main/res/values-es-rAR/strings.xml b/app/src/main/res/values-es-rAR/strings.xml
index 91391338..ae7d4d53 100644
--- a/app/src/main/res/values-es-rAR/strings.xml
+++ b/app/src/main/res/values-es-rAR/strings.xml
@@ -134,6 +134,7 @@
<string name="warning_exclude_apps_message">Tené cuidado de excluir aplicaciones de la VPN. Esto va a revelar tu identidad y comprometer a tu seguridad.</string>
<plurals name="subtitle_exclude_apps">
<item quantity="one">%d aplicación desprotegida</item>
+ <item quantity="many">%d aplicaciones desprotegidas</item>
<item quantity="other">%d aplicaciones desprotegidas</item>
</plurals>
<string name="warning_no_more_gateways_use_pt">%s no se pudo conectar. Puede ser que las conexiones al VPN estén bloqueadas. ¿Querés intentar conectar usando conexiones ofuscadas?</string>
diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml
index 6325635c..3cd933b9 100644
--- a/app/src/main/res/values-es/strings.xml
+++ b/app/src/main/res/values-es/strings.xml
@@ -134,6 +134,7 @@
<string name="warning_exclude_apps_message">Ten cuidado de excluir aplicaciones de la VPN. Esto revelará tu identidad y comprometerá tu seguridad.</string>
<plurals name="subtitle_exclude_apps">
<item quantity="one">%d aplicación desprotegida</item>
+ <item quantity="many">%d aplicaciones desprotegidas</item>
<item quantity="other">%d aplicaciones desprotegidas</item>
</plurals>
<string name="warning_no_more_gateways_use_pt">%s no se pudo conectar. Puede ser que las conexiones al VPN estén bloqueadas. ¿Quieres intentar a conectar usando conexiones ofuscadas?</string>
diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml
index e3bf6443..ea8c6573 100644
--- a/app/src/main/res/values-fr/strings.xml
+++ b/app/src/main/res/values-fr/strings.xml
@@ -134,6 +134,7 @@
<string name="warning_exclude_apps_message">Soyez prudent en excluant des applis du RPV. Cela divulguera votre identité et compromettra votre sécurité.</string>
<plurals name="subtitle_exclude_apps">
<item quantity="one">%d appli non protégée</item>
+ <item quantity="many">%d applis non protégées</item>
<item quantity="other">%d applis non protégées</item>
</plurals>
<string name="warning_no_more_gateways_use_pt">%s n’a pas pu se connecter. Les connexions RPV sont peut-être bloquées. Voulez-vous tenter de vous connecter en essayant des connexions brouillées ?</string>
diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml
index 9b8975ce..68005365 100644
--- a/app/src/main/res/values-pt-rBR/strings.xml
+++ b/app/src/main/res/values-pt-rBR/strings.xml
@@ -1,12 +1,13 @@
<?xml version='1.0' encoding='UTF-8'?>
<resources>
- <string name="retry">Tente novamente</string>
+ <string name="retry">Tentar novamente</string>
<string name="repository_url_text">Código fonte disponível em https://0xacab.org/leap/bitmask_android</string>
<string name="leap_tracker">O gerenciador de bugs está disponível em https://0xacab.org/leap/bitmask_android/issues</string>
<string name="translation_project_text">Traduções são bem-vindas. Veja nosso projeto do Transifex em https://www.transifex.com/projects/p/bitmask/</string>
<string name="switch_provider_menu_option">Trocar provedor</string>
<string name="info">info</string>
<string name="show_connection_details">Mostrar os detalhes da conexão</string>
+ <string name="connection_details">Detalhes da conexão</string>
<string name="routes_info">Rotas: %s</string>
<string name="routes_info6">Rotas IPv6 %s</string>
<string name="error_empty_username">O nome do usuário não pode estar vazio.</string>
@@ -51,6 +52,7 @@
<string name="setup_error_configure_button">Configurar</string>
<string name="setup_error_close_button">Sair</string>
<string name="setup_error_text">Houve um erro configurando %s com o provedor escolhido por você.\n\nVocê pode optar por reconfigurar ou sair e configurar um provedor na próxima vez que abrir o programa. </string>
+ <string name="setup_error_text_custom">Houve um erro ao configurar %s.\n\nVocê pode reconfigurar ou sair.</string>
<string name="server_unreachable_message">O servidor está inalcançável, tente novamente.</string>
<string name="error.security.pinnedcertificate">Erro de segurança, atualize seu aplicativo ou escolha outro provedor.</string>
<string name="malformed_url">Não parece ser um provedor %s.</string>
@@ -87,6 +89,7 @@
<string name="action_example">Ação de exemplo</string>
<string name="action_settings">Configurações</string>
<string name="void_vpn_establish">%s bloqueia todo o tráfego de saída de internet.</string>
+ <string name="void_vpn_error_establish">Falha ao bloquear todo o tráfego de Internet.</string>
<string name="void_vpn_stopped">Parou de bloquear todo o tráfego de saída de internet.</string>
<string name="void_vpn_title">Bloqueando tráfego</string>
<string name="update_provider_details">Atualizar detalhes do provedor</string>
@@ -101,12 +104,21 @@
<string name="vpn_certificate_is_invalid">Certificado VPN inválido. Tente baixar um novo.</string>
<string name="vpn_certificate_user_message">O certificado VPN é inválido. Por favor, faça login e baixe um novo.</string>
<string name="save_battery">Economizar energia</string>
+ <string name="subtitle_save_battery">Desabilitado enquanto o Ponto de acesso VPN estiver ligado</string>
<string name="save_battery_message">Conexões de dados em segundo plano vão hibernar quando o seu telefone estiver inativo.</string>
<string name="always_on_vpn">VPN sempre ativa</string>
<string name="subtitle_always_on_vpn">Abrir configurações do Android</string>
+ <string name="tethering">Ponto de acesso VPN</string>
+ <string name="ipv6Firewall">Bloquear IPv6</string>
+ <string name="require_root">Requer permissões de root</string>
<string name="show_experimental">Mostrar recursos experimentais</string>
<string name="hide_experimental">Esconder recursos experimentais</string>
+ <string name="experimental_features">Funcionalidades experimentais</string>
+ <string name="tethering_enabled_message">Por favor tenha certeza de primeiro habilitar tethering nas &lt;![CDATA[&lt;b&gt;configurações de sistema&lt;/b&gt;]].</string>
+ <string name="tethering_message">Compartilhe sua VPN com outros dispositivos através de:</string>
<string name="tethering_wifi">Hotspot Wi-Fi</string>
+ <string name="tethering_usb">Tethering USB</string>
+ <string name="tethering_bluetooth">Tethering Bluetooth</string>
<string name="do_not_show_again">Não mostrar novamente</string>
<string name="always_on_vpn_user_message">Para habilitar VPN sempre ativa nas configurações de VPN clique no ícone de configurar [img src] e mude para ligado. </string>
<string name="always_on_blocking_vpn_user_message">Para proteger sua privacidade da melhor forma, você deveria ativar também a opção \"Bloqueie conexões sem VPN\"</string>
@@ -122,22 +134,72 @@
<string name="warning_exclude_apps_message">Seja cuidadoso ao excluir apps da VPN. Isso pode revelar sua identidade e comprometer sua segurança.</string>
<plurals name="subtitle_exclude_apps">
<item quantity="one">%d app desprotegido</item>
+ <item quantity="many">%d apps desprotegidos</item>
<item quantity="other">%d apps desprotegidos</item>
</plurals>
<string name="warning_no_more_gateways_use_pt">%s não pode se conectar. Isso pode ser devido ao bloqueio de conexões via VPN. Você deseja se conectar usando uma conexão ofuscada?</string>
<string name="warning_no_more_gateways_no_pt">%s não pode se conectar. Gostaria de tentar novamente?</string>
<string name="warning_no_more_gateways_use_ovpn">%s não pode se conectar usando uma VPN ofuscada. Voce gostaria de tentar usando uma conexão padrão?</string>
+ <string name="warning_no_more_gateways_manual_gw_selection">%1$s não pôde conectar a %2$s. Você quer tentar conectar automaticamente ao melhor local?</string>
+ <string name="warning_option_try_best">Tentar o melhor local</string>
<string name="warning_option_try_pt">Tentar conexão ofuscada</string>
<string name="warning_option_try_ovpn">Tentar conexão padrão</string>
<string name="vpn_error_establish">Android falhou ao estabelecer o serviço VPN.</string>
+ <string name="root_permission_error">%s não pode ativar funcionalidades como Ponto de acesso VPN ou Firewall IPv6 sem permissões de root.</string>
+ <string name="qs_enable_vpn">Iniciar %s</string>
+ <string name="version_update_found">Toque aqui para iniciar o download.</string>
+ <string name="version_update_title">Uma nova versão de %s foi encontrada.</string>
+ <string name="version_update_apk_description">Baixando uma nova versão de %s</string>
+ <string name="version_update_download_title">Uma nova versão de %s foi baixada.</string>
+ <string name="version_update_download_description">Toque aqui para instalar a atualização.</string>
+ <string name="version_update_error_pgp_verification">Erro de verificação PGP. Ignorando arquivo baixado.</string>
+ <string name="version_update_error">Falha ao atualizar.</string>
+ <string name="version_update_error_permissions">Sem permissões para instalar o aplicativo.</string>
+ <string name="gateway_selection_title">Selecione o local</string>
+ <string name="gateway_selection_recommended_location">Local recomendado</string>
<string name="gateway_selection_recommended">Recomendado</string>
+ <string name="gateway_selection_manually">Selecione manualmente</string>
+ <string name="gateway_selection_automatic_location">Use a melhor conexão automaticamente</string>
<string name="gateway_selection_automatic">Automático</string>
+ <string name="reconnecting">Reconectando...</string>
+ <string name="tor_starting">Iniciando bridges para driblar a censura...</string>
+ <string name="tor_stopping">Parando bridges</string>
+ <string name="tor_started">Usando bridges para driblar a censura</string>
+ <string name="log_conn_done_pt">Conectado a um transporte plugável</string>
+ <string name="log_conn_pt">Conectando a um transporte plugável</string>
+ <string name="log_conn_done">Conectando a um relay</string>
+ <string name="log_handshake">Negociando conexão com um relay</string>
+ <string name="log_handshake_done">Conexão com relay negociada</string>
<string name="log_onehop_create">Estabelecendo uma conexão de diretório criptografado</string>
+ <string name="log_requesting_status">Solicitando consenso do estado da rede</string>
+ <string name="log_loading_status">Carregando o consenso do estado da rede</string>
<string name="log_loading_keys">Carregando certificados de autoridade</string>
+ <string name="log_requesting_descriptors">Solicitando descritores de relay</string>
+ <string name="log_loading_descriptors">Carregando descritores de relay</string>
+ <string name="log_enough_dirinfo">Informações suficientes sobre diretório foram carregadas para construir circuitos</string>
+ <string name="log_ap_handshake_done">Negociação finalizada com relay para construção de circuitos</string>
<string name="log_circuit_create">Estabelecendo um circuito Tor</string>
<string name="log_done">Executando</string>
+ <string name="channel_name_tor_service">%s Serviço de Bridges</string>
+ <string name="channel_description_tor_service">Informa sobre o uso de bridges ao configurar %s.</string>
+ <string name="error_tor_timeout">A inicialização de bridges falhou. Você quer tentar novamente ou continuar com uma conexão segura sem ofuscação para configurar %s?</string>
+ <string name="retry_unobfuscated">Tentar sem ofuscação</string>
<string name="hide">Esconder</string>
+ <string name="error_network_connection">%s não tem conexão à Internet. Por favor verifique suas configurações de WiFi e dados móveis.</string>
+ <string name="censorship_circumvention">Driblando censura</string>
<string name="use_snowflake">Usar Snowflake</string>
+ <string name="snowflake_description">Proteger processo de configuração contra censura.</string>
+ <string name="vpn_settings">Configurações de VPN</string>
+ <string name="prefer_udp">Usar UDP se disponível</string>
+ <string name="prefer_udp_subtitle">UDP pode ser mais rápido e melhor para transmissões (streaming), mas não funciona para todas as redes.</string>
+ <string name="disabled_while_bridges_on">Desabilitado durante o uso de bridges.</string>
+ <string name="hint_bridges">Apenas locais com suporte a bridges podem ser selecionados.</string>
+ <string name="option_disable_bridges">Desabilitar bridges</string>
+ <string name="eip_state_insecure">Conexão insegura</string>
+ <string name="connection_not_connected">Você pode estar vazando informações para seu provedor de Internet ou rede local.</string>
+ <string name="eip_state_no_network">Você não tem uma conexão de Internet funcionando. Assim que houver uma, você será automaticamente conectada a</string>
+ <string name="eip_state_blocking">%1$s está bloqueando todo o tráfego de Internet.</string>
+ <string name="disabled_while_udp_on">Desabilitado enquanto UDP estiver ligado.</string>
<string name="advanced_settings">Configurações avançadas</string>
<string name="cancel_connection">Desconectar</string>
</resources>
diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml
index 88844192..9d115287 100644
--- a/app/src/main/res/values-ru/strings.xml
+++ b/app/src/main/res/values-ru/strings.xml
@@ -4,44 +4,43 @@
<string name="repository_url_text">Исходный код доступен на https://0xacab.org/leap/bitmask_android</string>
<string name="leap_tracker">Отслеживание проблем доступно на
https://0xacab.org/leap/bitmask_android/issues</string>
- <string name="translation_project_text">Переводы приветствуются. Смотрите наш проект Transifex на
-https://www.transifex.com/projects/p/bitmask/</string>
- <string name="switch_provider_menu_option">Смена провайдера</string>
- <string name="info">Информация</string>
- <string name="show_connection_details">Показать подробности о соединении</string>
+ <string name="translation_project_text">Переводы приветствуются. Наш проект на Transifex: https://www.transifex.com/projects/p/bitmask/</string>
+ <string name="switch_provider_menu_option">Сменить провайдера</string>
+ <string name="info">информация</string>
+ <string name="show_connection_details">Показать сведения о соединении</string>
<string name="connection_details">Сведения о соединении</string>
<string name="routes_info">Маршруты: %s</string>
<string name="routes_info6">Маршруты IPv6: %s</string>
<string name="error_empty_username">Имя пользователя не должно быть пустым</string>
<string name="cert_from_keystore">Получен сертификат \"%s\" из хранилища ключей</string>
<string name="provider_label">Провайдер:</string>
- <string name="provider_label_none">Ни один провайдер не настроен</string>
- <string name="status_unknown">Состояние неизвестно.</string>
- <string name="eip_service_label">Зашифрованное VPN-соединение с интернетом доступно</string>
+ <string name="provider_label_none">Провайдер не настроен</string>
+ <string name="status_unknown">Статус неизвестен.</string>
+ <string name="eip_service_label">Зашифрованный доступ в интернет через VPN</string>
<string name="configuration_wizard_title">Выбрать провайдера</string>
<string name="add_provider">Добавить нового провайдера</string>
- <string name="introduce_new_provider">Добавить нового провайдера услуг</string>
+ <string name="introduce_new_provider">Добавить нового провайдера</string>
<string name="save">Сохранить</string>
- <string name="new_provider_uri">Имя домена</string>
+ <string name="new_provider_uri">Доменное имя</string>
<string name="valid_url_entered">URL действителен</string>
- <string name="not_valid_url_entered">Неправильно сформированный URL</string>
+ <string name="not_valid_url_entered">Неверный URL</string>
<string name="provider_details_title">Информация о провайдере</string>
<string name="use_anonymously_button">Использовать анонимно</string>
- <string name="username_hint">Имя пользователя</string>
+ <string name="username_hint">имя пользователя</string>
<string name="username_ask">Введите имя пользователя</string>
<string name="password_ask">Введите пароль</string>
- <string name="password_hint">Пароль</string>
+ <string name="password_hint">пароль</string>
<string name="password_match">Пароли совпадают</string>
<string name="password_mismatch">Пароли не совпадают</string>
<string name="user_message">Сообщение пользователя</string>
<string name="about_fragment_title">О нас</string>
<string name="exclude_apps_fragment_title">Исключение приложений</string>
- <string name="error_srp_math_error_user_message">Попытайтесь снова: ошибка сервера</string>
+ <string name="error_srp_math_error_user_message">Повторите попытку: ошибка сервера</string>
<string name="error_bad_user_password_user_message">Неправильное имя пользователя или пароль</string>
- <string name="error_not_valid_password_user_message">Должно быть не менее 8 символов</string>
- <string name="error_client_http_user_message">Попытайтесь снова: ошибка HTTP-клиента</string>
- <string name="error_io_exception_user_message">Попытайтесь снова: ошибка ввода/вывода</string>
- <string name="error_json_exception_user_message">Попытайтесь снова: некорректный ответ от сервера</string>
+ <string name="error_not_valid_password_user_message">Длина должна быть не менее 8 символов</string>
+ <string name="error_client_http_user_message">Повторите попытку: ошибка HTTP-клиента</string>
+ <string name="error_io_exception_user_message">Повторите попытку: ошибка ввода/вывода</string>
+ <string name="error_json_exception_user_message">Повторите попытку: некорректный ответ от сервера</string>
<string name="error_no_such_algorithm_exception_user_message">Алгоритм шифрования не найден. Обновите Android!</string>
<string name="signup_or_login_button">Регистрация/вход</string>
<string name="login_button">Войти</string>
@@ -53,24 +52,24 @@ https://www.transifex.com/projects/p/bitmask/</string>
<string name="setup_error_title">Ошибка конфигурации</string>
<string name="setup_error_configure_button">Настройка</string>
<string name="setup_error_close_button">Выход</string>
- <string name="setup_error_text">Произошла ошибка при настройке %s с выбранным провайдером.\n\nВы можете выбрать перенастройку или выход и настройку поставщика при следующем запуске.</string>
+ <string name="setup_error_text">Произошла ошибка при настройке %s с выбранным вами провайдером.\n\nВы можете выбрать повторную настройку или выйти и настроить провайдера при следующем запуске.</string>
<string name="setup_error_text_custom">Произошла ошибка в конфигурации %s.\n\nМожно изменить конфигурацию или выйти.</string>
<string name="server_unreachable_message">Сервер недоступен, попробуйте ещё раз.</string>
<string name="error.security.pinnedcertificate">Ошибка безопасности, обновите приложение или выберите другого провайдера.</string>
- <string name="malformed_url">Не похоже, что %s провайдер.</string>
- <string name="certificate_error">Это не доверенный %s провайдер.</string>
+ <string name="malformed_url">Похоже, %s не провайдер.</string>
+ <string name="certificate_error">%s не надёжный провайдер.</string>
<string name="service_is_down_error">Сервис недоступен.</string>
<string name="configuring_provider">Настройка провайдера</string>
- <string name="incorrectly_downloaded_certificate_message">Ваш анонимный сертификат не загружен</string>
+ <string name="incorrectly_downloaded_certificate_message">Ваш анонимный сертификат не был загружен</string>
<string name="downloading_certificate_message">Скачивание сертификата VPN</string>
<string name="updating_certificate_message">Обновление сертификата VPN</string>
- <string name="login.riseup.warning">Пользователям Riseup будет необходимо создать отдельный аккаунт для использования сервиса VPN.</string>
+ <string name="login.riseup.warning">Пользователям Riseup потребуется создать отдельную учётную запись для использования VPN</string>
<string name="succesful_authentication_message">Аутентифицирован</string>
<string name="authentication_failed_message">Ошибка аутентификации</string>
<string name="registration_failed_message">Регистрация не выполнена</string>
<string name="eip_status_start_pending">Установка соединения</string>
<string name="eip_cancel_connect_title">Отменить соединение?</string>
- <string name="eip_cancel_connect_text">Производится попытка установить соединение. Прервать её?</string>
+ <string name="eip_cancel_connect_text">Идёт попытка подключения. Вы хотите её отменить?</string>
<string name="eip.warning.browser_inconsistency">Отключить VPN-соединение? При отключённой VPN ваша персональная информация может стать доступна провайдеру или в местной сети.</string>
<string name="eip_state_not_connected">Не работает! Соединение небезопасно!</string>
<string name="eip_state_connected">Безопасное соединение</string>
@@ -92,7 +91,7 @@ https://www.transifex.com/projects/p/bitmask/</string>
<string name="action_settings">Настройки</string>
<string name="void_vpn_establish">%s блокирует весь исходящий интернет-трафик.</string>
<string name="void_vpn_error_establish">Невозможно блокировать весь интернет-трафик.</string>
- <string name="void_vpn_stopped">Перестал блокироваться весь исходящий интернет-трафик.</string>
+ <string name="void_vpn_stopped">Прекращена блокировка всего исходящего интернет-трафика.</string>
<string name="void_vpn_title">Блокирование трафика</string>
<string name="update_provider_details">Обновление информации провайдера</string>
<string name="update_certificate">Обновление сертификата</string>
@@ -100,7 +99,7 @@ https://www.transifex.com/projects/p/bitmask/</string>
<string name="eip_json_corrupted_user_message">Невозможно обновить конфигурацию провайдера. Войдите, чтобы повторить попытку.</string>
<string name="warning_client_parsing_error_gateways">Невозможно распознать шлюзы поставщика. Они могут быть настроены неправильно.</string>
<string name="warning_corrupted_provider_details">Сохранённые сведения о провайдере повреждены. Можно либо обновить %s (рекомендуется), либо обновить сведения о поставщике с помощью коммерческого сертификата ЦС.</string>
- <string name="warning_corrupted_provider_cert">Сохранённый сертификат провайдера недопустим. Можно либо обновить %s (рекомендуется), либо обновить сертификат поставщика с помощью коммерческого сертификата ЦС.</string>
+ <string name="warning_corrupted_provider_cert">Сохранённый сертификат провайдера недействителен. Вы можете либо обновить %s (рекомендуется), либо обновить сертификат провайдера используя коммерческий сертификат центра сертификации.</string>
<string name="warning_expired_provider_cert">Срок действия сохранённого сертификата провайдера истёк. Можно либо обновить %s (рекомендуется), либо обновить сертификат поставщика с помощью коммерческого сертификата ЦС.</string>
<string name="downloading_vpn_certificate_failed">Загрузка сертификата VPN не выполнена. Попробуйте ещё раз или выберите другого провайдера.</string>
<string name="vpn_certificate_is_invalid">Сертификат VPN недействителен. Попытайтесь загрузить новый.</string>
@@ -117,7 +116,7 @@ https://www.transifex.com/projects/p/bitmask/</string>
<string name="hide_experimental">Скрыть экспериментальные функции</string>
<string name="experimental_features">Экспериментальные функции</string>
<string name="tethering_enabled_message">Не забудьте сначала включить модем в <![CDATA[<b>системных настройках</b>]]>.</string>
- <string name="tethering_message">Раздавать VPN другим устройствами через:</string>
+ <string name="tethering_message">Поделиться VPN с другими устройствами через:</string>
<string name="tethering_wifi">Точка доступа Wi-Fi</string>
<string name="tethering_usb">USB-модем</string>
<string name="tethering_bluetooth">Bluetooth-модем</string>
@@ -129,23 +128,23 @@ https://www.transifex.com/projects/p/bitmask/</string>
<string name="donate_message">LEAP зависит от пожертвований и грантов. Пожалуйста, сделайте пожертвование сегодня, если вы цените безопасное общение, простое как для конечного пользователя, так и для поставщика услуг.</string>
<string name="donate_button_remind_later">Напомнить позже</string>
<string name="donate_button_donate">Пожертвование</string>
- <string name="obfuscated_connection">Использование запутанного соединения.</string>
- <string name="obfuscated_connection_try">Попытка запутывания соединения.</string>
+ <string name="obfuscated_connection">Использование обфускации соединения.</string>
+ <string name="obfuscated_connection_try">Попытка обфускации соединения.</string>
<string name="nav_drawer_obfuscated_connection">Использовать мосты</string>
<string name="nav_drawer_subtitle_obfuscated_connection">Обход фильтрации VPN</string>
<string name="warning_exclude_apps_message">Будьте осторожны, исключая приложения из VPN. Это позволит раскрыть вашу личность и поставить под угрозу вашу безопасность.</string>
<plurals name="subtitle_exclude_apps">
- <item quantity="one">%d незащищённое приложение</item>
- <item quantity="few">%d незащищённых приложения</item>
- <item quantity="many">%d незащищённых приложений</item>
+ <item quantity="one">%d незащищенное приложение</item>
+ <item quantity="few">%d незащищенных приложения</item>
+ <item quantity="many">%d незащищенных приложений</item>
<item quantity="other">%d незащищённых приложений</item>
</plurals>
- <string name="warning_no_more_gateways_use_pt">%s не удалось подключиться. Возможно, что VPN-соединения блокируются. Попробовать подключиться с помощью запутанных соединений?</string>
+ <string name="warning_no_more_gateways_use_pt">%s не подключается. Возможно, что VPN-соединения блокируются. Попробовать подключиться с помощью обфускации соединения?</string>
<string name="warning_no_more_gateways_no_pt">%s не удалось подключиться. Повторить попытку?</string>
- <string name="warning_no_more_gateways_use_ovpn">%s не удалось подключиться с помощью запутанных VPN-подключений. Попробовать подключиться с помощью стандартного VPN?</string>
+ <string name="warning_no_more_gateways_use_ovpn">%s не подключается с помощью обфускации VPN-соединения. Попробовать подключиться с помощью стандартного VPN?</string>
<string name="warning_no_more_gateways_manual_gw_selection">%1$s не может подключиться к %2$s. Использовать автоматический выбор лучшего расположения?</string>
<string name="warning_option_try_best">Попробовать лучшее расположение</string>
- <string name="warning_option_try_pt">Попробовать запутать соединение</string>
+ <string name="warning_option_try_pt">Попробовать обфускацию соединения</string>
<string name="warning_option_try_ovpn">Попробовать стандартное соединение</string>
<string name="vpn_error_establish">Android не удалось установить службу VPN.</string>
<string name="root_permission_error">%s не может использовать такие функции, как точка доступа VPN или блокировка IPv6, без root-прав.</string>
@@ -185,8 +184,8 @@ https://www.transifex.com/projects/p/bitmask/</string>
<string name="log_done">Запущено</string>
<string name="channel_name_tor_service">Служба мостов %s</string>
<string name="channel_description_tor_service">Информирует об использовании мостов при конфигурации %s.</string>
- <string name="error_tor_timeout">Невозможно запустить мосты. Повторить попытку или продолжить с безопасным соединением без запутывания для настройки %s?</string>
- <string name="retry_unobfuscated">Повтор без запутывания</string>
+ <string name="error_tor_timeout">Невозможно запустить мосты. Повторить попытку или продолжить безопасное соединение без обфускации, чтобы настроить %s?</string>
+ <string name="retry_unobfuscated">Повтор без обфускации</string>
<string name="hide">Скрыть</string>
<string name="error_network_connection">%s не имеет подключения к интернету. Проверьте настройки Wi-Fi и сотовой связи.</string>
<string name="censorship_circumvention">Обход цензуры</string>
diff --git a/app/src/production/res/layout-xlarge/d_new_provider.xml b/app/src/production/res/layout-xlarge/d_new_provider.xml
index 12616625..6e64c8c0 100644
--- a/app/src/production/res/layout-xlarge/d_new_provider.xml
+++ b/app/src/production/res/layout-xlarge/d_new_provider.xml
@@ -1,9 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
- android:textSize="24sp" >
+ android:textSize="24sp"
+ tools:viewBindingIgnore="true"
+ >
<EditText
android:id="@+id/new_provider_url"
diff --git a/app/src/production/res/layout/d_new_provider.xml b/app/src/production/res/layout/d_new_provider.xml
index 36eb0d6a..e58db08a 100644
--- a/app/src/production/res/layout/d_new_provider.xml
+++ b/app/src/production/res/layout/d_new_provider.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:orientation="vertical" >
+ android:orientation="vertical"
+ tools:viewBindingIgnore="true">
<EditText
android:id="@+id/new_provider_url"
diff --git a/app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java b/app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java
index 56242396..3b0d5552 100644
--- a/app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java
+++ b/app/src/test/java/se/leap/bitmaskclient/eip/GatewaysManagerTest.java
@@ -117,9 +117,11 @@ public class GatewaysManagerTest {
MockHelper.mockProviderObservable(provider);
GatewaysManager gatewaysManager = new GatewaysManager(mockContext);
- VpnConfigGenerator configGenerator = new VpnConfigGenerator(provider.getDefinition(), secrets, gateway1, 3, false, false);
+ VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration();
+ configuration.apiVersion = 3;
+ configuration.remoteGatewayIP = "37.218.247.60";
+ VpnConfigGenerator configGenerator = new VpnConfigGenerator(provider.getDefinition(), secrets, gateway1, configuration);
VpnProfile profile = configGenerator.createProfile(OBFS4);
- profile.mGatewayIp = "37.218.247.60";
assertEquals(0, gatewaysManager.getPosition(profile));
}
@@ -132,9 +134,11 @@ public class GatewaysManagerTest {
MockHelper.mockProviderObservable(provider);
GatewaysManager gatewaysManager = new GatewaysManager(mockContext);
- VpnConfigGenerator configGenerator = new VpnConfigGenerator(provider.getDefinition(), secrets, gateway1, 3, false, false);
+ VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration();
+ configuration.apiVersion = 3;
+ configuration.remoteGatewayIP = "37.218.247.60";
+ VpnConfigGenerator configGenerator = new VpnConfigGenerator(provider.getDefinition(), secrets, gateway1, configuration);
VpnProfile profile = configGenerator.createProfile(OPENVPN);
- profile.mGatewayIp = "37.218.247.60";
assertEquals(0, gatewaysManager.getPosition(profile));
}
@@ -147,9 +151,11 @@ public class GatewaysManagerTest {
MockHelper.mockProviderObservable(provider);
GatewaysManager gatewaysManager = new GatewaysManager(mockContext);
- VpnConfigGenerator configGenerator = new VpnConfigGenerator(provider.getDefinition(), secrets, gateway1, 3, false, false);
+ VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration();
+ configuration.apiVersion = 3;
+ configuration.remoteGatewayIP = "37.218.247.60";
+ VpnConfigGenerator configGenerator = new VpnConfigGenerator(provider.getDefinition(), secrets, gateway1, configuration);
VpnProfile profile = configGenerator.createProfile(OBFS4);
- profile.mGatewayIp = "37.218.247.60";
assertEquals(1, gatewaysManager.getPosition(profile));
}
@@ -162,9 +168,11 @@ public class GatewaysManagerTest {
MockHelper.mockProviderObservable(provider);
GatewaysManager gatewaysManager = new GatewaysManager(mockContext);
- VpnConfigGenerator configGenerator = new VpnConfigGenerator(provider.getDefinition(), secrets, gateway1, 3, false, false);
+ VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration();
+ configuration.apiVersion = 3;
+ configuration.remoteGatewayIP = "37.218.247.60";
+ VpnConfigGenerator configGenerator = new VpnConfigGenerator(provider.getDefinition(), secrets, gateway1, configuration);
VpnProfile profile = configGenerator.createProfile(OPENVPN);
- profile.mGatewayIp = "37.218.247.60";
assertEquals(2, gatewaysManager.getPosition(profile));
}
@@ -177,9 +185,11 @@ public class GatewaysManagerTest {
MockHelper.mockProviderObservable(provider);
GatewaysManager gatewaysManager = new GatewaysManager(mockContext);
- VpnConfigGenerator configGenerator = new VpnConfigGenerator(provider.getDefinition(), secrets, gateway1, 3, false, false);
+ VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration();
+ configuration.apiVersion = 3;
+ configuration.remoteGatewayIP = "37.218.247.61";
+ VpnConfigGenerator configGenerator = new VpnConfigGenerator(provider.getDefinition(), secrets, gateway1, configuration);
VpnProfile profile = configGenerator.createProfile(OBFS4);
- profile.mGatewayIp = "37.218.247.61";
assertEquals(-1, gatewaysManager.getPosition(profile));
}
@@ -192,9 +202,11 @@ public class GatewaysManagerTest {
MockHelper.mockProviderObservable(provider);
GatewaysManager gatewaysManager = new GatewaysManager(mockContext);
- VpnConfigGenerator configGenerator = new VpnConfigGenerator(provider.getDefinition(), secrets, gateway1, 3, false, false);
+ VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration();
+ configuration.apiVersion = 3;
+ configuration.remoteGatewayIP = "3.21.247.89";
+ VpnConfigGenerator configGenerator = new VpnConfigGenerator(provider.getDefinition(), secrets, gateway1, configuration);
VpnProfile profile = configGenerator.createProfile(OBFS4);
- profile.mGatewayIp = "3.21.247.89";
assertEquals(1, gatewaysManager.getPosition(profile));
}
diff --git a/app/src/test/java/se/leap/bitmaskclient/eip/VpnConfigGeneratorTest.java b/app/src/test/java/se/leap/bitmaskclient/eip/VpnConfigGeneratorTest.java
index f0db65d9..86a287ad 100644
--- a/app/src/test/java/se/leap/bitmaskclient/eip/VpnConfigGeneratorTest.java
+++ b/app/src/test/java/se/leap/bitmaskclient/eip/VpnConfigGeneratorTest.java
@@ -1437,7 +1437,9 @@ public class VpnConfigGeneratorTest {
@Test
public void testGenerateVpnProfile_v1_tcp_udp() throws Exception {
gateway = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("gateway_tcp_udp.json")));
- vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, 1, false, false);
+ VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration();
+ configuration.apiVersion = 1;
+ vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, configuration);
HashMap<Connection.TransportType, VpnProfile> vpnProfiles = vpnConfigGenerator.generateVpnProfiles();
assertFalse(vpnProfiles.containsKey(OBFS4));
assertEquals(expectedVPNConfig_v1_tcp_udp.trim(), vpnProfiles.get(OPENVPN).getConfigFile(context, false).trim());
@@ -1446,7 +1448,9 @@ public class VpnConfigGeneratorTest {
@Test
public void testGenerateVpnProfile_v1_udp_tcp() throws Exception {
gateway = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("gateway_udp_tcp.json")));
- vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, 1, false, false);
+ VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration();
+ configuration.apiVersion = 1;
+ vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, configuration);
HashMap<Connection.TransportType, VpnProfile> vpnProfiles = vpnConfigGenerator.generateVpnProfiles();
assertFalse(vpnProfiles.containsKey(OBFS4));
assertEquals(expectedVPNConfig_v1_udp_tcp.trim(), vpnProfiles.get(OPENVPN).getConfigFile(context, false).trim());
@@ -1455,7 +1459,9 @@ public class VpnConfigGeneratorTest {
@Test
public void testGenerateVpnProfile_v2_tcp_udp() throws Exception {
gateway = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("gateway_tcp_udp.json")));
- vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, 2, false, false);
+ VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration();
+ configuration.apiVersion = 2;
+ vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, configuration);
HashMap<Connection.TransportType, VpnProfile> vpnProfiles = vpnConfigGenerator.generateVpnProfiles();
assertFalse(vpnProfiles.containsKey(OBFS4));
assertEquals(expectedVPNConfig_v1_tcp_udp.trim(), vpnProfiles.get(OPENVPN).getConfigFile(context, false).trim());
@@ -1464,7 +1470,9 @@ public class VpnConfigGeneratorTest {
@Test
public void testGenerateVpnProfile_v2_udp_tcp() throws Exception {
gateway = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("gateway_udp_tcp.json")));
- vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, 2, false, false);
+ VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration();
+ configuration.apiVersion = 2;
+ vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, configuration);
HashMap<Connection.TransportType, VpnProfile> vpnProfiles = vpnConfigGenerator.generateVpnProfiles();
assertFalse(vpnProfiles.containsKey(OBFS4));
assertEquals(expectedVPNConfig_v1_udp_tcp.trim(), vpnProfiles.get(OPENVPN).getConfigFile(context, false).trim());
@@ -1475,7 +1483,9 @@ public class VpnConfigGeneratorTest {
public void testGenerateVpnProfile_v3_obfs4() throws Exception {
when(ConfigHelper.ObfsVpnHelper.useObfsVpn()).thenReturn(false);
gateway = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("ptdemo.bitmask.eip-service.json"))).getJSONArray("gateways").getJSONObject(0);
- vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, 3, false, false);
+ VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration();
+ configuration.apiVersion = 3;
+ vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, configuration);
HashMap<Connection.TransportType, VpnProfile> vpnProfiles = vpnConfigGenerator.generateVpnProfiles();
assertTrue(vpnProfiles.containsKey(OBFS4));
assertTrue(vpnProfiles.containsKey(OPENVPN));
@@ -1487,7 +1497,9 @@ public class VpnConfigGeneratorTest {
public void testGenerateVpnProfile_v3_obfs4_obfsvpn() throws Exception {
when(ConfigHelper.ObfsVpnHelper.useObfsVpn()).thenReturn(true);
gateway = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("ptdemo.bitmask.eip-service.json"))).getJSONArray("gateways").getJSONObject(0);
- vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, 3, false, false);
+ VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration();
+ configuration.apiVersion = 3;
+ vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, configuration);
HashMap<Connection.TransportType, VpnProfile> vpnProfiles = vpnConfigGenerator.generateVpnProfiles();
assertTrue(vpnProfiles.containsKey(OBFS4));
assertTrue(vpnProfiles.containsKey(OPENVPN));
@@ -1498,7 +1510,9 @@ public class VpnConfigGeneratorTest {
@Test
public void testGenerateVpnProfile_v3_ovpn_tcp_udp() throws Exception {
gateway = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("ptdemo_pt_tcp_udp.eip-service.json"))).getJSONArray("gateways").getJSONObject(0);
- vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, 3, false, false);
+ VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration();
+ configuration.apiVersion = 3;
+ vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, configuration);
HashMap<Connection.TransportType, VpnProfile> vpnProfiles = vpnConfigGenerator.generateVpnProfiles();
assertTrue(vpnProfiles.containsKey(OBFS4));
assertTrue(vpnProfiles.containsKey(OPENVPN));
@@ -1509,7 +1523,9 @@ public class VpnConfigGeneratorTest {
@Test
public void testGenerateVpnProfile_v3_ovpn_udp_tcp() throws Exception {
gateway = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("ptdemo_pt_udp_tcp.eip-service.json"))).getJSONArray("gateways").getJSONObject(0);
- vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, 3, false, false);
+ VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration();
+ configuration.apiVersion = 3;
+ vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, configuration);
HashMap<Connection.TransportType, VpnProfile> vpnProfiles = vpnConfigGenerator.generateVpnProfiles();
assertTrue(vpnProfiles.containsKey(OBFS4));
assertTrue(vpnProfiles.containsKey(OPENVPN));
@@ -1522,7 +1538,9 @@ public class VpnConfigGeneratorTest {
gateway = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("ptdemo_pt_udp_tcp.eip-service.json"))).getJSONArray("gateways").getJSONObject(0);
//delete "data-ciphers" from config to test if the resulting openvpn config file will contain the default value taken from "cipher" flag
generalConfig.put("data-ciphers", null);
- vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, 3, false, false);
+ VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration();
+ configuration.apiVersion = 3;
+ vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, configuration);
HashMap<Connection.TransportType, VpnProfile> vpnProfiles = vpnConfigGenerator.generateVpnProfiles();
assertTrue(vpnProfiles.containsKey(OBFS4));
assertTrue(vpnProfiles.containsKey(OPENVPN));
@@ -1534,7 +1552,9 @@ public class VpnConfigGeneratorTest {
public void testGenerateVpnProfile_v4_ovpn_tcp_udp() throws Exception {
gateway = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("v4/ptdemo_pt_tcp_udp.eip-service.json"))).getJSONArray("gateways").getJSONObject(0);
generalConfig = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("v4/ptdemo_pt_tcp_udp.eip-service.json"))).getJSONObject(OPENVPN_CONFIGURATION);
- vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, 4, false, false);
+ VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration();
+ configuration.apiVersion = 4;
+ vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, configuration);
HashMap<Connection.TransportType, VpnProfile> vpnProfiles = vpnConfigGenerator.generateVpnProfiles();
assertTrue(vpnProfiles.containsKey(OBFS4));
assertTrue(vpnProfiles.containsKey(OPENVPN));
@@ -1546,7 +1566,9 @@ public class VpnConfigGeneratorTest {
public void testGenerateVpnProfile_v4_ovpn_udp_tcp() throws Exception {
gateway = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("v4/ptdemo_pt_udp_tcp.eip-service.json"))).getJSONArray("gateways").getJSONObject(0);
generalConfig = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("v4/ptdemo_pt_udp_tcp.eip-service.json"))).getJSONObject(OPENVPN_CONFIGURATION);
- vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, 4, false, false);
+ VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration();
+ configuration.apiVersion = 4;
+ vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, configuration);
HashMap<Connection.TransportType, VpnProfile> vpnProfiles = vpnConfigGenerator.generateVpnProfiles();
assertTrue(vpnProfiles.containsKey(OBFS4));
assertTrue(vpnProfiles.containsKey(OPENVPN));
@@ -1558,7 +1580,9 @@ public class VpnConfigGeneratorTest {
public void testGenerateVpnProfile_v3_ipv6only_allowOpenvpnIPv6Only() throws Exception {
gateway = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("ptdemo_misconfigured_ipv6.json"))).getJSONArray("gateways").getJSONObject(0);
generalConfig = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("ptdemo_misconfigured_ipv6.json"))).getJSONObject(OPENVPN_CONFIGURATION);
- vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, 3, false, false);
+ VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration();
+ configuration.apiVersion = 3;
+ vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, configuration);
HashMap<Connection.TransportType, VpnProfile> vpnProfiles = vpnConfigGenerator.generateVpnProfiles();
assertTrue(vpnProfiles.containsKey(OPENVPN));
}
@@ -1567,7 +1591,9 @@ public class VpnConfigGeneratorTest {
public void testGenerateVpnProfile_v3_obfs4IPv6_skip() throws Exception {
gateway = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("ptdemo_misconfigured_ipv6.json"))).getJSONArray("gateways").getJSONObject(0);
generalConfig = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("ptdemo_misconfigured_ipv6.json"))).getJSONObject(OPENVPN_CONFIGURATION);
- vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, 3, false, false);
+ VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration();
+ configuration.apiVersion = 3;
+ vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, configuration);
HashMap<Connection.TransportType, VpnProfile> vpnProfiles = vpnConfigGenerator.generateVpnProfiles();
assertFalse(vpnProfiles.containsKey(OBFS4));
}
@@ -1579,7 +1605,9 @@ public class VpnConfigGeneratorTest {
public void testGenerateVpnProfile_v3_obfs4IPv4AndIPv6_skipIPv6() throws Exception {
gateway = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("ptdemo_misconfigured_ipv4ipv6.json"))).getJSONArray("gateways").getJSONObject(0);
generalConfig = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("ptdemo_misconfigured_ipv4ipv6.json"))).getJSONObject(OPENVPN_CONFIGURATION);
- vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, 3, false, false);
+ VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration();
+ configuration.apiVersion = 3;
+ vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, configuration);
HashMap<Connection.TransportType, VpnProfile> vpnProfiles = vpnConfigGenerator.generateVpnProfiles();
assertTrue(vpnProfiles.containsKey(OBFS4));
assertTrue(vpnProfiles.containsKey(OPENVPN));
@@ -1594,7 +1622,24 @@ public class VpnConfigGeneratorTest {
public void testGenerateVpnProfile_v3_obfs4udp_skip() throws Exception {
gateway = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("ptdemo_misconfigured_udp.json"))).getJSONArray("gateways").getJSONObject(0);
generalConfig = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("ptdemo_misconfigured_udp.json"))).getJSONObject(OPENVPN_CONFIGURATION);
- vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, 3, false, false);
+ VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration();
+ configuration.apiVersion = 3;
+ vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, configuration);
+ HashMap<Connection.TransportType, VpnProfile> vpnProfiles = vpnConfigGenerator.generateVpnProfiles();
+ assertFalse(vpnProfiles.containsKey(OBFS4));
+ assertTrue(vpnProfiles.containsKey(OPENVPN));
+ }
+
+ /**
+ * obfs4 cannot be used with UDP, openvpn needs to support TCP
+ */
+ @Test
+ public void testGenerateVpnProfile_v3_obfs4TCP_openvpnUDP_skip() throws Exception {
+ gateway = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("ptdemo_misconfigured_udp2.json"))).getJSONArray("gateways").getJSONObject(0);
+ generalConfig = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("ptdemo_misconfigured_udp2.json"))).getJSONObject(OPENVPN_CONFIGURATION);
+ VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration();
+ configuration.apiVersion = 3;
+ vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, configuration);
HashMap<Connection.TransportType, VpnProfile> vpnProfiles = vpnConfigGenerator.generateVpnProfiles();
assertFalse(vpnProfiles.containsKey(OBFS4));
assertTrue(vpnProfiles.containsKey(OPENVPN));
@@ -1604,7 +1649,9 @@ public class VpnConfigGeneratorTest {
public void testGenerateVpnProfile_v3_obfs4UDPAndTCP_skipUDP() throws Exception {
gateway = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("ptdemo_misconfigured_udptcp.json"))).getJSONArray("gateways").getJSONObject(0);
generalConfig = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("ptdemo_misconfigured_udptcp.json"))).getJSONObject(OPENVPN_CONFIGURATION);
- vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, 3, false, false);
+ VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration();
+ configuration.apiVersion = 3;
+ vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, configuration);
HashMap<Connection.TransportType, VpnProfile> vpnProfiles = vpnConfigGenerator.generateVpnProfiles();
assertTrue(vpnProfiles.containsKey(OBFS4));
assertTrue(vpnProfiles.containsKey(OPENVPN));
@@ -1616,7 +1663,10 @@ public class VpnConfigGeneratorTest {
public void testGenerateVpnProfile_preferUDP_firstRemotesUDP() throws Exception {
gateway = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("v4/multiport_tcpudp_eip-service.json"))).getJSONArray("gateways").getJSONObject(0);
generalConfig = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("v4/multiport_tcpudp_eip-service.json"))).getJSONObject(OPENVPN_CONFIGURATION);
- vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, 3, true, false);
+ VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration();
+ configuration.apiVersion = 3;
+ configuration.preferUDP = true;
+ vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, configuration);
HashMap<Connection.TransportType, VpnProfile> vpnProfiles = vpnConfigGenerator.generateVpnProfiles();
assertTrue(vpnProfiles.containsKey(OBFS4));
assertTrue(vpnProfiles.containsKey(OPENVPN));
@@ -1628,16 +1678,23 @@ public class VpnConfigGeneratorTest {
public void testGenerateVpnProfile_testNewCiphers() throws Exception {
gateway = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("v4/ptdemo_pt_tcp_udp_new_ciphers.eip-service.json"))).getJSONArray("gateways").getJSONObject(0);
generalConfig = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("v4/ptdemo_pt_tcp_udp_new_ciphers.eip-service.json"))).getJSONObject(OPENVPN_CONFIGURATION);
- vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, 4, false, false);
+ VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration();
+ configuration.apiVersion = 4;
+ vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, configuration);
HashMap<Connection.TransportType, VpnProfile> vpnProfiles = vpnConfigGenerator.generateVpnProfiles();
System.out.println(vpnProfiles.get(OPENVPN).getConfigFile(context, false));
assertEquals(expectedVPNConfig_v4_ovpn_tcp_udp_new_ciphers.trim(), vpnProfiles.get(OPENVPN).getConfigFile(context, false).trim());
}
+ @Test
public void testGenerateVpnProfileExperimentalTransportsEnabled () throws Exception {
gateway = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("ptdemo_kcp_gateways.json"))).getJSONArray("gateways").getJSONObject(0);
generalConfig = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("ptdemo_kcp_gateways.json"))).getJSONObject(OPENVPN_CONFIGURATION);
- vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, 3, true, true);
+ VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration();
+ configuration.apiVersion = 3;
+ configuration.experimentalTransports = true;
+ configuration.preferUDP = true;
+ vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, configuration);
HashMap<Connection.TransportType, VpnProfile> vpnProfiles = vpnConfigGenerator.generateVpnProfiles();
assertTrue(vpnProfiles.containsKey(OBFS4));
assertTrue(vpnProfiles.containsKey(OBFS4_KCP));
@@ -1645,4 +1702,72 @@ public class VpnConfigGeneratorTest {
}
+ @Test
+ public void testGenerateVpnProfile_experimentalTransportsEnabled_KCPMisconfiguredWithUDP_SkippingObfsKCP () throws Exception {
+ gateway = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("ptdemo_misconfigured_kcp_gateways.json"))).getJSONArray("gateways").getJSONObject(0);
+ generalConfig = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("ptdemo_misconfigured_kcp_gateways.json"))).getJSONObject(OPENVPN_CONFIGURATION);
+ VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration();
+ configuration.apiVersion = 3;
+ configuration.experimentalTransports = true;
+ vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, configuration);
+ HashMap<Connection.TransportType, VpnProfile> vpnProfiles = vpnConfigGenerator.generateVpnProfiles();
+ assertTrue(vpnProfiles.containsKey(OBFS4));
+ assertFalse(vpnProfiles.containsKey(OBFS4_KCP));
+ assertTrue(vpnProfiles.containsKey(OPENVPN));
+ }
+
+ @Test
+ public void testGenerateVpnProfile_ObfuscationPinningEnabled_obfs4AndOpenvpnProfile () throws Exception {
+ gateway = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("ptdemo_kcp_gateways.json"))).getJSONArray("gateways").getJSONObject(0);
+ generalConfig = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("ptdemo_kcp_gateways.json"))).getJSONObject(OPENVPN_CONFIGURATION);
+ VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration();
+ configuration.apiVersion = 3;
+ configuration.useObfuscationPinning = true;
+ configuration.remoteGatewayIP = "1.2.3.4";
+ vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, configuration);
+ HashMap<Connection.TransportType, VpnProfile> vpnProfiles = vpnConfigGenerator.generateVpnProfiles();
+ assertTrue("has openvpn profile", vpnProfiles.containsKey(OPENVPN));
+ assertTrue("has obfs4 profile", vpnProfiles.containsKey(OBFS4));
+ assertFalse("has no obfs4 kcp profile", vpnProfiles.containsKey(OBFS4_KCP));
+ }
+
+ @Test
+ public void testGenerateVpnProfile_ObfuscationPinningEnabled_obfs4Profile () throws Exception {
+ gateway = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("ptdemo_kcp_gateways.json"))).getJSONArray("gateways").getJSONObject(0);
+ generalConfig = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("ptdemo_kcp_gateways.json"))).getJSONObject(OPENVPN_CONFIGURATION);
+ VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration();
+ configuration.apiVersion = 3;
+ configuration.useObfuscationPinning = true;
+ configuration.obfuscationProxyKCP = true;
+ configuration.obfuscationProxyPort = "443";
+ configuration.obfuscationProxyIP = "5.6.7.8";
+ configuration.obfuscationProxyCert = "asdfasdf";
+ configuration.remoteGatewayIP = "1.2.3.4";
+ vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, configuration);
+ HashMap<Connection.TransportType, VpnProfile> vpnProfiles = vpnConfigGenerator.generateVpnProfiles();
+ assertTrue("has obfs4_kcp profile", vpnProfiles.containsKey(OBFS4_KCP));
+ assertTrue("has openvpn profile", vpnProfiles.containsKey(OPENVPN));
+ assertFalse("has no obfs4 profile", vpnProfiles.containsKey(OBFS4));
+ }
+
+ @Test
+ public void testGenerateVpnProfile_ObfuscationPinningEnabled_kcp_obfs4KcpProfile () throws Exception {
+ gateway = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("ptdemo_kcp_gateways.json"))).getJSONArray("gateways").getJSONObject(0);
+ generalConfig = new JSONObject(TestSetupHelper.getInputAsString(getClass().getClassLoader().getResourceAsStream("ptdemo_kcp_gateways.json"))).getJSONObject(OPENVPN_CONFIGURATION);
+ VpnConfigGenerator.Configuration configuration = new VpnConfigGenerator.Configuration();
+ configuration.apiVersion = 3;
+ configuration.useObfuscationPinning = true;
+ configuration.obfuscationProxyKCP = true;
+ configuration.obfuscationProxyPort = "443";
+ configuration.obfuscationProxyIP = "5.6.7.8";
+ configuration.obfuscationProxyCert = "asdfasdf";
+ configuration.remoteGatewayIP = "1.2.3.4";
+
+ vpnConfigGenerator = new VpnConfigGenerator(generalConfig, secrets, gateway, configuration);
+ HashMap<Connection.TransportType, VpnProfile> vpnProfiles = vpnConfigGenerator.generateVpnProfiles();
+ assertTrue("has obfs4_kcp profile", vpnProfiles.containsKey(OBFS4_KCP));
+ assertTrue("has openvpn profile", vpnProfiles.containsKey(OPENVPN));
+ assertFalse("has no obfs4 profile", vpnProfiles.containsKey(OBFS4));
+ }
+
} \ No newline at end of file
diff --git a/app/src/test/resources/ptdemo_misconfigured_kcp_gateways.json b/app/src/test/resources/ptdemo_misconfigured_kcp_gateways.json
new file mode 100644
index 00000000..94a1eafd
--- /dev/null
+++ b/app/src/test/resources/ptdemo_misconfigured_kcp_gateways.json
@@ -0,0 +1,160 @@
+{
+ "gateways":[
+ {
+ "capabilities":{
+ "adblock":false,
+ "filter_dns":false,
+ "limited":false,
+ "transport":[
+ {
+ "type":"obfs4",
+ "protocols":[
+ "tcp"
+ ],
+ "ports":[
+ "23049"
+ ],
+ "options": {
+ "cert": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX1",
+ "iatMode": "0"
+ }
+ },
+ {
+ "type":"obfs4-1",
+ "protocols":[
+ "udp"
+ ],
+ "ports":[
+ "23050"
+ ],
+ "options": {
+ "cert": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX1",
+ "iatMode": "0"
+ }
+ },
+ {
+ "type":"openvpn",
+ "protocols":[
+ "tcp"
+ ],
+ "ports":[
+ "1195"
+ ]
+ }
+ ],
+ "user_ips":false
+ },
+ "host":"pt.demo.bitmask.net",
+ "ip_address":"37.218.247.60",
+ "location":"Amsterdam"
+ },
+ {
+ "capabilities":{
+ "adblock":false,
+ "filter_dns":false,
+ "limited":false,
+ "transport":[
+ {
+ "type":"obfs4",
+ "protocols":[
+ "tcp"
+ ],
+ "ports":[
+ "443"
+ ],
+ "options": {
+ "cert": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX2",
+ "iatMode": "0"
+ }
+ },
+ {
+ "type":"openvpn",
+ "protocols":[
+ "tcp"
+ ],
+ "ports":[
+ "1195"
+ ]
+ }
+ ],
+ "user_ips":false
+ },
+ "host":"moscow.bitmask.net",
+ "ip_address":"3.21.247.89",
+ "location":"moscow"
+ },
+ {
+ "capabilities":{
+ "adblock":false,
+ "filter_dns":false,
+ "limited":false,
+ "transport":[
+ {
+ "type":"openvpn",
+ "protocols":[
+ "tcp",
+ "udp"
+ ],
+
+ "ports":[
+ "1195"
+ ]
+ },
+ {
+ "type":"obfs4-1",
+ "protocols":[
+ "udp"
+ ],
+ "ports":[
+ "23050"
+ ],
+ "options": {
+ "cert": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX1",
+ "iatMode": "0"
+ }
+ }
+ ],
+ "user_ips":false
+ },
+ "host":"manila.bitmask.net",
+ "ip_address":"37.12.247.10",
+ "location":"manila"
+ }
+ ],
+ "locations":{
+ "Amsterdam":{
+ "country_code":"NL",
+ "hemisphere":"N",
+ "name":"Amsterdam",
+ "timezone":"-1"
+ },
+ "moscow": {
+ "country_code": "RU",
+ "hemisphere": "N",
+ "name": "Moscow",
+ "timezone": "+3"
+ },
+ "manila": {
+ "country_code": "PH",
+ "hemisphere": "N",
+ "name": "Manila",
+ "timezone": "+8"
+ }
+ },
+ "openvpn_configuration":{
+ "auth":"SHA1",
+ "cipher":"AES-256-CBC",
+ "keepalive":"10 30",
+ "tls-cipher":"DHE-RSA-AES128-SHA",
+ "tun-ipv6":true,
+ "dev" : "tun",
+ "sndbuf" : "0",
+ "rcvbuf" : "0",
+ "nobind" : true,
+ "persist-key" : true,
+ "key-direction" : "1",
+ "verb" : "3"
+ },
+ "serial":2,
+ "version":3
+} \ No newline at end of file
diff --git a/app/src/test/resources/ptdemo_misconfigured_udp2.json b/app/src/test/resources/ptdemo_misconfigured_udp2.json
new file mode 100644
index 00000000..d2a54cef
--- /dev/null
+++ b/app/src/test/resources/ptdemo_misconfigured_udp2.json
@@ -0,0 +1,65 @@
+{
+ "gateways":[
+ {
+ "capabilities":{
+ "adblock":false,
+ "filter_dns":false,
+ "limited":false,
+ "transport":[
+ {
+ "type":"obfs4",
+ "protocols":[
+ "tcp"
+ ],
+ "ports":[
+ "23049"
+ ],
+ "options": {
+ "cert": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
+ "iatMode": "0"
+ }
+ },
+ {
+ "type":"openvpn",
+ "protocols":[
+ "udp"
+ ],
+ "ports":[
+ "1195"
+ ]
+ }
+ ],
+ "user_ips":false
+ },
+ "host":"pt.demo.bitmask.net",
+ "ip_address6":"2001:db8:123::1058",
+ "ip_address":"37.218.247.60",
+ "location":"Amsterdam"
+ }
+ ],
+ "locations":{
+ "Amsterdam":{
+ "country_code":"NL",
+ "hemisphere":"N",
+ "name":"Amsterdam",
+ "timezone":"-1"
+ }
+ },
+ "openvpn_configuration":{
+ "auth":"SHA1",
+ "cipher":"AES-256-CBC",
+ "keepalive":"10 30",
+ "tls-cipher":"DHE-RSA-AES128-SHA",
+ "tun-ipv6":true,
+ "dev" : "tun",
+ "sndbuf" : "0",
+ "rcvbuf" : "0",
+ "nobind" : true,
+ "persist-key" : true,
+ "comp-lzo" : true,
+ "key-direction" : "1",
+ "verb" : "3"
+ },
+ "serial":2,
+ "version":3
+} \ No newline at end of file