From 889a0eb8b39bdf26c1aee667e48b776741fc4f45 Mon Sep 17 00:00:00 2001
From: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu, 1 Feb 2024 15:20:53 +0300
Subject: [PATCH] all: upd chlog, i18n; fix os resolv

---
 CHANGELOG.md                      | 32 ++++++++++++++++++++-----------
 client/src/__locales/fr.json      |  3 +++
 client/src/__locales/it.json      |  3 +++
 client/src/__locales/ja.json      |  3 +++
 client/src/__locales/ko.json      |  3 +++
 client/src/__locales/zh-cn.json   |  3 +++
 client/src/__locales/zh-tw.json   |  3 +++
 internal/dnsforward/dnsforward.go |  4 +++-
 internal/dnsforward/http.go       |  2 +-
 9 files changed, 43 insertions(+), 13 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index d14cfee1..5f3b297e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,15 +14,25 @@ and this project adheres to
 <!--
 ## [v0.108.0] - TBA
 
-## [v0.107.44] - 2023-12-20 (APPROX.)
+## [v0.107.45] - 2024-03-05 (APPROX.)
 
-See also the [v0.107.44 GitHub milestone][ms-v0.107.44].
+See also the [v0.107.45 GitHub milestone][ms-v0.107.45].
 
-[ms-v0.107.44]: https://github.com/AdguardTeam/AdGuardHome/milestone/79?closed=1
+[ms-v0.107.45]: https://github.com/AdguardTeam/AdGuardHome/milestone/80?closed=1
 
 NOTE: Add new changes BELOW THIS COMMENT.
 -->
 
