From 1f5abecefc0c50e5f6e12ab054407e7d3365d59f Mon Sep 17 00:00:00 2001 From: Stanislav Chzhen Date: Wed, 30 Aug 2023 13:21:31 +0300 Subject: [PATCH] Pull request 1975: 3701-fallback-dns-api Squashed commit of the following: commit 0f96137c629d7df99d40e479f66dd78248185ca3 Merge: 0d640fe37 aac36a2d2 Author: Stanislav Chzhen Date: Wed Aug 30 12:53:03 2023 +0300 Merge branch 'master' into 3701-fallback-dns-api commit 0d640fe37a563d9fcea1ff4b6c86f37629af0ebd Author: Stanislav Chzhen Date: Wed Aug 30 12:49:05 2023 +0300 dnsforward: imp tests commit 6b7f7aad76566b70852146bc6629ae7fb71eec09 Author: Ainar Garipov Date: Fri Aug 25 18:51:34 2023 +0300 client: add fallback dns field commit c2ac7e3656431f7d44645786296e58ac7d012fed Author: Stanislav Chzhen Date: Thu Aug 24 13:22:07 2023 +0300 all: add fallback dns api --- client/src/__locales/en.json | 5 +- client/src/actions/dnsConfig.js | 4 ++ .../components/Settings/Dns/Upstream/Form.js | 25 ++++++++ .../components/Settings/Dns/Upstream/index.js | 4 ++ client/src/reducers/dnsConfig.js | 2 + internal/dnsforward/config.go | 3 +- internal/dnsforward/http.go | 27 ++++++++ internal/dnsforward/http_test.go | 4 ++ .../TestDNSForwardHTTP_handleGetConfig.json | 9 +++ .../TestDNSForwardHTTP_handleSetConfig.json | 61 +++++++++++++++++++ openapi/CHANGELOG.md | 6 ++ openapi/openapi.yaml | 10 +++ 12 files changed, 158 insertions(+), 2 deletions(-) diff --git a/client/src/__locales/en.json b/client/src/__locales/en.json index b8e72b3f..d4673e5e 100644 --- a/client/src/__locales/en.json +++ b/client/src/__locales/en.json @@ -8,11 +8,14 @@ "load_balancing_desc": "Query one upstream server at a time. AdGuard Home uses its weighted random algorithm to pick the server so that the fastest server is used more often.", "bootstrap_dns": "Bootstrap DNS servers", "bootstrap_dns_desc": "IP addresses of DNS servers used to resolve IP addresses of the DoH/DoT resolvers you specify as upstreams. Comments are not permitted.", + "fallback_dns_title": "Fallback DNS servers", + "fallback_dns_desc": "List of fallback DNS servers used when upstream DNS servers are not responding. The syntax is the same as in the main upstreams field above.", + "fallback_dns_placeholder": "Enter one fallback DNS server per line", "local_ptr_title": "Private reverse DNS servers", "local_ptr_desc": "The DNS servers that AdGuard Home uses for local PTR queries. These servers are used to resolve PTR requests for addresses in private IP ranges, for example \"192.168.12.34\", using reverse DNS. If not set, AdGuard Home uses the addresses of the default DNS resolvers of your OS except for the addresses of AdGuard Home itself.", "local_ptr_default_resolver": "By default, AdGuard Home uses the following reverse DNS resolvers: {{ip}}.", "local_ptr_no_default_resolver": "AdGuard Home could not determine suitable private reverse DNS resolvers for this system.", - "local_ptr_placeholder": "Enter one server address per line", + "local_ptr_placeholder": "Enter one IP address per line", "resolve_clients_title": "Enable reverse resolving of clients' IP addresses", "resolve_clients_desc": "Reversely resolve clients' IP addresses into their hostnames by sending PTR queries to corresponding resolvers (private DNS servers for local clients, upstream servers for clients with public IP addresses).", "use_private_ptr_resolvers_title": "Use private reverse DNS resolvers", diff --git a/client/src/actions/dnsConfig.js b/client/src/actions/dnsConfig.js index f8141fd5..47823f66 100644 --- a/client/src/actions/dnsConfig.js +++ b/client/src/actions/dnsConfig.js @@ -50,6 +50,10 @@ export const setDnsConfig = (config) => async (dispatch) => { data.bootstrap_dns = splitByNewLine(config.bootstrap_dns); hasDnsSettings = true; } + if (Object.prototype.hasOwnProperty.call(data, 'fallback_dns')) { + data.fallback_dns = splitByNewLine(config.fallback_dns); + hasDnsSettings = true; + } if (Object.prototype.hasOwnProperty.call(data, 'local_ptr_upstreams')) { data.local_ptr_upstreams = splitByNewLine(config.local_ptr_upstreams); hasDnsSettings = true; diff --git a/client/src/components/Settings/Dns/Upstream/Form.js b/client/src/components/Settings/Dns/Upstream/Form.js index be01b2b7..3c534f0c 100644 --- a/client/src/components/Settings/Dns/Upstream/Form.js +++ b/client/src/components/Settings/Dns/Upstream/Form.js @@ -179,6 +179,30 @@ const Form = ({
+
+ +
+ fallback_dns_desc +
+ +
+
+
+