From 5a3f84a2f467c1076aa845da3c2eb9c4739d4a49 Mon Sep 17 00:00:00 2001 From: Maksim Kazantsev Date: Mon, 20 Jul 2026 11:26:41 +0000 Subject: [PATCH] Pull request 2720: AGDNS-4254-support-bootstrap-comments Squashed commit of the following: commit 91c992eb126dc2f447d60801895c35bc51634b3f Merge: 83c721762 48b98bb5a Author: Maksim Kazantsev Date: Mon Jul 20 14:21:06 2026 +0300 Merge branch 'master' into AGDNS-4254-support-bootstrap-comments commit 83c72176292315a8712063feacad08fb961d4d17 Author: Maksim Kazantsev Date: Fri Jul 17 12:34:48 2026 +0300 all: imp ui text; commit d15d6d19c65ef2aac9026d13474700b11f65785c Author: Maksim Kazantsev Date: Fri Jul 17 12:30:23 2026 +0300 all: imp chlog and ui text; commit 9e1074fabeb89099cd06697d63e7be1d15633bfd Author: Maksim Kazantsev Date: Thu Jul 16 18:57:24 2026 +0300 all: imp chlog; commit 25a864b34372c4abf8c30ffd68af0617d989eeed Author: Maksim Kazantsev Date: Thu Jul 16 18:56:33 2026 +0300 all: imp chlog and ui text; commit bf6ad5108e25dd029b58ecad61000d9252d8857d Author: Maksim Kazantsev Date: Thu Jul 16 17:18:55 2026 +0300 all: upd chlog; openapi: upd openapi and api chlog; client_V2: upd ui text; commit 13b595c36e4afe3975f000fc7e8ec6ffd907ea67 Author: Maksim Kazantsev Date: Thu Jul 16 12:50:53 2026 +0300 dnsforward: add support of comments in bootstraps; --- CHANGELOG.md | 2 ++ client/src/__locales/en.json | 2 +- client_v2/src/__locales/en.json | 4 ++-- internal/dnsforward/http.go | 6 ++---- internal/dnsforward/upstreams.go | 2 ++ openapi/CHANGELOG.md | 2 ++ openapi/openapi.yaml | 12 ++++++++---- 7 files changed, 19 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ce0805ee..70384e33c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,8 @@ NOTE: Add new changes BELOW THIS COMMENT. ### Added +- Bootstrap servers configuration now supports comments. + - New property `"language"` in `POST /control/install/check_config` and `POST /control/install/configure` HTTP APIs. - The user is able to remove the static lease's hostname via the HTTP API. diff --git a/client/src/__locales/en.json b/client/src/__locales/en.json index 35a028ed2..3b1abb062 100644 --- a/client/src/__locales/en.json +++ b/client/src/__locales/en.json @@ -63,7 +63,7 @@ "blocking_mode_refused": "REFUSED: Respond with REFUSED code", "blocklist": "Blocklist", "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.", + "bootstrap_dns_desc": "IP addresses of DNS servers used to resolve IP addresses of the DoH/DoT resolvers you specify as upstreams. Empty lines and comments, starting with '#', are ignored.", "cache_cleared": "DNS cache successfully cleared", "cache_enabled": "Enable cache", "cache_enabled_desc": "Store DNS responses locally.", diff --git a/client_v2/src/__locales/en.json b/client_v2/src/__locales/en.json index 68dd4cf92..0f95d2112 100644 --- a/client_v2/src/__locales/en.json +++ b/client_v2/src/__locales/en.json @@ -329,7 +329,7 @@ "dns_blocking_mode_ttl_label": "Blocked response TTL, in seconds", "dns_blocking_mode_ttl_placeholder": "Enter TTL", "dns_bootstrap_dns_desc": "Sets the DNS servers used to resolve DoH/DoT upstream resolver hostnames", - "dns_bootstrap_dns_desc_2": "Enter IP addresses only. Comments are not allowed", + "dns_bootstrap_dns_desc_2": "Enter IP addresses and, optionally, comments. Comments must start with a hash (#) and be on exclusive lines", "dns_bootstrap_dns_label": "Bootstrap DNS servers, one per line", "dns_bootstrap_dns_placeholder": "IP addresses", "dns_bootstrap_dns_title": "Bootstrap DNS servers", @@ -466,7 +466,7 @@ "upstream_fallback_title_faq": "Fallback DNS servers to use when upstream DNS servers are unavailable. Use the same syntax as for the upstream DNS servers", "ip_addresses_placeholder": "Enter IP addresses, one per line", "upstream_bootstrap_dns_title": "Bootstrap DNS servers, one per line", - "upstream_bootstrap_dns_faq": "IP addresses of DNS servers used to resolve the IP addresses of DoH/DoT upstream resolvers. Comments are not allowed", + "upstream_bootstrap_dns_faq": "IP addresses of DNS servers used to resolve the IP addresses of DoH/DoT upstream resolvers. Empty lines and comments, starting with '#', are ignored.", "upstream_ptr": "Private reverse DNS servers, one per line", "upstream_ptr_faq_1": "AdGuard Home uses these DNS servers for private PTR, SOA, and NS requests. Private requests come from clients with a private IP address and ask for an ARPA domain that contains a subnet from a private IP address range, such as %value%", "upstream_ptr_faq_2": "If this field is empty, the default DNS resolvers of your OS will be used, except for the AdGuard Home IP addresses", diff --git a/internal/dnsforward/http.go b/internal/dnsforward/http.go index 29dce6eb0..9896b81cb 100644 --- a/internal/dnsforward/http.go +++ b/internal/dnsforward/http.go @@ -342,8 +342,8 @@ func (req *jsonDNSConfig) checkBootstrap() (err error) { defer func() { err = errors.Annotate(err, "checking bootstrap %s: %w", b) }() for _, b = range *req.Bootstraps { - if b == "" { - return errors.Error("empty") + if aghnet.IsCommentOrEmpty(b) { + continue } var resolver *upstream.UpstreamResolver @@ -730,8 +730,6 @@ func (s *Server) handleTestUpstreamDNS(w http.ResponseWriter, r *http.Request) { return } - req.BootstrapDNS = stringutil.FilterOut(req.BootstrapDNS, aghnet.IsCommentOrEmpty) - opts := &upstream.Options{ Logger: aghslog.NewForUpstream(s.baseLogger, aghslog.UpstreamTypeTest), Timeout: s.conf.UpstreamTimeout, diff --git a/internal/dnsforward/upstreams.go b/internal/dnsforward/upstreams.go index 5bf7dcedc..3465e5b95 100644 --- a/internal/dnsforward/upstreams.go +++ b/internal/dnsforward/upstreams.go @@ -29,6 +29,8 @@ func newBootstrap( etcHosts upstream.Resolver, opts *upstream.Options, ) (r upstream.Resolver, boots []*upstream.UpstreamResolver, err error) { + addrs = stringutil.FilterOut(addrs, aghnet.IsCommentOrEmpty) + if len(addrs) == 0 { addrs = defaultBootstrap } diff --git a/openapi/CHANGELOG.md b/openapi/CHANGELOG.md index e33f21ccc..9bed21dd6 100644 --- a/openapi/CHANGELOG.md +++ b/openapi/CHANGELOG.md @@ -4,6 +4,8 @@ ## v0.107.79: API changes +- Field `bootstrap_dns` in `POST /control/dns_config` now accepts comments. A comment must start with the `#` symbol. + ### Setting the UI language through the install API - New property `"language"` in `POST /control/install/check_config` and `POST /control/install/configure` HTTP APIs defines the language to use once AdGuard Home is installed. diff --git a/openapi/openapi.yaml b/openapi/openapi.yaml index c190efbd0..f97d23245 100644 --- a/openapi/openapi.yaml +++ b/openapi/openapi.yaml @@ -1557,7 +1557,8 @@ 'type': 'array' 'description': > Bootstrap servers, port is optional after colon. Empty value will - reset it to default values. + reset it to default values. Comments are allowed, a comment line + starts with a `#` symbol. 'items': 'type': 'string' 'example': @@ -1567,7 +1568,8 @@ 'type': 'array' 'description': > Upstream servers, port is optional after colon. Empty value will - reset it to default values. + reset it to default values. Comments are allowed, a comment line + starts with a `#` symbol. 'items': 'type': 'string' 'example': @@ -1577,7 +1579,8 @@ 'type': 'array' 'description': > List of fallback DNS servers used when upstream DNS servers are not - responding. Empty value will clear the list. + responding. Empty value will clear the list. Comments are allowed, + a comment line starts with a `#` symbol. 'items': 'type': 'string' 'example': @@ -1670,7 +1673,8 @@ 'type': 'array' 'description': > Upstream servers, port is optional after colon. Empty value will - reset it to default values. + reset it to default values. Comments are allowed, a comment line + starts with a `#` symbol. 'items': 'type': 'string' 'example':