+<!--
+NOTE: Add new changes ABOVE THIS COMMENT.
+-->
+
+
+
+## [v0.107.44] - 2024-02-06
+
+See also the [v0.107.44 GitHub milestone][ms-v0.107.44].
+
 ### Added
 
 - Etc timezones to the timezone list ([#6568]).
@@ -71,6 +81,8 @@ In this release, the schema version has changed from 27 to 28.
 
 ### Fixed
 
+- “Invalid AddrPort” in the *Private reverse DNS servers* section on the
+  *Settings → DNS settings* page.
 - Panic on using `--no-etc-hosts` flag ([#6644]).
 - Schedule display in the client settings after creating or updating.
 - Zero value in `querylog.size_memory` disables logging ([#6570]).
@@ -98,11 +110,8 @@ In this release, the schema version has changed from 27 to 28.
 [#6584]: https://github.com/AdguardTeam/AdGuardHome/issues/6584
 [#6644]: https://github.com/AdguardTeam/AdGuardHome/issues/6644
 
-[wiki-config]: https://github.com/AdguardTeam/AdGuardHome/wiki/Configuration
-
-<!--
-NOTE: Add new changes ABOVE THIS COMMENT.
--->
+[ms-v0.107.44]: https://github.com/AdguardTeam/AdGuardHome/milestone/79?closed=1
+[wiki-config]:  https://github.com/AdguardTeam/AdGuardHome/wiki/Configuration
 
 
 
@@ -2750,11 +2759,12 @@ See also the [v0.104.2 GitHub milestone][ms-v0.104.2].
 
 
 <!--
-[Unreleased]: https://github.com/AdguardTeam/AdGuardHome/compare/v0.107.44...HEAD
-[v0.107.44]:  https://github.com/AdguardTeam/AdGuardHome/compare/v0.107.43...v0.107.44
+[Unreleased]: https://github.com/AdguardTeam/AdGuardHome/compare/v0.107.45...HEAD
+[v0.107.45]:  https://github.com/AdguardTeam/AdGuardHome/compare/v0.107.44...v0.107.45
 -->
 
-[Unreleased]: https://github.com/AdguardTeam/AdGuardHome/compare/v0.107.43...HEAD
+[Unreleased]: https://github.com/AdguardTeam/AdGuardHome/compare/v0.107.44...HEAD
+[v0.107.44]:  https://github.com/AdguardTeam/AdGuardHome/compare/v0.107.43...v0.107.44
 [v0.107.43]:  https://github.com/AdguardTeam/AdGuardHome/compare/v0.107.42...v0.107.43
 [v0.107.42]:  https://github.com/AdguardTeam/AdGuardHome/compare/v0.107.41...v0.107.42
 [v0.107.41]:  https://github.com/AdguardTeam/AdGuardHome/compare/v0.107.40...v0.107.41
diff --git a/client/src/__locales/fr.json b/client/src/__locales/fr.json
index eb09b830..a7766cb9 100644
--- a/client/src/__locales/fr.json
+++ b/client/src/__locales/fr.json
@@ -423,6 +423,9 @@
     "encryption_hostnames": "Noms d'hôte",
     "encryption_reset": "Voulez-vous vraiment réinitialiser les paramètres de chiffrement ?",
     "encryption_warning": "Attention",
+    "encryption_plain_dns_enable": "Activer le DNS simple",
+    "encryption_plain_dns_desc": "Le DNS simple est activé par défaut. Vous pouvez le désactiver pour forcer tous les appareils à utiliser un DNS crypté. Pour faire ça, vous devez activer au moins un protocole DNS crypté",
+    "encryption_plain_dns_error": "Pour désactiver le DNS simple, activez au moins un protocole DNS crypté",
     "topline_expiring_certificate": "Votre certificat SSL est sur le point d'expirer. Mettez à jour vos <0>Paramètres de chiffrement</0>.",
     "topline_expired_certificate": "Votre certificat SSL a expiré. Mettez à jour vos <0>Paramètres de chiffrement</0>.",
     "form_error_port_range": "Saisissez une valeur de port entre 80 et 65535",
diff --git a/client/src/__locales/it.json b/client/src/__locales/it.json
index fca0d970..a29004af 100644
--- a/client/src/__locales/it.json
+++ b/client/src/__locales/it.json
@@ -423,6 +423,9 @@
     "encryption_hostnames": "Nomi host",
     "encryption_reset": "Sei sicuro di voler ripristinare le impostazioni di crittografia?",
     "encryption_warning": "Attenzione",
+    "encryption_plain_dns_enable": "Abilita DNS semplice",
+    "encryption_plain_dns_desc": "Il DNS semplice è abilitato per impostazione predefinita. Puoi disabilitarlo per forzare tutti i dispositivi a usare DNS crittografati. Per fare ciò è necessario abilitare almeno un protocollo DNS crittografato",
+    "encryption_plain_dns_error": "Per disabilitare il DNS semplice, abilitare almeno un protocollo DNS crittografato",
     "topline_expiring_certificate": "Il tuo certificato SSL sta per scadere. Aggiorna le<0> Impostazioni di crittografia </ 0>.",
     "topline_expired_certificate": "Il tuo certificato SSL è scaduto. Aggiorna le <0> Impostazioni di crittografia </ 0>.",
     "form_error_port_range": "Immettere il valore della porta nell'intervallo 80-65535",
diff --git a/client/src/__locales/ja.json b/client/src/__locales/ja.json
index 63cd3c3f..3e0521ec 100644
--- a/client/src/__locales/ja.json
+++ b/client/src/__locales/ja.json
@@ -423,6 +423,9 @@
     "encryption_hostnames": "ホスト名",
     "encryption_reset": "暗号化設定をリセットして良いですか?",
     "encryption_warning": "警告",
+    "encryption_plain_dns_enable": "プレーンDNSを有効にする",
+    "encryption_plain_dns_desc": "プレーンDNSはデフォルトで有効になっています。無効にして、すべてのデバイスに暗号化された DNS の使用を強制適用できます。これを行うには、少なくとも 1 つの暗号化されたDNSプロトコルを有効にする必要があります。",
+    "encryption_plain_dns_error": "プレーンDNSを無効にするには、暗号化DNSプロトコルを少なくとも 1 つ有効にしてください",
     "topline_expiring_certificate": "SSL証明書は期限切れになります。<0>暗号化設定</0>を更新します。",
     "topline_expired_certificate": "SSL証明書は期限切れです。<0>暗号化設定</0>を更新します。",
     "form_error_port_range": "80〜65535 の範囲内でポート番号を入力してください",
diff --git a/client/src/__locales/ko.json b/client/src/__locales/ko.json
index e39ca472..7ce4ad02 100644
--- a/client/src/__locales/ko.json
+++ b/client/src/__locales/ko.json
@@ -423,6 +423,9 @@
     "encryption_hostnames": "호스트 이름",
     "encryption_reset": "암호화 설정을 재설정하시겠습니까?",
     "encryption_warning": "주의",
+    "encryption_plain_dns_enable": "평문 DNS 활성화",
+    "encryption_plain_dns_desc": "평문 DNS가 기본으로 설정되어 있습니다. 비활성화해서 모든 기기가 암호화된 DNS를 사용하도록 할 수 있습니다. 그러려면 암호화된 DNS 프로토콜을 하나 이상 활성화해야 합니다.",
+    "encryption_plain_dns_error": "평문 DNS를 비활성화하려면, 암호화된 DNS 프로토콜을 하나 이상 활성화하세요",
     "topline_expiring_certificate": "SSL 인증서가 곧 만료됩니다. 업데이트<0> 암호화 설정</0>.",
     "topline_expired_certificate": "SSL 인증서가 만료되었습니다. 업데이트<0> 암호화 설정</0>.",
     "form_error_port_range": "80-65535 범위의 포트 번호를 입력하세요",
diff --git a/client/src/__locales/zh-cn.json b/client/src/__locales/zh-cn.json
index 8080c8db..dda8a017 100644
--- a/client/src/__locales/zh-cn.json
+++ b/client/src/__locales/zh-cn.json
@@ -423,6 +423,9 @@
     "encryption_hostnames": "主机名",
     "encryption_reset": "您确定想要重置加密设置?",
     "encryption_warning": "警告",
+    "encryption_plain_dns_enable": "启用无加密 DNS",
+    "encryption_plain_dns_desc": "默认情况下启用无加密 DNS。用户可以禁用它,强制所有设备使用加密 DNS。为此,必须至少启用一个加密 DNS 协议",
+    "encryption_plain_dns_error": "要禁用无加密 DNS,请至少启用一个加密 DNS 协议",
     "topline_expiring_certificate": "您的 SSL 证书即将过期。请更新 <0>加密设置</0> 。",
     "topline_expired_certificate": "您的 SSL 证书已过期。请更新 <0>加密设置</0> 。",
     "form_error_port_range": "输入 80 - 65535 范围内的端口值",
diff --git a/client/src/__locales/zh-tw.json b/client/src/__locales/zh-tw.json
index 8cf40d52..ddaa6244 100644
--- a/client/src/__locales/zh-tw.json
+++ b/client/src/__locales/zh-tw.json
@@ -423,6 +423,9 @@
     "encryption_hostnames": "主機名稱",
     "encryption_reset": "您確定您想要重置加密設定嗎?",
     "encryption_warning": "警告",
+    "encryption_plain_dns_enable": "啟用一般的 DNS",
+    "encryption_plain_dns_desc": "預設情況下啟用一般的 DNS。使用者可以禁用它,強制所有裝置使用一般的 DNS。為此,必須至少啟用一個一般的 DNS 協定。",
+    "encryption_plain_dns_error": "要禁用一般的 DNS,請至少啟用一個一般的 DNS 協定",
     "topline_expiring_certificate": "您的安全通訊端層(SSL)憑證即將到期。更新<0>加密設定</0>。",
     "topline_expired_certificate": "您的安全通訊端層(SSL)憑證為已到期的。更新<0>加密設定</0>。",
     "form_error_port_range": "輸入在 80-65535 之範圍內的連接埠號碼",
diff --git a/internal/dnsforward/dnsforward.go b/internal/dnsforward/dnsforward.go
index 2da21391..9c0097b9 100644
--- a/internal/dnsforward/dnsforward.go
+++ b/internal/dnsforward/dnsforward.go
@@ -83,7 +83,9 @@ type DHCP interface {
 
 // SystemResolvers is an interface for accessing the OS-provided resolvers.
 type SystemResolvers interface {
-	// Addrs returns the list of system resolvers' addresses.
+	// Addrs returns the list of system resolvers' addresses.  Callers must
+	// clone the returned slice before modifying it.  Implementations of Addrs
+	// must be safe for concurrent use.
 	Addrs() (addrs []netip.AddrPort)
 }
 
diff --git a/internal/dnsforward/http.go b/internal/dnsforward/http.go
index d3d352df..2c222d07 100644
--- a/internal/dnsforward/http.go
+++ b/internal/dnsforward/http.go
@@ -218,7 +218,7 @@ func (s *Server) defaultLocalPTRUpstreams() (ups []string, err error) {
 		return nil, err
 	}
 
-	sysResolvers := slices.DeleteFunc(s.sysResolvers.Addrs(), matcher.Has)
+	sysResolvers := slices.DeleteFunc(slices.Clone(s.sysResolvers.Addrs()), matcher.Has)
 	ups = make([]string, 0, len(sysResolvers))
 	for _, r := range sysResolvers {
 		ups = append(ups, r.String())