Removed SOCKS5 proxy support

This commit is contained in:
M66B 2020-06-26 11:09:57 +02:00
parent 6867f9ab6b
commit 9a9b4c8660
5 changed files with 2 additions and 96 deletions

View File

@ -145,25 +145,8 @@ public class EmailService implements AutoCloseable {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
this.harden = prefs.getBoolean("ssl_harden", false);
boolean socks_enabled = prefs.getBoolean("socks_enabled", false);
String socks_proxy = prefs.getString("socks_proxy", "localhost:9050");
boolean auth_sasl = prefs.getBoolean("auth_sasl", true);
// SOCKS proxy
if (socks_enabled) {
String[] address = socks_proxy.split(":");
String host = (address.length > 0 ? address[0] : null);
String port = (address.length > 1 ? address[1] : null);
if (TextUtils.isEmpty(host))
host = "localhost";
if (TextUtils.isEmpty(port))
port = "9050";
properties.put("mail." + protocol + ".socks.host", host);
properties.put("mail." + protocol + ".socks.port", port);
Log.i("Using SOCKS proxy=" + host + ":" + port);
}
properties.put("mail.event.scope", "folder");
properties.put("mail.event.executor", executor);

View File

@ -61,15 +61,12 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
private SwitchCompat swRlah;
private EditText etTimeout;
private SwitchCompat swSslHarden;
private SwitchCompat swSocks;
private EditText etSocks;
private Button btnSocks;
private Button btnManage;
private TextView tvConnectionType;
private TextView tvConnectionRoaming;
private final static String[] RESET_OPTIONS = new String[]{
"metered", "download", "roaming", "rlah", "timeout", "ssl_harden", "socks_enabled", "socks_proxy"
"metered", "download", "roaming", "rlah", "timeout", "ssl_harden"
};
@Override
@ -88,9 +85,6 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
swRlah = view.findViewById(R.id.swRlah);
etTimeout = view.findViewById(R.id.etTimeout);
swSslHarden = view.findViewById(R.id.swSslHarden);
swSocks = view.findViewById(R.id.swSocks);
etSocks = view.findViewById(R.id.etSocks);
btnSocks = view.findViewById(R.id.btnSocks);
btnManage = view.findViewById(R.id.btnManage);
tvConnectionType = view.findViewById(R.id.tvConnectionType);
@ -168,26 +162,6 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
}
});
swSocks.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("socks_enabled", checked).apply();
etSocks.setEnabled(checked);
btnSocks.setEnabled(checked);
}
});
btnSocks.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String proxy = etSocks.getText().toString();
if (TextUtils.isEmpty(proxy))
prefs.edit().remove("socks_proxy").apply();
else
prefs.edit().putString("socks_proxy", proxy).apply();
}
});
final Intent manage = getIntentConnectivity();
PackageManager pm = getContext().getPackageManager();
btnManage.setVisibility(
@ -295,10 +269,6 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
etTimeout.setHint(Integer.toString(EmailService.DEFAULT_CONNECT_TIMEOUT));
swSslHarden.setChecked(prefs.getBoolean("ssl_harden", false));
swSocks.setChecked(prefs.getBoolean("socks_enabled", false));
etSocks.setText(prefs.getString("socks_proxy", null));
etSocks.setEnabled(swSocks.isChecked());
btnSocks.setEnabled(swSocks.isChecked());
}
private static Intent getIntentConnectivity() {

View File

@ -124,7 +124,6 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
private static final List<String> PREF_RELOAD = Collections.unmodifiableList(Arrays.asList(
"metered", "roaming", "rlah", // force reconnect
"ssl_harden", // force reconnect
"socks_enabled", "socks_proxy", // force reconnect
"badge", "unseen_ignored", // force update badge/widget
"debug" // force reconnect
));

View File

@ -207,49 +207,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swSslHarden" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swSocks"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_socks"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSslHardenHint"
app:switchPadding="12dp" />
<eu.faircode.email.EditTextPlain
android:id="@+id/etSocks"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="localhost:9050"
app:layout_constraintEnd_toStartOf="@+id/btnSocks"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swSocks" />
<Button
android:id="@+id/btnSocks"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_set"
app:layout_constraintBottom_toBottomOf="@id/etSocks"
app:layout_constraintEnd_toEndOf="parent" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvSocksHint"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="48dp"
android:text="@string/title_advanced_socks_hint"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/etSocks" />
<Button
android:id="@+id/btnManage"
style="?android:attr/buttonStyleSmall"
@ -258,7 +215,7 @@
android:layout_marginTop="12dp"
android:text="@string/title_advanced_manage_connectivity"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSocksHint" />
app:layout_constraintTop_toBottomOf="@id/tvSslHardenHint" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvConnectionType"

View File

@ -308,7 +308,6 @@
<string name="title_advanced_rlah">Roam like at home</string>
<string name="title_advanced_timeout">Connection timeout (seconds)</string>
<string name="title_advanced_ssl_harden">Harden SSL connections</string>
<string name="title_advanced_socks">Use SOCKS proxy</string>
<string name="title_advanced_manage_connectivity">Manage connectivity</string>
<string name="title_advanced_caption_general">General</string>
@ -498,7 +497,6 @@
<string name="title_advanced_rlah_hint">Assuming no roaming within the EU</string>
<string name="title_advanced_timeout_hint">The read/write timeout will be set to the double of the connection timeout. Higher values will result in more battery use.</string>
<string name="title_advanced_ssl_harden_hint">Enabling this will disable weak SSL protocols and ciphers, which can lead to connection problems</string>
<string name="title_advanced_socks_hint">Using a remote proxy server is insecure because proxy connections are not encrypted</string>
<string name="title_advanced_roaming_hint">Messages headers will always be fetched when roaming. You can use the device\'s roaming setting to disable internet while roaming.</string>
<string name="title_advanced_browse_hint">Fetch more messages when scrolling down</string>
@ -1248,7 +1246,6 @@
<string name="title_dismiss">Dismiss</string>
<string name="title_snooze_now">Snooze</string>
<string name="title_loading">Loading &#8230;</string>
<string name="title_set">Set</string>
<string name="title_fetching_again">Fetching message again from the server</string>
<string name="title_conversation_actions">Actions</string>