Skip to content

Commit

Permalink
DNS: built-in Google Public DNS and Cloudflare DNS for DoH
Browse files Browse the repository at this point in the history
  • Loading branch information
PeratX committed Jul 14, 2019
1 parent 2124ab2 commit c97b65f
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 47 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
language: android
jdk: oraclejdk8

dist: xenial
git:
depth: 1
android:
components:
- tools
Expand All @@ -12,8 +14,6 @@ android:
- extra-android-m2repository
licenses:
- '.+'
before_install:
- yes | sdkmanager "platforms;android-28"
script:
- chmod 777 gradlew
- ./gradlew clean assembleDebug
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ __Users must comply with local laws and regulations.__<br>

* __CuteDNS__ - *Shutdown according to regulations*
* __[FUN DNS](http://fundns.cn)__ - *Shutdown according to regulations*
* __[Pure DNS](https://puredns.cn/)__
* __[PdoMo-DNS](https://pdomo.me/)__ - *Intelligent Free Public DNS*
* __[Pure DNS](https://puredns.cn/)__ - *Shutdown according to regulations*
* __[PdoMo-DNS](https://pdomo.me/)__ - *Shutdown according to regulations*
* __[rubyfish](https://www.rubyfish.cn)__ - *Free DoT/DoH DNS*

## Rule Providers
Expand All @@ -60,9 +60,8 @@ __Users must comply with local laws and regulations.__<br>

## Requirements

* Minimum Android version: 4.0.3 (API 15) - __*Basic VPN functions*__
* Recommended Android version: >= 5.0 (API 21) - __*Full features*__
* Best Android version: >= 7.1 (API 25) - __*Launcher shortcuts*__
* Minimum Android version: >= 5.0 (API 21)
* Recommended Android version: >= 7.1 (API 25) - __*Launcher shortcuts*__

## Open Source Licenses

Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/org/itxtech/daedalus/Daedalus.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ public class Daedalus extends Application {
add(new DNSServer("101.101.101.101", R.string.server_twnic_primary));
add(new DNSServer("101.102.103.104", R.string.server_twnic_secondary));
add(new DNSServer("dns.rubyfish.cn/dns-query", R.string.server_rubyfish));
add(new DNSServer("cloudflare-dns.com/dns-query", R.string.server_cloudflare));
add(new DNSServer("dns.google/dns-query", R.string.server_google_ietf));
add(new DNSServer("dns.google/resolve", R.string.server_google_json));
}};

public static final List<Rule> RULES = new ArrayList<Rule>() {{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void updateList(ArrayList<AppObject> appObjects) {
}
}

runOnUiThread(() -> notifyDataSetChanged());
runOnUiThread(this::notifyDataSetChanged);
}

@NonNull
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
package org.itxtech.daedalus.fragment;

import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.preference.*;
import android.view.View;

import com.google.android.material.snackbar.Snackbar;

import org.itxtech.daedalus.Daedalus;
import org.itxtech.daedalus.R;
import org.itxtech.daedalus.activity.FilterAppProxyActivity;
Expand Down Expand Up @@ -78,26 +73,14 @@ public void onCreate(Bundle savedInstanceState) {
return true;
});

if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
SwitchPreference advanced = (SwitchPreference) findPreference("settings_advanced_switch");
advanced.setEnabled(false);
advanced.setChecked(false);
SwitchPreference boot = (SwitchPreference) findPreference("settings_boot");
boot.setEnabled(false);
boot.setChecked(false);
SwitchPreference app_filter = (SwitchPreference) findPreference("settings_app_filter_switch");
app_filter.setEnabled(false);
app_filter.setChecked(false);
}

SwitchPreference advanced = (SwitchPreference) findPreference("settings_advanced_switch");
advanced.setOnPreferenceChangeListener((preference, newValue) -> {
updateOptions((boolean) newValue, "settings_advanced");
return true;
});

SwitchPreference app_filter = (SwitchPreference) findPreference("settings_app_filter_switch");
app_filter.setOnPreferenceChangeListener((p, w) -> {
SwitchPreference appFilter = (SwitchPreference) findPreference("settings_app_filter_switch");
appFilter.setOnPreferenceChangeListener((p, w) -> {
updateOptions((boolean) w, "settings_app_filter");
return true;
});
Expand Down Expand Up @@ -128,7 +111,7 @@ public void onCreate(Bundle savedInstanceState) {
});

updateOptions(advanced.isChecked(), "settings_advanced");
updateOptions(app_filter.isChecked(), "settings_app_filter");
updateOptions(appFilter.isChecked(), "settings_app_filter");
}

private void updateOptions(boolean checked, String pref) {
Expand All @@ -145,13 +128,4 @@ private void updateOptions(boolean checked, String pref) {
}
}
}

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);

if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
Snackbar.make(view, R.string.notice_legacy_api, Snackbar.LENGTH_LONG).show();
}
}
}
4 changes: 2 additions & 2 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<string name="notice_activated">已启用 iTXTech Daedalus。</string>
<string name="notice_start_test">正在测试指定的 DNS 服务器……</string>
<string name="notice_queries">DNS 查询次数:</string>
<string name="notice_legacy_api">当前 Android API 无法支持所有功能。</string>
<string name="notice_need_restart">重新启用 Daedalus 以应用设置。</string>
<string name="notice_start_download">正在下载规则,请稍等 ……</string>
<string name="notice_downloaded">已下载规则。</string>
Expand Down Expand Up @@ -86,11 +85,12 @@
<string name="settings_app_filter_list">选择应用</string>
<string name="settings_app_filter_mode">黑名单模式</string>
<string name="settings_app_filter_list_summary">选择要过滤的应用</string>
<string name="settings_app_filter_summary">仅支持Android Lollipop及以上版本</string>

