Nuke DoH
This commit is contained in:
3 files changed
+1
-38
No files matched your search
@@ -92,7 +92,6 @@ public class Settings {
|
||||
public static final String KEY_READ_CACHE_SIZE = "read_cache_size";
|
||||
public static final int DEFAULT_READ_CACHE_SIZE = 320;
|
||||
public static final String KEY_BUILT_IN_HOSTS = "built_in_hosts_2";
|
||||
public static final String KEY_DOH = "dns_over_https";
|
||||
public static final String KEY_DOMAIN_FRONTING = "domain_fronting";
|
||||
public static final String KEY_APP_LANGUAGE = "app_language";
|
||||
private static final String TAG = Settings.class.getSimpleName();
|
||||
@@ -243,7 +242,6 @@ public class Settings {
|
||||
private static final String KEY_SAVE_CRASH_LOG = "save_crash_log";
|
||||
private static final boolean DEFAULT_SAVE_CRASH_LOG = true;
|
||||
private static final boolean DEFAULT_BUILT_IN_HOSTS = false;
|
||||
private static final boolean DEFAULT_DOH = false;
|
||||
private static final boolean DEFAULT_FRONTING = false;
|
||||
private static final String DEFAULT_APP_LANGUAGE = "system";
|
||||
private static final String KEY_PROXY_TYPE = "proxy_type";
|
||||
@@ -282,10 +280,7 @@ public class Settings {
|
||||
|
||||
private static void fixDefaultValue(Context context) {
|
||||
if ("CN".equals(Locale.getDefault().getCountry())) {
|
||||
// Enable DoH and domain fronting if the country is CN
|
||||
if (!sSettingsPre.contains(KEY_DOH)) {
|
||||
putDoH(true);
|
||||
}
|
||||
// Enable domain fronting if the country is CN
|
||||
if (!sSettingsPre.contains(KEY_BUILT_IN_HOSTS)) {
|
||||
putBuiltInHosts(true);
|
||||
}
|
||||
@@ -1074,14 +1069,6 @@ public class Settings {
|
||||
putBoolean(KEY_BUILT_IN_HOSTS, value);
|
||||
}
|
||||
|
||||
public static boolean getDoH() {
|
||||
return getBoolean(KEY_DOH, DEFAULT_DOH);
|
||||
}
|
||||
|
||||
public static void putDoH(boolean value) {
|
||||
putBoolean(KEY_DOH, value);
|
||||
}
|
||||
|
||||
public static boolean getDF() {
|
||||
return getBoolean(KEY_DOMAIN_FRONTING, DEFAULT_FRONTING);
|
||||
}
|
||||
|
||||
@@ -36,9 +36,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import okhttp3.Dns;
|
||||
import okhttp3.HttpUrl;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.dnsoverhttps.DnsOverHttps;
|
||||
|
||||
public class EhDns implements Dns {
|
||||
|
||||
@@ -67,14 +64,9 @@ public class EhDns implements Dns {
|
||||
}
|
||||
|
||||
private final Hosts hosts;
|
||||
private static DnsOverHttps dnsOverHttps;
|
||||
|
||||
public EhDns(Context context) {
|
||||
hosts = EhApplication.getHosts(context);
|
||||
DnsOverHttps.Builder builder = new DnsOverHttps.Builder()
|
||||
.client(new OkHttpClient.Builder().cache(EhApplication.getOkHttpCache(context)).build())
|
||||
.url(HttpUrl.get("https://101.6.6.6:8443/dns-query"));
|
||||
dnsOverHttps = builder.post(true).build();
|
||||
}
|
||||
|
||||
private static void put(Map<String, List<InetAddress>> map, String host, String... ips) {
|
||||
@@ -98,15 +90,6 @@ public class EhDns implements Dns {
|
||||
return inetAddresses;
|
||||
}
|
||||
}
|
||||
if (Settings.getDoH()) {
|
||||
try {
|
||||
inetAddresses = dnsOverHttps.lookup(hostname);
|
||||
if (inetAddresses.size() > 0) {
|
||||
return inetAddresses;
|
||||
}
|
||||
} catch (UnknownHostException ignore) {
|
||||
}
|
||||
}
|
||||
return SYSTEM.lookup(hostname);
|
||||
}
|
||||
}
|
||||
@@ -86,13 +86,6 @@
|
||||
android:fragment="com.hippo.ehviewer.ui.fragment.HostsFragment"
|
||||
app:iconSpaceReserved="false" />
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="dns_over_https"
|
||||
android:summary="@string/settings_advanced_dns_over_http_summary"
|
||||
android:title="@string/settings_advanced_dns_over_http_title"
|
||||
app:iconSpaceReserved="false" />
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="domain_fronting"
|
||||
|
||||
Reference in new issue
Block a user