Improved DNS Query Method settings
This commit is contained in:
parent
a3e877794b
commit
9932116dac
@ -48,10 +48,11 @@ dependencies {
|
||||
implementation 'org.pcap4j:pcap4j-core:1.7.3'
|
||||
implementation 'org.pcap4j:pcap4j-packetfactory-static:1.7.3'
|
||||
implementation 'org.minidns:minidns-client:0.3.0'
|
||||
implementation 'com.google.code.gson:gson:2.8.4'
|
||||
implementation 'com.google.code.gson:gson:2.8.5'
|
||||
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
|
||||
//Analytics
|
||||
implementation 'com.google.firebase:firebase-core:15.0.2'
|
||||
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.2'
|
||||
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.3'
|
||||
}
|
||||
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
|
@ -0,0 +1,27 @@
|
||||
package org.itxtech.daedalus.provider;
|
||||
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import org.itxtech.daedalus.Daedalus;
|
||||
import org.itxtech.daedalus.service.DaedalusVpnService;
|
||||
|
||||
/**
|
||||
* @author PeratX
|
||||
*/
|
||||
public class ProviderPicker {
|
||||
public static final int DNS_QUERY_METHOD_UDP = 0;
|
||||
public static final int DNS_QUERY_METHOD_TCP = 1;
|
||||
public static final int DNS_QUERY_METHOD_HTTPS = 2;
|
||||
|
||||
public static Provider getProvider(ParcelFileDescriptor descriptor, DaedalusVpnService service) {
|
||||
switch (Daedalus.getPrefs().getInt("settings_dns_query_method", DNS_QUERY_METHOD_UDP)) {
|
||||
case DNS_QUERY_METHOD_UDP:
|
||||
return new UdpProvider(descriptor, service);
|
||||
case DNS_QUERY_METHOD_TCP:
|
||||
return new TcpProvider(descriptor, service);
|
||||
case DNS_QUERY_METHOD_HTTPS:
|
||||
//TODO
|
||||
break;
|
||||
}
|
||||
return new UdpProvider(descriptor, service);
|
||||
}
|
||||
}
|
@ -16,6 +16,7 @@ import org.itxtech.daedalus.Daedalus;
|
||||
import org.itxtech.daedalus.R;
|
||||
import org.itxtech.daedalus.activity.MainActivity;
|
||||
import org.itxtech.daedalus.provider.Provider;
|
||||
import org.itxtech.daedalus.provider.ProviderPicker;
|
||||
import org.itxtech.daedalus.provider.TcpProvider;
|
||||
import org.itxtech.daedalus.provider.UdpProvider;
|
||||
import org.itxtech.daedalus.receiver.StatusBarBroadcastReceiver;
|
||||
@ -275,11 +276,7 @@ public class DaedalusVpnService extends VpnService implements Runnable {
|
||||
Logger.info("Daedalus VPN service is started");
|
||||
|
||||
if (advanced) {
|
||||
if (Daedalus.getPrefs().getBoolean("settings_dns_over_tcp", false)) {
|
||||
provider = new TcpProvider(descriptor, this);
|
||||
} else {
|
||||
provider = new UdpProvider(descriptor, this);
|
||||
}
|
||||
provider = ProviderPicker.getProvider(descriptor, this);
|
||||
provider.start();
|
||||
provider.process();
|
||||
} else {
|
||||
|
@ -59,13 +59,13 @@
|
||||
<string name="settings_advanced">高级系统设置</string>
|
||||
<string name="settings_advanced_on">开启</string>
|
||||
<string name="settings_local_rules_resolution">本地规则解析</string>
|
||||
<string name="settings_dns_over_tcp">DNS over TCP</string>
|
||||
<string name="settings_manual">使用手册</string>
|
||||
<string name="settings_manual_summary">访问 GitHub wiki 页面。</string>
|
||||
<string name="settings_log_size">日志大小限制</string>
|
||||
<string name="settings_debug_output">调试输出</string>
|
||||
<string name="settings_allow_dynamic_rule_reload">允许动态更新规则</string>
|
||||
<string name="settings_dark_theme">使用暗主题</string>
|
||||
<string name="settings_dns_query_method">DNS 查询方式</string>
|
||||
|
||||
<string name="settings_rule_name">规则名称</string>
|
||||
<string name="settings_rule_type">规则类型</string>
|
||||
@ -98,6 +98,4 @@
|
||||
<string name="test_test_domain">google.com</string>
|
||||
|
||||
<string name="nav_version">版本:</string>
|
||||
<string name="nav_git_commit">Git commit:</string>
|
||||
<string name="nav_github">GitHub</string>
|
||||
</resources>
|
@ -59,7 +59,6 @@
|
||||
<string name="settings_advanced">進階系統設定</string>
|
||||
<string name="settings_advanced_on">開啟</string>
|
||||
<string name="settings_local_rules_resolution">本機規則解析</string>
|
||||
<string name="settings_dns_over_tcp">DNS over TCP</string>
|
||||
<string name="settings_manual">使用手冊</string>
|
||||
<string name="settings_manual_summary">造訪 GitHub wiki 頁面。</string>
|
||||
<string name="settings_log_size">紀錄檔大小限制</string>
|
||||
@ -76,6 +75,7 @@
|
||||
<string name="settings_rule_import">匯入</string>
|
||||
<string name="settings_rule_import_build_in">内置</string>
|
||||
<string name="settings_rule_import_external">外部</string>
|
||||
<string name="settings_dns_query_method">DNS 查询方式</string>
|
||||
|
||||
<string name="settings_server_name">伺服器名稱</string>
|
||||
<string name="settings_server_address">伺服器網址</string>
|
||||
@ -98,6 +98,4 @@
|
||||
<string name="test_test_domain">google.com</string>
|
||||
|
||||
<string name="nav_version">版本:</string>
|
||||
<string name="nav_git_commit">Git commit:</string>
|
||||
<string name="nav_github">GitHub</string>
|
||||
</resources>
|
||||
|
14
app/src/main/res/values/arrays.xml
Normal file
14
app/src/main/res/values/arrays.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<integer-array name="dns_query_methods">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
</integer-array>
|
||||
<string-array name="dns_query_method_values">
|
||||
<item>@string/settings_dns_udp</item>
|
||||
<item>@string/settings_dns_tcp</item>
|
||||
<item>@string/settings_dns_https</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
|
@ -58,13 +58,17 @@
|
||||
<string name="settings_advanced">Advanced System Settings</string>
|
||||
<string name="settings_advanced_on">On</string>
|
||||
<string name="settings_local_rules_resolution">Local Rules Resolution</string>
|
||||
<string name="settings_dns_over_tcp">DNS over TCP</string>
|
||||
<string name="settings_log_size">Log Size Limit</string>
|
||||
<string name="settings_manual">Manual</string>
|
||||
<string name="settings_manual_summary">Visit GitHub wiki page.</string>
|
||||
<string name="settings_allow_dynamic_rule_reload">Allow Dynamic Rule Reloading</string>
|
||||
<string name="settings_debug_output">Debug Output</string>
|
||||
<string name="settings_dark_theme">Use Dark Theme</string>
|
||||
<string name="settings_dns_query_method">DNS Query Method</string>
|
||||
|
||||
<string name="settings_dns_https">HTTPS</string>
|
||||
<string name="settings_dns_tcp">TCP</string>
|
||||
<string name="settings_dns_udp">UDP</string>
|
||||
|
||||
<string name="settings_rule_name">Rule Name</string>
|
||||
<string name="settings_rule_type">Rule Type</string>
|
||||
|
@ -70,10 +70,12 @@
|
||||
android:title="@string/settings_allow_dynamic_rule_reload"
|
||||
android:defaultValue="false"
|
||||
android:enabled="false"/>
|
||||
<SwitchPreference
|
||||
android:key="settings_dns_over_tcp"
|
||||
android:title="@string/settings_dns_over_tcp"
|
||||
android:defaultValue="false"
|
||||
<ListPreference
|
||||
android:key="settings_dns_query_method"
|
||||
android:title="@string/settings_dns_query_method"
|
||||
android:dialogTitle="@string/settings_dns_query_method"
|
||||
android:entries="@array/dns_query_methods"
|
||||
android:entryValues="@array/dns_query_method_values"
|
||||
android:enabled="false"/>
|
||||
<SwitchPreference
|
||||
android:key="settings_debug_output"
|
||||
|
Loading…
Reference in New Issue
Block a user