<string name="server_twnic_primary">Quad 101 主服务器</string>
<string name="server_twnic_secondary">Quad 101 辅服务器</string>
<string name="server_rubyfish">红鱼 (DoH)</string>
<string name="server_google_json">谷歌公共 DNS (DoH JSON)</string>
<string name="server_google_ietf">谷歌公共 DNS (DoH RFC8484)</string>

<string name="primary_server">首选 DNS 服务器</string>
<string name="secondary_server">备用 DNS 服务器</string>
Expand Down
4 changes: 1 addition & 3 deletions app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<string name="notice_activated">已啟動 iTXTech Daedalus。</string>
<string name="notice_start_test">正在測試指定的 DNS 伺服器……</string>
<string name="notice_queries">DNS 查詢次數:</string>
<string name="notice_legacy_api">目前 Android API 無法支援所有功能。</string>
<string name="notice_need_restart">重新啟動 Daedalus 以套用設定。</string>
<string name="notice_start_download">正在下載規則,請稍等……</string>
<string name="notice_downloaded">已下載規則。</string>
Expand Down Expand Up @@ -64,7 +63,7 @@
<string name="settings_manual_summary">造訪 GitHub wiki 頁面。</string>
<string name="settings_log_size">紀錄檔大小限制</string>
<string name="settings_debug_output">调试输出 TODO</string>
<string name="settings_dont_build_doh_cache">不缓存 DoH DNS 的 IP地址</string>
<string name="settings_dont_build_doh_cache">不緩存 DoH DNS 的 IP地址</string>
<string name="settings_dark_theme">使用暗主题</string>

<string name="settings_rule_name">規則名稱</string>
Expand All @@ -86,7 +85,6 @@
<string name="settings_app_filter_list">選擇應用</string>
<string name="settings_app_filter_mode">黑名單模式</string>
<string name="settings_app_filter_list_summary">選擇要過濾的應用</string>
<string name="settings_app_filter_summary">僅支持Android Lollipop及以上版本</string>

<string name="server_twnic_primary">Quad 101 主伺服器</string>
<string name="server_twnic_secondary">Quad 101 輔伺服器</string>
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<string name="notice_activated">iTXTech Daedalus is activated.</string>
<string name="notice_start_test">Testing specified DNS server…</string>
<string name="notice_queries">DNS query times:</string>
<string name="notice_legacy_api">The current Android API can not support all the features.</string>
<string name="notice_need_restart">Re-activate Daedalus to make the settings take effect.</string>
<string name="notice_start_download">Downloading rule, please wait …</string>
<string name="notice_downloaded">Rule has been downloaded.</string>
Expand Down Expand Up @@ -91,11 +90,13 @@
<string name="settings_app_filter_mode">Blacklist mode</string>
<string name="settings_app_filter_list">Select application</string>
<string name="settings_app_filter_list_summary">Select apps to pass through</string>
<string name="settings_app_filter_summary">Only supports Android Lollipop and above</string>

<string name="server_twnic_primary">Quad 101 Primary</string>
<string name="server_twnic_secondary">Quad 101 Secondary</string>
<string name="server_rubyfish">rubyfish (DoH)</string>
<string name="server_cloudflare">Cloudflare DNS (DoH)</string>
<string name="server_google_json">Google Public DNS (DoH JSON)</string>
<string name="server_google_ietf">Google Public DNS (DoH RFC8484)</string>

<string name="primary_server">Primary DNS server</string>
<string name="secondary_server">Secondary DNS server</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/xml/perf_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
<SwitchPreference
android:key="settings_app_filter_switch"
android:title="@string/settings_app_filter"
android:summary="@string/settings_app_filter_summary"
android:defaultValue="false"/>
<SwitchPreference
android:key="settings_app_filter_mode_switch"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-4.6-bin.zip
distributionUrl=https://services.gradle.org/distributions/gradle-5.5.1-bin.zip

0 comments on commit c97b65f

Please sign in to comment.