Compare commits

...

18 Commits

Author SHA1 Message Date
Ainar Garipov
c9a5a5b9c8 Pull request: client: upd i18n
Updates #2643.

Squashed commit of the following:

commit 63048521bf6df01d1b247a3b1b8b1baf05320720
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Apr 21 16:38:23 2021 +0300

    client: upd i18n
2021-04-21 16:48:03 +03:00
Ainar Garipov
c9c2a79a55 Pull request: bamboo-specs: fix cron
Merge in DNS/adguard-home from labor-code-2 to master

Squashed commit of the following:

commit e69df9f5f1cfa9d2b2593810d4bf4a1e6a7f97d6
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Apr 21 15:28:54 2021 +0300

    bamboo-specs: fix cron
2021-04-21 15:35:58 +03:00
Ainar Garipov
34c87ea709 Pull request: bamboo-specs: no dailies on weekends
Merge in DNS/adguard-home from labor-code to master

Squashed commit of the following:

commit 0e283c60830c66162ff2482eebf2d544139a3eb6
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Apr 21 15:14:32 2021 +0300

    bamboo-specs: no dailies on weekends
2021-04-21 15:24:53 +03:00
Ainar Garipov
aee09d29e9 Pull request: dhcpd: fix dbload panic
Closes #2991.

Squashed commit of the following:

commit cd820a9a903d628aa5964f8f973edc7bb7993ae5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Apr 21 14:34:45 2021 +0300

    dhcpd: fix err handling

commit 775b834683f0edb5954b20fedb896e6af1fa843e
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Apr 21 14:21:41 2021 +0300

    dhcpd: fix build for go1.15

commit 8441d6fffa72cc6890fad2df76559e21819786d6
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Apr 21 14:05:08 2021 +0300

    dhcpd: fix dbload panic
2021-04-21 14:42:19 +03:00
Eugene Burkov
2e4e1973d9 Pull request: 2606 substitute nclient4 with fork
Merge in DNS/adguard-home from 2606-rm-nclient4 to master

Closes #2606.

Squashed commit of the following:

commit a9abc3ac27b19ef0ab6c4dea8610d97034b24ec2
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Apr 21 13:22:56 2021 +0300

    nclient4: rm

commit abcd0042a7f0d1fbf7ebb398a06414bbc7fc2528
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Apr 21 13:19:11 2021 +0300

    all: clear changes

commit d1bc3b83f00be07bf9bb97cfe6ef773e07ae8710
Merge: 1b1ab0b9 c2667558
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Apr 21 12:58:48 2021 +0300

    Merge branch 'master' into 2606-rm-nclient4

commit 1b1ab0b9796552854ecffefe8e79ca24b472fed0
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Apr 19 18:53:04 2021 +0300

    dhcpd: subst nclient4 with fork
2021-04-21 13:41:18 +03:00
Eugene Burkov
c26675585d Pull request: 2843 upd dnsproxy
Merge in DNS/adguard-home from 2843-upd-dnsproxy to master

Closes #2843.

Squashed commit of the following:

commit c3ffddcbf85cbd2542c5bb111984a8f422113a24
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Apr 20 19:39:11 2021 +0300

    all: fix docs

commit 4b596e4776bfc05e4171bc53e8f9c55c88e1e6a5
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Apr 20 19:25:24 2021 +0300

    all: imp code, docs

commit 8e3655f4f888ccc2c0902373cf8dd2aa4e113857
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Apr 20 18:41:14 2021 +0300

    all: upd dnsproxy
2021-04-21 12:49:41 +03:00
Ainar Garipov
55cd4ae254 Pull request: home: fix 8 to 9 migration
Updates #2988.

Squashed commit of the following:

commit 1b9f145be0dbcca9848e02942cea294315baa9cc
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Apr 20 18:41:05 2021 +0300

    home: fix 8 to 9 migration
2021-04-20 18:56:15 +03:00
Ainar Garipov
93638a1936 Pull request: all: add string set
Merge in DNS/adguard-home from add-strset to master

Squashed commit of the following:

commit 2500df1805dee425eafd0503983ec631de02af0b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Apr 20 15:09:59 2021 +0300

    all: add string set
2021-04-20 16:26:19 +03:00
Ainar Garipov
71030bafd8 Pull request: all: imp dhcp host normalization, validation
Updates #2952.

Squashed commit of the following:

commit 45afcab5d33c1ec8176c0ad05423288c8770b772
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Apr 20 15:02:34 2021 +0300

    all: imp docs

commit d844ce1e2bb0b92a892119161774ec95f3e59711
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Apr 20 14:57:49 2021 +0300

    all: more code imp

commit eef08cb69015ead0ffaef866e12a2c6556786d37
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Apr 20 14:52:33 2021 +0300

    all: imp code, docs

commit 20748f20ab9fcc410b11daf0e23eaf156dcdc7cd
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Apr 20 14:30:57 2021 +0300

    all: imp dhcp host normalization, validation
2021-04-20 15:07:57 +03:00
Ainar Garipov
cd9eb3b3e4 Pull request: client: upd i18n
Updates #2643.

Squashed commit of the following:

commit b5cb0e164845fafe21964c91d14b804ec0b48606
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Apr 19 16:21:14 2021 +0300

    client: upd i18n

commit 13ee98d64a4bd1953ea71cd51a15f5dc7cf4cf9e
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Apr 19 16:11:58 2021 +0300

    client: upd i18n
2021-04-19 16:35:01 +03:00
Ainar Garipov
d707f8b1d1 Pull request: all: imp dhcp client hostname normalization
Updates #2952.
Updates #2978.

Squashed commit of the following:

commit 20e379b94ccf8140fd9056429315945c17f711a5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Apr 19 15:58:37 2021 +0300

    all: imp naming

commit ed300e0563fa37e161406a97991b26a89e23903a
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Apr 19 15:43:09 2021 +0300

    all: imp dhcp client hostname normalization
2021-04-19 16:04:40 +03:00
Eugene Burkov
91304663b7 Pull request: 2954 wrong logs
Merge in DNS/adguard-home from 2954-wrong-logs to master

Closes #2954.

Squashed commit of the following:

commit 94c77a4dfcadbbf4f44ba4c6b30d4d00d98e659b
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Thu Apr 15 19:15:18 2021 +0300

    all: log changes

commit b5095715e7ba7fd99a03869a97cf7291daaa4fc4
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Thu Apr 15 19:09:46 2021 +0300

    go.mod: upd golibs

commit 70ec262f7bf177e4f9c7a9ee345ec2694e27a549
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Thu Apr 15 17:57:25 2021 +0300

    home: fix config logging

commit f45c407b400431ac0501b915a3070c6071112fee
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Apr 14 15:00:55 2021 +0300

    home: fix rdns logging
2021-04-16 10:32:41 +03:00
Ainar Garipov
d83091fc1f Pull request: all: allow local non-top-level domains
Updates #2961.

Squashed commit of the following:

commit 207eeb85caf6caee81a669302daf4e10a5b61585
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Apr 15 18:48:50 2021 +0300

    all: allow local non-top-level domains
2021-04-15 19:00:31 +03:00
Ainar Garipov
a1450c5595 Pull request: all: do not use dhcp clients when server is off
Closes #2934.

Squashed commit of the following:

commit 856ea4ec0c3ffb1da447b93260da90d37cd5d45d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Apr 15 17:39:46 2021 +0300

    dnsforward: imp spacing

commit fa748e5a26cb6a38b5f87c5498287cb734ce7a59
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Apr 15 17:33:44 2021 +0300

    dnsforward: imp code

commit 771ba0de449faffff1cea523e8bbcc1039c992db
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Apr 15 17:06:03 2021 +0300

    all: do not use dhcp clients when server is off
2021-04-15 17:52:53 +03:00
Eugene Burkov
b0013065a2 Pull request: 2723 autogenerate hostnames
Merge in DNS/adguard-home from 2723-dhcp-hostnames to master

Updates #2723.

Squashed commit of the following:

commit f9b9d2269c25cabd225ba712730f04496ab81715
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Thu Apr 15 16:47:31 2021 +0300

    aghnet: fix test

commit a2845d1003093ce38870b2cc89e9bd98ea2b8249
Merge: 74e450c9 0bcea347
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Thu Apr 15 16:45:59 2021 +0300

    Merge branch 'master' into 2723-dhcp-hostnames

commit 74e450c919b4c39ed6f8489aea398b225a4c6861
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Thu Apr 15 16:44:08 2021 +0300

    all: imp code, docs

commit 77cdb1232d18c8a2642b7131f051e318844c2c47
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Thu Apr 15 14:29:40 2021 +0300

    all: add gen func, use it
2021-04-15 16:59:05 +03:00
Ainar Garipov
0bcea34767 Pull request: client: imp setup guide
Merge in DNS/adguard-home from imp-setup-guide to master

Squashed commit of the following:

commit 06c92e34293849bb3c0c2195b69ea7e0aa366f17
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Apr 15 14:54:40 2021 +0300

    client: imp setup guide
2021-04-15 15:43:04 +03:00
Eugene Burkov
69f526b13d Pull request: 2956 fix clients disabling
Merge in DNS/adguard-home from 2956-fix-flag to master

Closes #2956.
Updates #1947.

Squashed commit of the following:

commit ffb98f752f6d4c40ea166ff1e482edcd7f028513
Merge: 800d67db 7be2fc37
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Apr 14 19:01:34 2021 +0300

    Merge branch 'master' into 2956-fix-flag

commit 800d67db84786c8fe93d38b6aa932aa4dd4dd345
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Apr 14 18:54:26 2021 +0300

    home: fix clients disabling
2021-04-14 19:18:48 +03:00
Ainar Garipov
7be2fc37e6 Pull request: client: imp i18n
Merge in DNS/adguard-home from imp-i18n to master

Squashed commit of the following:

commit 9befed3c5b1d113972df9fbcc3245b7be1a0eaf5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Apr 14 18:53:29 2021 +0300

    client: imp en

commit c543428e6302620577ac699701d23967b9b1909d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Apr 14 18:49:26 2021 +0300

    client: imp i18n
2021-04-14 19:00:29 +03:00
63 changed files with 1332 additions and 1886 deletions

View File

@@ -15,6 +15,8 @@ and this project adheres to
### Added
- Hostname uniqueness validation in the DHCP server ([#2952]).
- Hostname generating for DHCP clients which don't provide their own ([#2723]).
- New flag `--no-etc-hosts` to disable client domain name lookups in the
operating system's /etc/hosts files ([#1947]).
- The ability to set up custom upstreams to resolve PTR queries for local
@@ -23,14 +25,18 @@ and this project adheres to
- Logging of the client's IP address after failed login attempts ([#2824]).
- Search by clients' names in the query log ([#1273]).
- Verbose version output with `-v --version` ([#2416]).
- The ability to set a custom TLD for known local-network hosts ([#2393]).
- The ability to set a custom TLD or domain name for known hosts in the local
network ([#2393], [#2961]).
- The ability to serve DNS queries on multiple hosts and interfaces ([#1401]).
- `ips` and `text` DHCP server options ([#2385]).
- `SRV` records support in `$dnsrewrite` filters ([#2533]).
### Changed
- Normalization of hostnames with spaces sent by DHCP clients ([#2945]).
- Our DoQ implementation is now updated to conform to the latest standard
[draft][doq-draft-02] ([#2843]).
- Quality of logging ([#2954]).
- Normalization of hostnames sent by DHCP clients ([#2945], [#2952]).
- The access to the private hosts is now forbidden for users from external
networks ([#2889]).
- The reverse lookup for local addresses is now performed via local resolvers
@@ -46,6 +52,8 @@ and this project adheres to
### Fixed
- Inconsistent resolving of DHCP clients when the DHCP server is disabled
([#2934]).
- Comment handling in clients' custom upstreams ([#2947]).
- Overwriting of DHCPv4 options when using the HTTP API ([#2927]).
- Assumption that MAC addresses always have the length of 6 octets ([#2828]).
@@ -67,14 +75,22 @@ and this project adheres to
[#2533]: https://github.com/AdguardTeam/AdGuardHome/issues/2533
[#2541]: https://github.com/AdguardTeam/AdGuardHome/issues/2541
[#2704]: https://github.com/AdguardTeam/AdGuardHome/issues/2704
[#2723]: https://github.com/AdguardTeam/AdGuardHome/issues/2723
[#2824]: https://github.com/AdguardTeam/AdGuardHome/issues/2824
[#2828]: https://github.com/AdguardTeam/AdGuardHome/issues/2828
[#2835]: https://github.com/AdguardTeam/AdGuardHome/issues/2835
[#2838]: https://github.com/AdguardTeam/AdGuardHome/issues/2838
[#2843]: https://github.com/AdguardTeam/AdGuardHome/issues/2843
[#2889]: https://github.com/AdguardTeam/AdGuardHome/issues/2889
[#2927]: https://github.com/AdguardTeam/AdGuardHome/issues/2927
[#2934]: https://github.com/AdguardTeam/AdGuardHome/issues/2934
[#2945]: https://github.com/AdguardTeam/AdGuardHome/issues/2945
[#2947]: https://github.com/AdguardTeam/AdGuardHome/issues/2947
[#2952]: https://github.com/AdguardTeam/AdGuardHome/issues/2952
[#2954]: https://github.com/AdguardTeam/AdGuardHome/issues/2954
[#2961]: https://github.com/AdguardTeam/AdGuardHome/issues/2961
[doq-draft-02]: https://tools.ietf.org/html/draft-ietf-dprive-dnsoquic-02

View File

@@ -9,6 +9,10 @@ CLIENT_BETA_DIR = client2
CLIENT_DIR = client
COMMIT = $$(git rev-parse --short HEAD)
DIST_DIR = dist
# TODO(a.garipov): Find out a way to make this work in GNU Make.
#
# GO = $${GO:-go}
#
GO = go
GOPROXY = https://goproxy.cn|https://proxy.golang.org|direct
GPG_KEY = devteam@adguard.com
@@ -93,10 +97,10 @@ go-check: go-tools go-lint go-test
# A quick check to make sure that all supported operating systems can be
# typechecked and built successfully.
go-os-check:
env GOOS='darwin' go vet ./internal/...
env GOOS='freebsd' go vet ./internal/...
env GOOS='linux' go vet ./internal/...
env GOOS='windows' go vet ./internal/...
env GOOS='darwin' $(GO) vet ./internal/...
env GOOS='freebsd' $(GO) vet ./internal/...
env GOOS='linux' $(GO) vet ./internal/...
env GOOS='windows' $(GO) vet ./internal/...
openapi-lint: ; cd ./openapi/ && $(YARN) test
openapi-show: ; cd ./openapi/ && $(YARN) start

View File

@@ -228,7 +228,7 @@
- 'adg-docker': 'true'
'triggers':
- 'cron': '0 30 14 * * ?'
- 'cron': '0 30 14 ? * MON-FRI *'
'branches':
'create': 'manually'
'delete':

View File

@@ -9,10 +9,10 @@
"bootstrap_dns": "Bootstrap DNS servery",
"bootstrap_dns_desc": "Servery Bootstrap DNS se používají k řešení IP adres DoH/DoT, které zadáváte jako upstreamy.",
"local_ptr_title": "Soukromé DNS servery",
"local_ptr_desc": "Server DNS nebo servery, které AdGuard Home použije pro dotazy na lokálně poskytované zdroje. Tento server bude například používán k řešení názvů hostitelů pro klienty se soukromými IP adresami. Pokud není nastaveno, AdGuard Home automaticky použije váš výchozí překladač DNS.",
"local_ptr_desc": "Servery DNS, které AdGuard Home použije pro dotazy na lokálně poskytované zdroje. Tento server bude například používán k řešení názvů hostitelů pro klienty se soukromými IP adresami. Pokud není nastaveno, AdGuard Home automaticky použije váš výchozí překladač DNS.",
"local_ptr_placeholder": "Zadejte jednu adresu serveru na řádek",
"resolve_clients_title": "Povolit rozlišení názvů hostitelů klientů",
"resolve_clients_desc": "Pokud je povoleno, AdGuard Home se pokusí automaticky rozlišit hostitelské jména klientů z jejich IP adres zasláním dotazu PTR příslušnému řešiteli (soukromý DNS server pro místní klienty, server pro klienty s veřejnou IP adresou).",
"resolve_clients_title": "Povolit zpětné řešení IP adres klientů",
"resolve_clients_desc": "Pokud je povoleno, AdGuard Home se pokusí obráceně vyřešit IP adresy klientů na jejich názvy hostitelů zasláním dotazů PTR příslušným řešitelům (soukromé DNS servery pro místní klienty, odchozí server pro klienty s veřejnou IP adresou).",
"check_dhcp_servers": "Zkontrolovat DHCP servery",
"save_config": "Uložit konfiguraci",
"enabled_dhcp": "DHCP server zapnutý",
@@ -58,7 +58,7 @@
"dhcp_warning": "Pokud přesto chcete server DHCP povolit, ujistěte se, že ve Vaší síti není žádný jiný aktivní server DHCP, protože by to mohlo narušit připojení k Internetu pro zařízení v síti!",
"dhcp_error": "AdGuard Home nemohl určit, zda je v síti jiný aktivní server DHCP.",
"dhcp_static_ip_error": "Pro použití serveru DHCP musí být nastavena statická IP adresa. AdGuard Home nemohl zjistit, zda je toto síťové rozhraní nakonfigurováno pomocí statické adresy IP. Nastavte prosím statickou IP adresu ručně.",
"dhcp_dynamic_ip_found": "Váš systém používá konfiguraci dynamické IP adresy pro rozhraní <0>{{interfaceName}}</0>. Pro použití serveru DHCP musí být nastavena statická IP adresa. Vaše aktuální IP adresa je <0>{{ipAddress}}</0>. AdGuard Home automaticky nastaví tuto IP adresu jako statickou, pokud stisknete tlačítko Zapnout DHCP.",
"dhcp_dynamic_ip_found": "Váš systém používá konfiguraci dynamické IP adresy pro rozhraní <0>{{interfaceName}}</0>. Pro použití serveru DHCP musí být nastavena statická IP adresa. Vaše aktuální IP adresa je <0>{{ipAddress}}</0>. AdGuard Home automaticky nastaví tuto IP adresu jako statickou, pokud stisknete tlačítko \"Zapnout DHCP server\".",
"dhcp_lease_added": "Statický pronájem \"{{key}}\" byl úspěšně přidán",
"dhcp_lease_deleted": "Statický pronájem \"{{key}}\" byl úspěšně odstraněn",
"dhcp_new_static_lease": "Nový statický pronájem",
@@ -311,7 +311,7 @@
"install_devices_router": "Router",
"install_devices_router_desc": "Toto nastavení automaticky pokryje všechna zařízení připojená k Vašemu domácímu routeru a nebudete je muset konfigurovat ručně.",
"install_devices_address": "DNS server AdGuard Home používá následujíce adresy",
"install_devices_router_list_1": "Otevřete předvolby pro router. Obvykle k němu můžete přistupovat z prohlížeče prostřednictvím adresy URL, např. http://192.168.0.1/ nebo http://192.168.1.1/. Můžete být vyzváni k zadání hesla. Pokud si ho nepamatujete, můžete heslo resetovat stisknutím tlačítka na samotném routeru, ale mějte na paměti, že pokud zvolíte tento postup, pravděpodobně ztratíte celou konfiguraci routeru. Některé routery vyžadují specifickou aplikaci, která by v takovém případě měla být již nainstalována v počítači nebo telefonu.",
"install_devices_router_list_1": "Otevřete předvolby pro router. Obvykle k němu můžete přistupovat z prohlížeče prostřednictvím adresy URL, např. http://192.168.0.1/ nebo http://192.168.1.1/. Můžete být vyzváni k zadání hesla. Pokud si ho nepamatujete, můžete heslo resetovat stisknutím tlačítka na samotném routeru, ale mějte na paměti, že pokud zvolíte tento postup, pravděpodobně ztratíte celou konfiguraci routeru. Pokud váš router vyžaduje k nastavení aplikaci, nainstalujte si ji do telefonu nebo počítače a použijte ji pro přístup k nastavení routeru.",
"install_devices_router_list_2": "Vyhledejte nastavení DHCP/DNS. Hledejte zkratku DNS vedle pole, které umožňuje vložit dvě nebo tři sady čísel, každé rozděleno do čtyř skupin s jedním až třemi číslicemi.",
"install_devices_router_list_3": "Zadejte adresy Vašeho serveru AdGuard Home.",
"install_devices_router_list_4": "Na některých typech routerů nemůžete nastavit vlastní DNS server. V tomto případě může AdGuard Home pomoci, pokud jej nastavíte jako <0>DHCP server</0>. V ostatních případech byste si v manuálu k Vašemu routeru měli zjistit, jak přizpůsobit vlastní DNS servery.",

View File

@@ -9,10 +9,10 @@
"bootstrap_dns": "Bootstrap DNS-servere",
"bootstrap_dns_desc": "Bootstrap DNS-servere bruges til at fortolke IP-adresser for de DoH-/DoT-resolvere, du angiver som upstream.",
"local_ptr_title": "Private DNS-servere",
"local_ptr_desc": "DNS-serveren eller de servere som AdGuard Home vil bruge til forespørgsler efter lokalt leverede ressourcer. For eksempel vil denne server blive brugt til at løse klienters værtsnavne for klienter med private IP-adresser. Hvis ikke indstillet, bruger AdGuard Home automatisk din standard DNS-resolver.",
"local_ptr_desc": "De DNS-servere som AdGuard Home vil bruge til forespørgsler efter lokalt leverede ressourcer. For eksempel vil denne server blive brugt til at løse klienters værtsnavne for klienter med private IP-adresser. Hvis ikke indstillet, bruger AdGuard Home automatisk din standard DNS-resolver.",
"local_ptr_placeholder": "Indtast en serveradresse pr. Linje",
"resolve_clients_title": "Aktivér opløsning af klienters værtsnavne",
"resolve_clients_desc": "Hvis aktiveret, forsøger AdGuard Home automatisk at løse klienters værtsnavne fra deres IP-adresser ved at sende en PTR-forespørgsel til en tilsvarende resolver (privat DNS-server til lokale klienter, upstream-server til klienter med offentlig IP).",
"resolve_clients_title": "Aktivér omvendt løsning af klienters IP-adresser",
"resolve_clients_desc": "Hvis aktiveret, forsøger AdGuard Home automatisk at løse klienters værtsnavne fra deres IP-adresser ved at sende en PTR-forespørgsel til en tilsvarende resolver (privat DNS-server til lokale klienter, upstream-server til klienter med offentlig IP-adresse).",
"check_dhcp_servers": "Søg efter DHCP-servere",
"save_config": "Gem opsætning",
"enabled_dhcp": "DHCP-server aktiveret",
@@ -58,7 +58,7 @@
"dhcp_warning": "Vil du alligevel aktivere DHCP-serveren, så sørg for at der ikke er nogen anden aktiv DHCP-server på dit netværk, da dette kan ødelægge Internetkonnektiviteten for netværksenhederne!",
"dhcp_error": "AdGuard Home kunne ikke afgøres, om der findes en anden DHCP-server på netværket.",
"dhcp_static_ip_error": "For at kunne bruge DHCP-serveren skal der opsættes en statisk IP-adresse. Da det ikke kunne afgøres, om denne netværksinterface er opsat vha. en statisk IP-adresse, bedes du opsætte en manuelt.",
"dhcp_dynamic_ip_found": "Dit system bruger en dynamisk IP-adresseopsætning til interface <0>{{interfaceName}}</0>. For at kunne bruge DHCP-serveren skal en statisk IP-adresse indstilles. Din aktuelle IP-adresse er <0>{{ipAddress}}</0>, og den vil automatisk blive indstillet som din statiske IP-adresse, hvis du trykker på knappen \"Aktivér DHCP\".",
"dhcp_dynamic_ip_found": "Dit system bruger en dynamisk IP-adresseopsætning til interface <0>{{interfaceName}}</0>. For at kunne bruge DHCP-serveren skal en statisk IP-adresse indstilles. Din aktuelle IP-adresse er <0>{{ipAddress}}</0>. AdGuard Home vil automatisk indstille denne IP-adresse som din statiske hvis du trykker på knappen \"Aktivér DHCP-server\".",
"dhcp_lease_added": "Statisk lease \"{{key}}\" tilføjet",
"dhcp_lease_deleted": "Statisk lease \"{{key}}\" slettet",
"dhcp_new_static_lease": "Ny statisk lease",
@@ -311,7 +311,7 @@
"install_devices_router": "Router",
"install_devices_router_desc": "Denne opsætning dækker automatisk alle enheder tilsluttet din hjemmerouter, og du behøver ikke at skulle opsætte hver af dem manuelt.",
"install_devices_address": "AdGuard Home DNS-server lytter på flg. adresser",
"install_devices_router_list_1": "Åbn præferencerne for din router. Normalt kan du tilgå disse fra din browser via en URL (såsom http://192.168.0.1/ eller http://192.168.1.1/). Du anmodes muligvis om at angive en adgangskoden. Kan du ikke huske den, kan du ofte nulstille adgangskoden ved hjælp af en knap på selve routeren, men vær opmærksom på, at vælges denne procedure, mister du sandsynligvis hele routerkonfigureringen. Visse routere kræver et bestemt program, der i så tilfælde allerede skulle være installeret på din computer/mobil.",
"install_devices_router_list_1": "Åbn præferencerne for din router. Normalt kan du tilgå disse fra din browser via en URL såsom http://192.168.0.1/ eller http://192.168.1.1/. Du anmodes muligvis om at angive en adgangskode. Kan du ikke huske den, kan du ofte nulstille adgangskoden ved hjælp af en knap på selve routeren, men vær opmærksom på, at vælges denne procedure, mister du sandsynligvis hele routerkonfigureringen. Hvis din router kræver en app for at konfigurere den, skal du installere appen på din telefon eller pc og bruge den til at få adgang til routerens indstillinger.",
"install_devices_router_list_2": "Find DHCP-/DNS-indstillingerne. Kig efter DNS-bogstaverne ved siden af et felt, der tillader input af to eller tre sæt tal, hver opdelt i fire grupper med et til tre cifre.",
"install_devices_router_list_3": "Angiv dine AdGuard Home-serveradresser dér.",
"install_devices_router_list_4": "På visse routertyper kan en tilpasset DNS-server ikke opsættes. I så tilfælde kan det hjælpe, hvis du opsætter AdGuard Home som en <0>DHCP-server</0>. Ellers bør du tjekke i routermanualen, hvordan du tilpasser DNS-servere i din givne routermodel.",

View File

@@ -58,7 +58,7 @@
"dhcp_warning": "Wenn Sie den DHCP-Server trotzdem aktivieren möchten, stellen Sie sicher, dass sich in Ihrem Netzwerk kein anderer aktiver DHCP-Server befindet. Andernfalls kann es bei angeschlossenen Geräten zu einem Ausfall des Internets kommen!",
"dhcp_error": "Es konnte nicht ermittelt werden, ob es einen anderen DHCP-Server im Netzwerk gibt.",
"dhcp_static_ip_error": "Um den DHCP-Server nutzen zu können, muss eine statische IP-Adresse festgelegt werden. Es konnte nicht ermittelt werden, ob diese Netzwerkschnittstelle mit statischer IP-Adresse konfiguriert ist. Bitte legen Sie eine statische IP-Adresse manuell fest.",
"dhcp_dynamic_ip_found": "Ihr System verwendet die dynamische Konfiguration der IP-Adresse für die Schnittstelle <0>{{interfaceName}}</0>. Um den DHCP-Server nutzen zu können, muss eine statische IP-Adresse festgelegt werden. Ihre aktuelle IP-Adresse ist <0>{{ipAddress}}</0>. Diese IP-Adresse wird automatisch als statisch festgelegt, sobald Sie auf die Schaltfläche „DHCP aktivieren” klicken.",
"dhcp_dynamic_ip_found": "Ihr System verwendet die dynamische Konfiguration der IP-Adresse für die Schnittstelle <0>{{interfaceName}}</0>. Um den DHCP-Server nutzen zu können, muss eine statische IP-Adresse festgelegt werden. Ihre aktuelle IP-Adresse ist <0>{{ipAddress}}</0>. Diese IP-Adresse wird automatisch als statisch festgelegt, sobald Sie auf die Schaltfläche „DHCP-Server aktivieren” klicken.",
"dhcp_lease_added": "Statischer Lease „{{key}}” erfolgreich hinzugefügt",
"dhcp_lease_deleted": "Statischer Lease „{{key}}” erfolgreich entfernt",
"dhcp_new_static_lease": "Neuer statischer Lease",
@@ -311,10 +311,10 @@
"install_devices_router": "Router",
"install_devices_router_desc": "Diese Einrichtung deckt automatisch alle an Ihren Heimrouter angeschlossenen Geräte ab, und Sie müssen nicht jedes einzelne davon manuell konfigurieren.",
"install_devices_address": "Der AdGuard Home DNS-Server belauscht die folgenden Adressen",
"install_devices_router_list_1": "Öffnen Sie die Einstellungen für Ihren Router. In der Regel können Sie von Ihrem Browser aus über eine URL (wie http://192.168.0.1/ oder http://192.168.1.1/) darauf zugreifen. Möglicherweise werden Sie aufgefordert, das Passwort einzugeben. Wenn Sie sich nicht mehr daran erinnern, können Sie das Passwort oft durch Drücken einer Taste auf dem Router selbst zurücksetzen. Einige Router benötigen eine bestimmte Anwendung, die in diesem Fall bereits auf Ihrem Computer/Telefon installiert sein sollte.",
"install_devices_router_list_2": "DHCP/DNS-Einstellungen suchen. Suchen Sie nach den DNS-Buchstaben neben einem Feld, das zwei oder drei Zahlensätze erlaubt, die jeweils in vier Gruppen von ein bis drei Ziffern unterteilt sind.",
"install_devices_router_list_1": "Öffnen Sie die Einstellungen für Ihren Router. In der Regel können Sie über eine URL (z. B. http://192.168.0.1/ oder http://192.168.1.1) von Ihrem Browser aus darauf zugreifen. Möglicherweise werden Sie aufgefordert, ein Passwort einzugeben. Wenn Sie sich nicht mehr daran erinnern, können Sie das Passwort oft durch Drücken einer Taste am Router selbst zurücksetzen, aber seien Sie sich bewusst, dass Sie bei dieser Vorgehensweise wahrscheinlich die gesamte Routerkonfiguration verlieren. Wenn für die Einrichtung Ihres Routers eine App erforderlich ist, installieren Sie bitte die App auf Ihrem mobilen Endgerät oder PC und verwenden Sie sie für den Zugriff auf die Einstellungen des Routers.",
"install_devices_router_list_2": "Wechseln Sie zu den DHCP/DNS-Einstellungen. Suchen sie dort nach einem Eintrag „DNS“ und einem Bereich, welches zwei oder drei Zahlengruppen zulässt, die jeweils in vier Blöcke von ein bis drei Ziffern unterteilt sind.",
"install_devices_router_list_3": "Geben Sie dort Ihre AdGuard Home Server-Adressen ein.",
"install_devices_router_list_4": "Sie können auf einigen Routern keine beliebigen DNS-Server festlegen. In diesem Fall kann es hilfreich sein, dass Sie AdGuard Home als <0>DHCP-Server</0> festlegen. Andernfalls sollten Sie nach einer Bedienungsanleitung zum Anpassen des DNS-Server für Ihr Router-Modell suchen.",
"install_devices_router_list_4": "Bei einigen Routertypen kann kein eigener DNS-Server eingerichtet werden. In diesem Fall kann es helfen, AdGuard Home als <0>DHCP-Server</0> einzurichten. Andernfalls sollten Sie im Handbuch des Routers nachsehen, wie Sie DNS-Server auf Ihrem konkreten Router-Modell anpassen können.",
"install_devices_windows_list_1": "Öffnen Sie die Systemsteuerung über das Startmenü oder die Windows-Suche.",
"install_devices_windows_list_2": "Öffnen Sie die Kategorie „Netzwerk und Internet” und dann „Netzwerk- und Freigabecenter”.",
"install_devices_windows_list_3": "Suchen Sie auf der linken Seite des Bildschirms nach „Adaptereinstellungen ändern” und klicken Sie darauf.",

View File

@@ -58,7 +58,7 @@
"dhcp_warning": "If you want to enable DHCP server anyway, make sure that there is no other active DHCP server in your network, as this may break the Internet connectivity for devices on the network!",
"dhcp_error": "AdGuard Home could not determine if there is another active DHCP server on the network.",
"dhcp_static_ip_error": "In order to use DHCP server a static IP address must be set. AdGuard Home failed to determine if this network interface is configured using a static IP address. Please set a static IP address manually.",
"dhcp_dynamic_ip_found": "Your system uses dynamic IP address configuration for interface <0>{{interfaceName}}</0>. In order to use DHCP server, a static IP address must be set. Your current IP address is <0>{{ipAddress}}</0>. AdGuard Home will automatically set this IP address as static if you press the \"Enable DHCP\" button.",
"dhcp_dynamic_ip_found": "Your system uses dynamic IP address configuration for interface <0>{{interfaceName}}</0>. In order to use DHCP server, a static IP address must be set. Your current IP address is <0>{{ipAddress}}</0>. AdGuard Home will automatically set this IP address as static if you press the \"Enable DHCP server\" button.",
"dhcp_lease_added": "Static lease \"{{key}}\" successfully added",
"dhcp_lease_deleted": "Static lease \"{{key}}\" successfully deleted",
"dhcp_new_static_lease": "New static lease",
@@ -311,7 +311,7 @@
"install_devices_router": "Router",
"install_devices_router_desc": "This setup will automatically cover all the devices connected to your home router and you will not need to configure each of them manually.",
"install_devices_address": "AdGuard Home DNS server is listening on the following addresses",
"install_devices_router_list_1": "Open the preferences for your router. Usually, you can access it from your browser via a URL, such as http://192.168.0.1/ or http://192.168.1.1/. You may be prompted to enter a password. If you don't remember it, you can often reset the password by pressing a button on the router itself, but be aware that if this procedure is chosen, you will probably lose the entire router configuration. Some routers require a specific application, which in that case should be already installed on your computer or phone.",
"install_devices_router_list_1": "Open the preferences for your router. Usually, you can access it from your browser via a URL, such as http://192.168.0.1/ or http://192.168.1.1/. You may be prompted to enter a password. If you don't remember it, you can often reset the password by pressing a button on the router itself, but be aware that if this procedure is chosen, you will probably lose the entire router configuration. If your router requires an app to set it up, please install the app on your phone or PC and use it to access the routers settings.",
"install_devices_router_list_2": "Find the DHCP/DNS settings. Look for the DNS letters next to a field which allows two or three sets of numbers, each broken into four groups of one to three digits.",
"install_devices_router_list_3": "Enter your AdGuard Home server addresses there.",
"install_devices_router_list_4": "On some router types, a custom DNS server cannot be set up. In that case, setting up AdGuard Home as a <0>DHCP server</0> may help. Otherwise, you should check the router manual on how to customize DNS servers on your specific router model.",

View File

@@ -311,7 +311,7 @@
"install_devices_router": "Router",
"install_devices_router_desc": "Esta configuración cubrirá automáticamente todos los dispositivos conectados a tu router doméstico y no necesitarás configurar cada uno de ellos manualmente.",
"install_devices_address": "El servidor DNS de AdGuard Home está escuchando en las siguientes direcciones",
"install_devices_router_list_1": "Abre las preferencias de tu router. Por lo general, puedes acceder a él desde tu navegador a través de una URL como http://192.168.0.1/ o http://192.168.1.1/. Es posible que se te pida que ingreses la contraseña. Si no lo recuerdas, a menudo puedes restablecer la contraseña presionando un botón en el router, pero ten en cuenta que si eliges este procedimiento, probablemente se perderá toda la configuración del router. Algunos routers requieren una aplicación específica, que en ese caso ya debería estar instalada en tu computadora o teléfono.",
"install_devices_router_list_1": "Abre las preferencias de tu router. Por lo general, puedes acceder a él desde tu navegador a través de una URL como http://192.168.0.1/ o http://192.168.1.1/. Es posible que se te pida que ingreses la contraseña. Si no lo recuerdas, a menudo puedes restablecer la contraseña presionando un botón en el router, pero ten en cuenta que si eliges este procedimiento, probablemente se perderá toda la configuración del router. Si tu router requiere una aplicación para configurarlo, instala la aplicación en tu teléfono o PC y utilízala para acceder a la configuración del router.",
"install_devices_router_list_2": "Busca la configuración de DHCP/DNS. Busca las letras DNS junto a un campo que permita ingresar dos o tres grupos de números, cada uno dividido en cuatro grupos de uno a tres dígitos.",
"install_devices_router_list_3": "Ingresa las direcciones de tu servidor AdGuard Home allí.",
"install_devices_router_list_4": "En algunos tipos de router, no se puede configurar un servidor DNS personalizado. En ese caso, configurar AdGuard Home como <0>servidor DHCP</0> puede ayudar. De lo contrario, debes consultar el manual del router para saber cómo personalizar los servidores DNS en tu modelo de router específico.",

View File

@@ -11,8 +11,8 @@
"local_ptr_title": "Serveurs DNS privés",
"local_ptr_desc": "Le serveur ou serveurs DNS qui seront utilisés par AdGuard Home pour les requêtes de ressources servies localement. Ce serveur pourra être utilisé, par exemple, pour résoudre les noms d'hôtes des clients pour les clients avec des adresses IP privées. S'il n'est pas défini, AdGuard Home utilisera votre résolveur DNS par défaut automatiquement.",
"local_ptr_placeholder": "Saisissez une adresse de serveur par ligne",
"resolve_clients_title": "Activer la résolution des noms d'hôtes des clients",
"resolve_clients_desc": "Lorsque activé, AdGuard Home tentera de résoudre automatiquement les noms d'hôtes des clients à partir de leurs adresses IP en envoyant une requête PTR à un résolveur correspondant (serveur DNS privé pour les clients locaux, serveur en amont pour les clients avec une IP publique).",
"resolve_clients_title": "Activer la résolution inverse des adresses IP des clients",
"resolve_clients_desc": "Lorsque activé, AdGuard Home tentera de résoudre de manière inverse les adresses IP des clients en leurs noms d'hôtes en envoyant des requêtes PTR aux résolveurs correspondants (serveurs DNS privés pour les clients locaux, serveur en amont pour les clients ayant des adresses IP publiques).",
"check_dhcp_servers": "Rechercher les serveurs DHCP",
"save_config": "Sauvegarder la configuration",
"enabled_dhcp": "Serveur DHCP activé",
@@ -38,6 +38,7 @@
"form_error_mac_format": "Format MAC invalide",
"form_error_client_id_format": "Format d'ID client non valide",
"form_error_server_name": "Nom de serveur invalide",
"form_error_subnet": "Le sous-réseau \"{{cidr}}\" ne contient pas l'adresse IP \"{{ip}}\"",
"form_error_positive": "Doit être supérieur à 0",
"form_error_negative": "Doit être égal à 0 ou supérieur",
"range_end_error": "Doit être supérieur au début de la gamme",
@@ -57,7 +58,7 @@
"dhcp_warning": "Si vous souhaitez tout de même activer le serveur DHCP, assurez-vous qu'il n'y a pas d'autre serveur DHCP actif sur votre réseau. Sinon, cela peut perturber la connexion Internet sur tous les appareils connectés au réseau !",
"dhcp_error": "AdGuard Home ne peut pas déterminer s'il y a un autre serveur DHCP actif sur le réseau.",
"dhcp_static_ip_error": "Pour utiliser un serveur DHCP, une adresse IP statique est requise. AdGuard Home n'a pas réussi à déterminer si cette interface réseau est configurée via une adresse IP statique. Veuillez définir une adresse IP statique manuellement.",
"dhcp_dynamic_ip_found": "Votre système utilise une configuration d'adresses IP dynamiques pour l'interface <0>{{interfaceName}}</0>. Pour utiliser un serveur DHCP, une adresse IP statique est requise. Votre adresse IP actuelle est <0>{{ipAddress}}</0>. AdGuard Home va automatiquement définir cette adresse IP comme statique si vous appuyez sur le bouton \"Activer DHCP\".",
"dhcp_dynamic_ip_found": "Votre système utilise une configuration d'adresses IP dynamiques pour l'interface <0>{{interfaceName}}</0>. Pour utiliser un serveur DHCP, une adresse IP statique est requise. Votre adresse IP actuelle est <0>{{ipAddress}}</0>. AdGuard Home va automatiquement définir cette adresse IP comme statique si vous appuyez sur le bouton \"Activer le serveur DHCP\".",
"dhcp_lease_added": "\"{{key}}\" de bail statique ajoutée avec succès",
"dhcp_lease_deleted": "\"{{key}}\" de bail statique supprimée avec succès",
"dhcp_new_static_lease": "Nouveau bail statique",
@@ -310,7 +311,7 @@
"install_devices_router": "Routeur",
"install_devices_router_desc": "Cette installation impactera automatiquement tous les appareils connectés au routeur de votre maison et vous n'aurez pas besoin de configurer manuellement chaque appareil.",
"install_devices_address": "Le serveur DNS AdGuard Home écoute sur les adresses suivantes",
"install_devices_router_list_1": "Ouvrez les préférences de votre routeur. Habituellement, vous pouvez y accéder depuis votre navigateur web via une URL comme http://192.168.0.1/ ou http://192.168.1.1/. Vous devrez probablement saisir le mot de passe. Si vous ne vous en rappelez pas, vous pouvez normalement le réinitialiser en appuyant sur le bouton du routeur, mais attention, si vous choisissez cette voie de procéder, vous pouvez perdre vos configurations du routeur. Certains routeurs requièrent une application spécifique, qui devrait être déjà installée sur votre ordinateur/téléphone.",
"install_devices_router_list_1": "Ouvrez les préférences de votre routeur. Normalement vous pouvez y accéder depuis votre navigateur web via une URL du type http://192.168.0.1/ ou http://192.168.1.1/. Vous devrez peut-être renseigner le mot de passe. Si vous ne vous en rappelez pas, vous pouvez normalement le réinitialiser en appuyant sur le bouton du routeur, mais attention : si vous choisissez cette procédure, toute la configuration de votre routeur sera probablement perdue. Si votre routeur requière une application spécifique, installez-la sur votre ordinateur/téléphone et utilisez-la pour accéder aux paramètres du routeur.",
"install_devices_router_list_2": "Trouvez les paramètres DHCP/DNS. Recherchez les lettres DNS près d'une zone qui permet la saisie de 2 ou 3 blocs de chiffres, chacun composé de 4 parties de 1 à 3 chiffres.",
"install_devices_router_list_3": "Saisissez vos adresses de serveur AdGuard Home ici.",
"install_devices_router_list_4": "Vous ne pouvez pas définir un serveur DNS personnalisé sur certains types de routeurs. Dans ce cas, la configuration de AdGuard Home en tant que <0>serveur DHCP</0> peut aider. Sinon, vous devez rechercher le manuel sur la façon de personnaliser les serveurs DNS pour votre modèle de routeur particulier.",
@@ -400,6 +401,7 @@
"ip_address": "Adresse IP",
"client_identifier_desc": "Les clients peuvent être identifiés par les adresses IP, CIDR, MAC ou un ID client spécial (qui peut être utilisé pour DoT/DoH/DoQ). Vous trouverez plus d'information sur l'identification des clients <0>ici</0> .",
"form_enter_ip": "Saisissez l'IP",
"form_enter_subnet_ip": "Saisissez une adresse IP dans le sous-réseau \"{{cidr}}\"",
"form_enter_mac": "Saisissez MAC",
"form_enter_id": "Entrer identifiant",
"form_add_id": "Ajouter identifiant",

View File

@@ -8,6 +8,8 @@
"load_balancing_desc": "Egyszerre csak egy szerverről történjen lekérdezés. Az AdGuard Home egy súlyozott, véletlenszerű algoritmust fog használni a megfelelő szerver kiválasztására, így a leggyorsabb szervert gyakrabban fogja használni.",
"bootstrap_dns": "Bootstrap DNS kiszolgálók",
"bootstrap_dns_desc": "A Bootstrap DNS szerverek a DoH/DoT feloldók IP-címeinek feloldására szolgálnak.",
"local_ptr_title": "Privát DNS szerverek",
"local_ptr_placeholder": "Adjon meg soronként egy kiszolgáló címet",
"check_dhcp_servers": "DHCP szerverek keresése",
"save_config": "Konfiguráció mentése",
"enabled_dhcp": "DHCP szerver engedélyezve",

View File

@@ -58,7 +58,7 @@
"dhcp_warning": "Se desideri attivare il server DHCP integrato, assicurati che non vi siano altri server DHCP attivi, ciò potrebbe causare problemi di connessione alla rete per i dispositivi collegati!",
"dhcp_error": "AdGuard Home non può determinare se è presente un altro server DHCP attivo nella rete.",
"dhcp_static_ip_error": "Per utilizzare il server DHCP è necessario impostare un indirizzo IP statico. AdGuard Home non è riuscito a determinare se questa interfaccia di rete è configurata utilizzando un indirizzo IP statico. Ti preghiamo di impostare manualmente un indirizzo IP statico.",
"dhcp_dynamic_ip_found": "Il tuo sistema utilizza una configurazione di indirizzi IP dinamici per l\\'interfaccia <0>{{interfaceName}}</0>. Per utilizzare un server DHCP, è necessario impostare un indirizzo IP statico. Il tuo indirizzo IP attuale è <0>{{ipAddress}}</0>. AdGuard Home imposterà automaticamente questo indirizzo come statico quando cliccherai il pulsante \"Attiva DHCP\".",
"dhcp_dynamic_ip_found": "Il tuo sistema utilizza una configurazione di indirizzi IP dinamici per l\\'interfaccia <0>{{interfaceName}}</0>. Per poter utilizzare un server DHCP, è necessario impostare un indirizzo IP statico. Il tuo indirizzo IP attuale è <0>{{ipAddress}}</0>. AdGuard Home imposterà automaticamente questo indirizzo come statico quando cliccherai il pulsante \"Attiva server DHCP\".",
"dhcp_lease_added": "Lease statici \"{{key}}\" aggiunti correttamente",
"dhcp_lease_deleted": "Lease statico \"{{key}}\" eliminato correttamente",
"dhcp_new_static_lease": "Nuovo lease statico",
@@ -311,7 +311,7 @@
"install_devices_router": "Router",
"install_devices_router_desc": "Questa configurazione coprirà automaticamente tutti i dispositivi collegati al router di casa e non sarà necessario configurarli manualmente.",
"install_devices_address": "Il server DNS di AdGuard Home sta ascoltando sui seguenti indirizzi",
"install_devices_router_list_1": "Accedi alle preferenze del tuo router. Di solito, puoi accedervi dal tuo browser tramite un URL, come http://192.168.0.1/ o http://192.168.1.1/. Potrebbe essere richiesto l\\'inserimento di una password. Se non dovessi ricordarla, puoi spesso reimpostare la password premendo un pulsante sul router stesso, ma tieni presente che scegliendo questa procedura, probabilmente perderai l\\'intera configurazione del router. Alcuni router richiedono un\\'applicazione specifica, che in tal caso dovrebbe essere già installata sul computer o sul telefono.",
"install_devices_router_list_1": "Accedi alle preferenze del tuo router. Di solito, puoi farlo dal tuo browser tramite un URL, come http://192.168.0.1/ o http://192.168.1.1/. Potrebbe esserti chiesto di inserire una password. Se non dovessi ricordarla, puoi reimpostare la password premendo un pulsante presente sullo stesso router, ma tieni presente che scegliendo questa procedura, probabilmente perderai l\\'intera configurazione del router. Se il tuo router necessitasse di un\\'app per configurarlo, installala sul tuo telefono o PC e utilizzala per accedere alle impostazioni del router.",
"install_devices_router_list_2": "Trova le impostazioni DHCP / DNS. Cerca le lettere DNS accanto a un campo che consente due o tre serie di numeri, ciascuno suddiviso in quattro gruppi di 1-3 cifre.",
"install_devices_router_list_3": "Inserisci qui gli indirizzi del tuo server AdGuard Home.",
"install_devices_router_list_4": "Su alcuni tipi di router, non è possibile configurare un server DNS personalizzato. In tal caso, configurare AdGuard Home come un <0>server DHCP</0> potrebbe aiutare. In alternativa, dovresti leggere il manuale di istruzioni per capire come personalizzare i server DNS sul tuo specifico modello di router.",

View File

@@ -58,7 +58,7 @@
"dhcp_warning": "ともかくDHCPサーバを有効にしたい場合は、ネットワーク内で他に稼働中のDHCPサーバがないことを確認してください。そうでなければ、ネットワーク上デバイスでインターネット接続を壊してしまう可能性があります",
"dhcp_error": "ネットワーク上に別の稼働中DHCPサーバがあるかどうか、AdGuard Homeは判断できませんでした。",
"dhcp_static_ip_error": "DHCPサーバーを使用するには、静的IPアドレスを設定する必要があります。このネットワークインターフェースが静的IPアドレスを使用するように設定されているかどうかを、AdGuard Homeは判断できませんでした。手動で静的IPアドレスを設定してください。",
"dhcp_dynamic_ip_found": "お使いのシステムは、インターフェース<0>{{interfaceName}}</0>に動的IPアドレス構成を使用しています。DHCPサーバを使用するには、静的IPアドレス設定する必要があります。あなたの現在のIPアドレスは<0>{{ipAddress}}</0>です。「DHCPサーバを有効にする」ボタンを押すと、AdGuard HomeはこのIPアドレスを静的IPアドレスに自動設定します。",
"dhcp_dynamic_ip_found": "お使いのシステムは、インターフェース<0>{{interfaceName}}</0>に動的IPアドレス構成を使用しています。DHCPサーバを使用するには、静的IPアドレス設定する必要があります。あなたの現在のIPアドレスは<0>{{ipAddress}}</0>です。「DHCPサーバを有効にする」ボタンを押すと、AdGuard Homeは自動的にこのIPアドレスを静的IPアドレスとして設定します。",
"dhcp_lease_added": "静的割り当て \"{{key}}\" の追加に成功しました",
"dhcp_lease_deleted": "静的割り当て \"{{key}}\" の削除に成功しました",
"dhcp_new_static_lease": "新規静的割り当て",
@@ -311,7 +311,7 @@
"install_devices_router": "ルータ",
"install_devices_router_desc": "この設定では、ルータに接続されているすべてのデバイスを自動的にカバーしますので、各デバイスを手動で設定する必要はありません。",
"install_devices_address": "AdGuard HomeのDNSサーバは次のアドレスで待ち受けています",
"install_devices_router_list_1": "ルーターの設定を開きます通常、URLの http://192.168.0.1/ または http://192.168.1.1/ などをしてブラウザからアクセスできます)。\nパスワードの入力を求められることがあります。パスワードを覚えていない場合は、ルータにあるボタンを押してパスワードをリセットできます※この場合、ルーターで設定されている構成が初期化される可能性が高いのでご注意ください。\n一部のルータは特定のアプリケーションを必要とします。その場合、アプリケーションはお使いのコンピュータ/スマホに既にインストールされているはずです。",
"install_devices_router_list_1": "ルーターの設定を開きます通常、URLの http://192.168.0.1/ または http://192.168.1.1/ などを入力してブラウザからアクセスできます)。\nパスワードの入力を求められることがあります。パスワードを覚えていない場合は、ルータにあるボタンを押してパスワードをリセットできます※この場合、ルーターで設定されている構成が初期化される可能性が高いのでご注意ください。\n一部のルーターは設定用アプリを必要とします。その場合、設定用アプリをお使いのコンピュータ/スマホにインストールして、そのアプリからルーターの設定にアクセスしてください。",
"install_devices_router_list_2": "DHCPDNSの設定を見つけます。DNSの文字のある入力欄を探します。それは、1〜3桁の数字で4つのグループに分けられた入力欄で、セットを許可されている欄です。",
"install_devices_router_list_3": "そこにAdGuard Homeサーバのアドレスを入力します。",
"install_devices_router_list_4": "一部のルーターでは、カスタムDNSサーバーを設定できません。この場合、AdGuard Homeを<0>DHCPサーバ</0>として設定してみることがおすすめです。それ以外の場合は、特定のルータモデルにおいて、DNSサーバーをカスタマイズする方法に関するマニュアル等をご確認ください。",

View File

@@ -1,13 +1,20 @@
{
"client_settings": "클라이언트 설정",
"example_upstream_reserved": "<0>특정 도메인에 대한</0> DNS 업스트림을 지정할 수 있습니다.",
"example_upstream_comment": "설명을 맞춤 지정할 수 있습니다.",
"upstream_parallel": "쿼리 처리 속도를 높이려면 모든 업스트림 서버에서 동시에 병렬 쿼리를 사용해주세요.",
"parallel_requests": "병렬 처리 요청",
"load_balancing": "로드 밸런싱",
"load_balancing_desc": "한 번에 하나의 서버씩 질의합니다. AdGuard Home은 가중 랜덤 알고리즘를 사용해서 가장 빠른 서버가 자주 사용되도록 서버를 선택합니다.",
"bootstrap_dns": "부트스트랩 DNS 서버",
"bootstrap_dns_desc": "부트스트랩 DNS 서버는 업스트림으로 지정한 DoH/DoT 서버의 IP 주소를 확인하는 데 사용합니다.",
"local_ptr_title": "프라이빗 DNS 서버",
"local_ptr_desc": "AdGuard Home이 로컬 리소스에 대한 쿼리에 사용할 DNS 서버입니다. 예를 들어, 사설 IP 주소가 있는 클라이언트의 호스트명을 확인할 때 사용합니다. 설정하지 않으면 기본으로 설정된 DNS 서버를 사용합니다.",
"local_ptr_placeholder": "한 줄에 하나씩 서버 주소 입력",
"resolve_clients_title": "클라이언트 IP 주소에 대한 호스트명 확인 활성화",
"resolve_clients_desc": "활성화된 경우 AdGuard Home은 PTR 쿼리를 해당 서버(로컬 클라이언트의 경우 프라이빗 DNS 서버, 공용 IP 주소가 있는 클라이언트의 경우 업스트림 서버)로 전송하여 IP 주소로부터 클라이언트의 호스트명을 역으로 확인하려고 시도합니다.",
"check_dhcp_servers": "DHCP 서버 체크",
"save_config": "구성 저장",
"enabled_dhcp": "DHCP 서버 활성화됨",
"disabled_dhcp": "DHCP 서버 비활성화됨",
"unavailable_dhcp": "DHCP가 사용 불가능합니다.",
@@ -16,10 +23,12 @@
"dhcp_description": "라우터가 DHCP 설정을 제공하지 않으면 AdGuard의 자체 기본 제공 DHCP 서버를 사용할 수 있습니다.",
"dhcp_enable": "DHCP 서버 활성화",
"dhcp_disable": "DHCP 서버 비활성화",
"dhcp_not_found": "AdGuard Home이 네트워크에서 활성 DHCP 서버를 찾지 못했기 때문에 DHCP 서버를 활성화하는 것이 안전합니다. 하지만 자동 검색이 100% 보장을 제공하지 않으므로 수동으로 다시 확인해 보세요.",
"dhcp_found": "네트워크에 활성 DHCP 서버가 있습니다. 기본 제공 DHCP 서버를 활성화하는 것은 안전하지 않습니다.",
"dhcp_leases": "DHCP 임대",
"dhcp_static_leases": "DHCP 고정 임대",
"dhcp_leases_not_found": "DHCP 임대를 찾을 수 없음",
"dhcp_config_saved": "DHCP 구성이 성공적으로 저장되었습니다",
"dhcp_ipv4_settings": "DHCP IPv4 설정",
"dhcp_ipv6_settings": "DHCP IPv6 설정",
"form_error_required": "필수 필드",
@@ -29,6 +38,7 @@
"form_error_mac_format": "잘못된 MAC 형식",
"form_error_client_id_format": "잘못된 클라이언트 ID 형식",
"form_error_server_name": "유효하지 않은 서버 이름입니다",
"form_error_subnet": "서브넷 \"{{cidr}}\"에 \"{{ip}}\" IP 주소가 없습니다",
"form_error_positive": "0보다 커야 합니다",
"form_error_negative": "반드시 0 이상이여야 합니다",
"range_end_error": "입력 값은 범위의 시작 지점보다 큰 값 이여야 합니다.",
@@ -45,11 +55,16 @@
"ip": "IP",
"dhcp_table_hostname": "호스트 이름",
"dhcp_table_expires": "만료",
"dhcp_warning": "DHCP 서버를 사용하려면 네트워크에 다른 활성화된 DHCP 서버가 없는지 확인해 주세요. 다른 활성 DHCP 서버가 있다면, 연결된 장치의 인터넷이 끊길 수 있습니다.",
"dhcp_error": "AdGuard Home이 네트워크에 다른 활성 DHCP 서버가 있는지 확인할 수 없습니다.",
"dhcp_static_ip_error": "DHCP 서버를 사용하려면 고정 IP 주소를 설정해야 합니다. AdGuard Home이 이 네트워크 인터페이스가 고정 IP 주소를 사용하는지 확인할 수 없습니다. 고정 IP 주소를 수동으로 설정하십시오.",
"dhcp_dynamic_ip_found": "시스템은 <0>{{interfaceName}}</0> 인터페이스에 동적 IP 주소를 사용합니다. DHCP 서버를 사용하려면 고정 IP 주소를 설정해야 합니다. 현재 IP 주소는 <0>{{ipAddress}}</0>입니다. 'DHCP 서버 활성화' 버튼을 누르면 AdGuard Home이 이 IP 주소를 고정 IP 주소로 자동 설정합니다.",
"dhcp_lease_added": "\"{{key}}\" 고정 임대 정상적으로 추가되었습니다",
"dhcp_lease_deleted": "\"{{key}}\" 고정 임대 정상적으로 삭제되었습니다",
"dhcp_new_static_lease": "새 고정 임대",
"dhcp_static_leases_not_found": "DHCP 고정 임대를 찾을 수 없음",
"dhcp_add_static_lease": "고정 임대 추가",
"dhcp_reset": "정말로 DHCP 설정을 초기화할까요?",
"country": "지역",
"city": "도시",
"delete_confirm": "\"{{key}}\"을 삭제하시겠습니까?",
@@ -96,7 +111,14 @@
"top_clients": "클라이언트",
"no_clients_found": "클라이언트가 없습니다",
"general_statistics": "일반 통계",
"number_of_dns_query_days": "최근 {{count}}일 동안 처리된 DNS 쿼리의 수",
"number_of_dns_query_days_plural": "최근 {{count}}일 동안 처리된 DNS 쿼리의 수",
"number_of_dns_query_24_hours": "최근 24시간 동안 처리된 DNS 쿼리의 수",
"number_of_dns_query_blocked_24_hours": "광고 차단 필터 및 호스트 차단 목록에 의해 차단된 DNS 요청 수",
"number_of_dns_query_blocked_24_hours_by_sec": "AdGuard 브라우징 보안 모듈에 의해 차단된 DNS 요청 수",
"number_of_dns_query_blocked_24_hours_adult": "차단된 성인 웹 사이트의 수",
"enforced_save_search": "세이프 서치 강제",
"number_of_dns_query_to_safe_search": "세이프서치가 적용된 검색 엔진에 대해 DNS 요청 수",
"average_processing_time": "평균처리 시간",
"average_processing_time_hint": "DNS 요청 처리시 평균 시간(밀리초)",
"block_domain_use_filters_and_hosts": "필터 및 호스트 파일을 사용하여 도메인 차단",
@@ -106,6 +128,7 @@
"use_adguard_parental": "AdGuard 자녀 보호 웹 서비스 사용",
"use_adguard_parental_hint": "AdGuard Home은 도메인에 성인 자료가 포함되어 있는지 확인합니다. 브라우징 보안 웹 서비스와 동일한 개인정보 보호 API를 사용함.",
"enforce_safe_search": "세이프서치 강제",
"enforce_save_search_hint": "AdGuard Home이 Google, YouTube, Bing, DuckDuckGo, Yandex, Pixabay와 같은 검색 엔진에서 안전 검색을 시행할 수 있습니다.",
"no_servers_specified": "지정된 서버 없음",
"general_settings": "일반 설정",
"dns_settings": "DNS 설정",
@@ -246,6 +269,7 @@
"rate_limit": "한도 제한",
"edns_enable": "EDNS 클라이언트 서브넷 활성화",
"edns_cs_desc": "활성화되면 AdGuard Home은 클라이언트의 서브넷을 DNS 서버에 전달합니다.",
"rate_limit_desc": "단일 클라이언트에서 허용 가능한 초 당 요청 생성 숫자 (0: 무제한)",
"blocking_ipv4_desc": "차단된 A 요청에 대해서 반환할 IP 주소",
"blocking_ipv6_desc": "차단된 AAAA 요청에 대해서 반환할 IP 주소",
"blocking_mode_default": "기본: Adblock 스타일 규칙에 의해 차단되면 제로 IP 주소(A는 0.0.0.0; AAAA는 ::)로 응답합니다; /etc/hosts 스타일 규칙에 의해 차단되면 규칙에 정의된 IP 주소로 응답합니다",
@@ -268,6 +292,7 @@
"install_settings_listen": "네트워크 인터페이스",
"install_settings_port": "포트",
"install_settings_interface_link": "AdGuard Home 관리자 웹 인터페이스는 다음 주소로 제공됨:",
"form_error_port": "유효한 포트 번호를 입력하십시오",
"install_settings_dns": "DNS 서버",
"install_settings_dns_desc": "다음 주소의 DNS 서버를 사용하도록 장치 또는 라우터를 구성해야 합니다.",
"install_settings_all_interfaces": "모든 인터페이스",
@@ -286,8 +311,10 @@
"install_devices_router": "라우터",
"install_devices_router_desc": "이 설정은 이제 자동으로 당신의 집의 라우터에 연결된 모든 기기에 적용될 것이기에 수동으로 각각의 기기를 설정해줄 필요가 없습니다.",
"install_devices_address": "AdGuard Home DNS 서버는 다음의 주소를 받고 있습니다.",
"install_devices_router_list_1": "라우터의 환경 설정을 여세요. 환경 설정은 다음의 주소(http://192.168.0.1/ 혹은 http://192.168.1.1/)를 통해 브라우저로 접근 가능합니다. 비밀번호를 입력해야할 수 있습니다. 비밀번호를 잊었다면 라우터 기기에 있는 버튼을 눌러 비밀번호를 초기화할 수 있지만 라우터 구성이 손실될 수 있습니다. 라우터 설정에 앱이 필요한 경우, 휴대폰이나 컴퓨터에 앱을 설치하고 이를 사용하여 라우터 설정에 액세스하세요.",
"install_devices_router_list_2": "각각 1~3자리 숫자의 네 그룹으로 분할된 두 세트의 숫자를 허용하는 필드 옆에 있는 DNS 문자를 찾으세요.",
"install_devices_router_list_3": "AdGuard Home 서버 주소를 입력하세요",
"install_devices_router_list_4": "일부 라우터 유형에서는 사용자 정의 DNS 서버를 설정할 수 없습니다. 이 경우에는 AdGuard Home을 <0>DHCP 서버</0>로 설정할 수 있습니다. 그렇지 않으면 특정 라우터 모델에 맞게 DNS 서버를 설정하는 방법을 찾아야 합니다.",
"install_devices_windows_list_1": "시작 메뉴 또는 윈도우 검색을 통해 제어판을 여세요",
"install_devices_windows_list_2": "네트워크 및 인터넷 카테고리로 이동한 다음 네트워크 및 공유 센터로 이동하세요.",
"install_devices_windows_list_3": "화면 왼쪽에서 어댑터 설정 변경을 찾아 클릭하세요.",
@@ -313,6 +340,7 @@
"install_saved": "성공적으로 저장되었습니다",
"encryption_title": "암호화",
"encryption_desc": "DNS 및 관리자 웹 인터페이스에 대한 암호화 (HTTPS/TLS) 지원입니다.",
"encryption_config_saved": "암호화 구성이 저장되었습니다",
"encryption_server": "서버 이름",
"encryption_server_enter": "도메인 이름을 입력하세요.",
"encryption_server_desc": "HTTPS를 사용하려면 SSL 인증서와 일치하는 서버 이름을 입력해야 합니다.",
@@ -343,10 +371,13 @@
"encryption_reset": "암호화 설정을 재설정하시겠습니까?",
"topline_expiring_certificate": "SSL 인증서가 곧 만료됩니다. 업데이트<0> 암호화 설정</0>.",
"topline_expired_certificate": "SSL 인증서가 만료되었습니다. 업데이트<0> 암호화 설정</0>.",
"form_error_port_range": "80-65535 범위의 포트 번호를 입력하십시오",
"form_error_port_unsafe": "안전하지 않은 포트입니다",
"form_error_equal": "동일하지 않아야 함",
"form_error_password": "비밀번호 불일치",
"reset_settings": "설정 초기화",
"update_announcement": "AdGuard Home {{version}} 사용 가능합니다! <0>이곳</0>을 클릭하여 더 많은 정보를 확인하세요.",
"setup_guide": "설치 안내",
"dns_addresses": "DNS 주소",
"dns_start": "DNS 서버를 시작하고 있습니다",
"dns_status_error": "DNS 서버 상태를 가져오는 도중 오류가 발생했습니다",
@@ -370,6 +401,7 @@
"ip_address": "IP 주소",
"client_identifier_desc": "클라이언트는 IP 주소, CIDR, MAC 주소 또는 특수 클라이언트 ID로 식별할 수 있습니다 (DoT/DoH/DoQ에 사용 가능). <0>여기에서</0> 클라이언트를 식별하는 방법에 대한 자세한 내용은 확인하실 수 있습니다.",
"form_enter_ip": "IP 입력",
"form_enter_subnet_ip": "서브넷 \"{{cidr}}\" 내의 IP 주소 입력",
"form_enter_mac": "MAC 입력",
"form_enter_id": "식별자 입력",
"form_add_id": "식별자 추가",
@@ -391,6 +423,7 @@
"access_disallowed_title": "차단된 클라이언트",
"access_disallowed_desc": "CIDR 또는 IP 주소 목록입니다. 구성된 경우 AdGuard Home은 이러한 IP 주소의 요청을 삭제합니다.",
"access_blocked_title": "차단된 도메인",
"access_blocked_desc": "이 기능을 필터와 혼동하지 마세요. AdGuard Home은 이러한 도메인에 대한 DNS 요청을 무시합니다. 여기서 특정 도메인을 지정하거나, 와일드 카드 또는 URL 필터 규칙을 설정해 보세요. 예) 'example.org', '*.example.org' 또는 '||example.org^'.",
"access_settings_saved": "액세스 설정이 성공적으로 저장되었습니다.",
"updates_checked": "업데이트가 성공적으로 확인되었습니다",
"updates_version_equal": "AdGuard Home 최신 상태입니다.",
@@ -493,6 +526,7 @@
"disable_ipv6": "IPv6 비활성화",
"disable_ipv6_desc": "이 기능이 활성화되면 IPv6 (타입 AAAA) 의 모든 DNS 쿼리가 드랍됩니다.",
"fastest_addr": "가장 빠른 IP 주소",
"fastest_addr_desc": "반응이 가장 빠른 IP주소를 가진 DNS서버에 쿼리를 수행합니다. AdGuard Home이 모든 DNS 서버의 응답을 기다려야하기 때문에 DNS 쿼리 속도가 느려지지만 전반적인 연결이 향상됩니다.",
"autofix_warning_text": "\"Fix\"를 클릭한다면 AdGuard Home은 시스템이 AdGuard Home의 DNS 서버를 사용하도록 설정합니다.",
"autofix_warning_list": "다음 작업을 진행합니다: <0>DNSStubListener 시스템 비활성화</0> <0>DNS 서버 주소를 127.0.0.1로 설정</0> <0>/etc/resolv.conf의 심볼릭 링크 타겟을 /run/systemd/resolve/resolv.conf로 변경</0> <0>DNSStubListener 중지 (systemd-resolved 서비스 새로고침)</0>",
"autofix_warning_result": "결과적으로 시스템의 모든 DNS 요청은 기본적으로 AdGuard Home에 의해 처리됩니다.",
@@ -522,6 +556,7 @@
"set_static_ip": "고정 IP 주소 설정",
"install_static_ok": "좋은 소식입니다! 고정 IP 주소가 이미 설정되어있네요",
"install_static_error": "AdGuard Home는 이 네트워크 인터페이스에서 자동 설정할 수 없습니다. 여기에서 어떻게 이걸 수동으로 할 수 있는지 확인해주세요.",
"install_static_configure": "AdGuard Home이 동적 IP 주소를 사용하는 것을 감지했습니다 - <0>{{ip}}</0>. 정말로 이걸 고정 IP로 사용하시겠습니까?",
"confirm_static_ip": "AdGuard Home이 {{ip}}를 고정 IP 주소로 설정하려고 합니다. 계속하시겠습니까?",
"list_updated": "{{count}} 리스트 업데이트됨",
"list_updated_plural": "{{count}} 리스트 업데이트됨",
@@ -559,6 +594,7 @@
"filter_category_security_desc": "멀웨어, 피싱 또는 사기 도메인을 차단하는 목록",
"filter_category_regional_desc": "지역 광고 및 추적 서버에 중점을 둔 목록",
"filter_category_other_desc": "기타 차단 목록",
"setup_config_to_enable_dhcp_server": "DHCP 서버를 활성화하기 위한 설정 구성",
"original_response": "원래 응답",
"click_to_view_queries": "쿼리를 보려면 클릭합니다",
"port_53_faq_link": "53번 포트는 보통 \"DNSStubListener\"나 \"systemd-resolved\" 서비스가 이미 사용하고 있습니다. 이 문제에 대한 해결 방법을 <0>설명</0>에서 찾아보세요.",

View File

@@ -9,10 +9,10 @@
"bootstrap_dns": "Bootstrap DNS-servers",
"bootstrap_dns_desc": "Bootstrap DNS-servers worden gebruikt om IP-adressen op te lossen van de DoH / DoT-resolvers die u opgeeft als upstreams.",
"local_ptr_title": "Private DNS-servers",
"local_ptr_desc": "De DNS-server of -servers die AdGuard Home zal gebruiken voor zoekopdrachten naar lokaal aangeboden bronnen. Deze server zal bijvoorbeeld worden gebruikt om de hostnamen van de clients op te lossen voor de clients met private IP-adressen. Indien niet ingesteld, gebruikt AdGuard Home automatisch je standaard DNS-resolver.",
"local_ptr_desc": "De DNS-servers die AdGuard Home zal gebruiken voor zoekopdrachten naar lokaal aangeboden bronnen. Deze server zal bijvoorbeeld worden gebruikt om de hostnamen van de clients op te lossen voor de clients met private IP-adressen. Indien niet ingesteld, gebruikt AdGuard Home automatisch je standaard DNS-resolver.",
"local_ptr_placeholder": "Voer één serveradres per regel in",
"resolve_clients_title": "Omzetten van hostnamen van clients inschakelen",
"resolve_clients_desc": "Indien ingeschakeld, zal AdGuard Home proberen om de hostnamen van clients automatisch op te lossen vanaf hun IP-adressen door een PTR-query te sturen naar een overeenkomstige resolver (privé-DNS-server voor lokale clients, upstream-server voor clients met openbaar IP-adres).",
"resolve_clients_desc": "Indien ingeschakeld, zal AdGuard Home proberen om IP-adressen van apparaten te converteren in hun hostnamen door PTR-verzoeken te sturen naar overeenkomstige resolvers (privé-DNS-servers voor lokale apparaten, upstream-server voor apparaten met een openbaar IP-adres).",
"check_dhcp_servers": "Zoek achter DHCP servers",
"save_config": "Configuratie opslaan",
"enabled_dhcp": "DHCP server inschakelen",
@@ -58,7 +58,7 @@
"dhcp_warning": "Indien je de ingebouwde DHCP server wilt inschakelen, let dan op dat er geen andere actieve DHCP server aanwezig is in je netwerk. Dit kan de internetverbinding instabiel maken voor sommige apparaten in je netwerk!",
"dhcp_error": "AdGuard Home kon niet bepalen of er een andere actieve DHCP server in je netwerk aanwezig is.",
"dhcp_static_ip_error": "Om de DHCP server te gebruiken, moet een statisch IP-adres worden ingesteld. AdGuard Home heeft niet kunnen vaststellen of de netwerkinterface is geconfigureerd met een statisch IP-adres. Stel handmatig een statisch IP-adres in.",
"dhcp_dynamic_ip_found": "Je systeem gebruikt dynamische IP-adres configuratie voor interface <0>{{interfaceName}}</0>. Om de DHCP server te gebruiken moet er een statisch IP-adres worden ingesteld. Je huidige IP-adres is <0>{{ipAddress}}</0>. AdGuard Home zal automatisch dit IP-adres als statisch IP-adres instellen wanneer je op de knop DHCP inschakelen drukt.",
"dhcp_dynamic_ip_found": "Je systeem gebruikt dynamische IP-adres configuratie voor interface <0>{{interfaceName}}</0>. Om de DHCP server te gebruiken moet er een statisch IP-adres worden ingesteld. Je huidige IP-adres is <0>{{ipAddress}}</0>. AdGuard Home zal automatisch dit IP-adres als statisch IP-adres instellen wanneer je op de knop \"DHCP inschakelen\" drukt.",
"dhcp_lease_added": "Statische uitgifte \"{{key}}\" met succes toegevoegd",
"dhcp_lease_deleted": "Statische uitgifte \"{{key}}\" met succes verwijderd",
"dhcp_new_static_lease": "Voeg static lease toe",
@@ -311,7 +311,7 @@
"install_devices_router": "Router",
"install_devices_router_desc": "Deze setup zal automatisch alle apparaten die op uw thuisrouter zijn aangesloten dekken en u hoeft ze niet allemaal handmatig te configureren.",
"install_devices_address": "AdGuard Home DNS-server luistert naar de volgende adressen",
"install_devices_router_list_1": "Open de instellingen van jouw router. Meestal kan je deze vanuit jouw browser openen via een URL (zoals http://192.168.0.1/ of http://192.168.1.1/). Mogelijk wordt er gevraagd om een wachtwoord in te voeren. Als je het niet meer weet, kan je het wachtwoord vaak opnieuw instellen door op een knop op de router zelf te drukken, maar weet wel dat je dan de volledige routerconfiguratie kwijt bent (terug naar fabrieksinstellingen). Voor sommige routers is een specifieke toepassing/app vereist, die in dat geval op jouw computer/smartphone/tablet moet geïnstalleerd zijn.",
"install_devices_router_list_1": "Open de instellingen van jouw router. Meestal kan je deze vanuit jouw browser openen via een URL, zoals http://192.168.0.1/ of http://192.168.1.1/. Mogelijk wordt er gevraagd om een wachtwoord in te voeren. Als je het niet meer weet, kan je het wachtwoord vaak opnieuw instellen door op een knop op de router zelf te drukken, maar weet wel dat je dan de volledige routerconfiguratie kwijt bent (terug naar fabrieksinstellingen). Voor sommige routers is een specifieke toepassing/app vereist, die in dat geval op jouw computer/smartphone/tablet moet geïnstalleerd zijn.",
"install_devices_router_list_2": "Zoek de DHCP/DNS-instellingen. Zoek naar de DNS-letters naast een veld dat twee of drie reeksen nummers toestaat, elk verdeeld in vier groepen van één tot drie cijfers.",
"install_devices_router_list_3": "Voer je AdGuard Home server adressen daar in.",
"install_devices_router_list_4": "Je kan een DNS-server niet instellen op sommige routers. In dat geval kan het een oplossing zijn om AdGuard Home te definiëren als een <0>DHCP-server</0>. Je kan ook in de handleiding van je router kijken hoe je een DNS-server aanpast.",

View File

@@ -58,7 +58,7 @@
"dhcp_warning": "Jeśli mimo wszystko chcesz włączyć serwer DHCP, upewnij się, że w Twojej sieci nie ma innego aktywnego serwera DHCP, ponieważ może to spowodować przerwanie łączności z Internetem dla urządzeń w sieci!",
"dhcp_error": "AdGuard Home nie mógł określić, czy w sieci jest inny aktywny serwer DHCP.",
"dhcp_static_ip_error": "Aby korzystać z serwera DHCP musi być ustawiony statyczny adres IP. AdGuard Home nie udało się ustalić, czy ten interfejs sieciowy jest skonfigurowany przy użyciu statycznego adresu IP. Proszę ustawić statyczny adres IP ręcznie.",
"dhcp_dynamic_ip_found": "Twój system używa dynamicznej konfiguracji adresu IP dla interfejsu <0>{{interfaceName}}</0>. Aby można było korzystać z serwera DHCP, należy ustawić statyczny adres IP. Twój obecny adres IP to <0>{{ipAddress}}</0>. AdGuard Home automatycznie ustawi ten adres IP jako statyczny, jeśli naciśniesz przycisk \"Włącz DHCP\".",
"dhcp_dynamic_ip_found": "Twój system używa dynamicznej konfiguracji adresu IP dla interfejsu <0>{{interfaceName}}</0>. Aby można było korzystać z serwera DHCP, należy ustawić statyczny adres IP. Twój obecny adres IP to <0>{{ipAddress}}</0>. AdGuard Home automatycznie ustawi ten adres IP jako statyczny, jeśli naciśniesz przycisk \"Włącz serwer DHCP\".",
"dhcp_lease_added": "Dzierżawa statyczna \"{{key}}\" pomyślnie dodana",
"dhcp_lease_deleted": "Dzierżawa statyczna \"{{key}}\" pomyślnie usunięta",
"dhcp_new_static_lease": "Nowa dzierżawa statyczna",
@@ -311,7 +311,7 @@
"install_devices_router": "Router",
"install_devices_router_desc": "To ustawienie automatycznie obejmuje wszystkie urządzenia podłączone do routera domowego i nie trzeba ich konfigurować ręcznie.",
"install_devices_address": "Serwer DNS AdGuard Home używa następujących adresów",
"install_devices_router_list_1": "Otwórz preferencje routera. Zazwyczaj można uzyskać do nich dostęp z przeglądarki za pośrednictwem adresu URL, takiego jak http://192.168.0.1/ lub http://192.168.1.1/. Możesz zostać poproszony o podanie hasła. Jeśli go nie pamiętasz, często możesz zresetować hasło, naciskając przycisk na samym routerze, ale pamiętaj, że jeśli ta procedura zostanie wybrana, prawdopodobnie stracisz całą konfigurację routera. Niektóre routery wymagają specjalnej aplikacji, która w takim przypadku powinna być już zainstalowana na komputerze lub telefonie.",
"install_devices_router_list_1": "Otwórz preferencje routera. Zazwyczaj można uzyskać do nich dostęp z przeglądarki za pośrednictwem adresu URL, takiego jak http://192.168.0.1/ lub http://192.168.1.1/. Możesz zostać poproszony o podanie hasła. Jeśli go nie pamiętasz, często można zresetować hasło przez naciśnięcie przycisku na samym routerze, ale należy pamiętać, że jeśli ta procedura jest wybrana, prawdopodobnie stracisz całą konfigurację routera. Jeśli Twój router wymaga aplikacji do jego konfiguracji, zainstaluj ją na swoim telefonie lub komputerze i użyj jej, aby uzyskać dostęp do ustawień routera.",
"install_devices_router_list_2": "Znajdź ustawienia DHCP/DNS. Poszukaj skrótu DNS obok pola, które pozwala wstawić dwa lub trzy zestawy liczb, z których każdy jest podzielony na cztery grupy z jedną do trzech cyfr.",
"install_devices_router_list_3": "Wpisz adresy swojego serwera AdGuard Home.",
"install_devices_router_list_4": "Na niektórych typach routerów nie można skonfigurować własnego serwera DNS. W takim przypadku pomocne może być skonfigurowanie AdGuard Home jako <0>serwera DHCP</0>. W przeciwnym razie należy sprawdzić w instrukcji obsługi routera, jak dostosować serwery DNS do konkretnego modelu routera.",

View File

@@ -58,7 +58,7 @@
"dhcp_warning": "Se você quiser ativar o servidor DHCP de qualquer maneira, certifique-se de que não haja outro servidor DHCP ativo em sua rede, pois isso pode quebrar a conectividade com a Internet para dispositivos na rede!",
"dhcp_error": "O AdGuard Home não conseguiu determinar se há outro servidor DHCP ativo na rede.",
"dhcp_static_ip_error": "Para usar o servidor DHCP, você deve definir um endereço IP estático. AdGuard Home não conseguiu determinar se essa interface de rede está configurada usando o endereço de IP estático. Por favor, defina um endereço IP estático manualmente.",
"dhcp_dynamic_ip_found": "Seu sistema usa a configuração de endereço IP dinâmico para a interface <0>{{interfaceName}}</0>. Para usar o servidor DHCP, você deve definir um endereço de IP estático. Seu endereço IP atual é <0> {{ipAddress}} </ 0>. AdGuard Home irá definir automaticamente este endereço IP como estático se você pressionar o botão \"Ativar DHCP\".",
"dhcp_dynamic_ip_found": "Seu sistema usa a configuração de endereço IP dinâmico para a interface <0>{{interfaceName}}</0>. Para usar o servidor DHCP, você deve definir um endereço de IP estático. Seu endereço IP atual é <0> {{ipAddress}} </ 0>. AdGuard Home irá definir automaticamente este endereço IP como estático se você pressionar o botão \"Ativar servidor DHCP\".",
"dhcp_lease_added": "Concessão estática \"{{key}}\" adicionada com sucesso",
"dhcp_lease_deleted": "Concessão estática \"{{key}}\" excluída com sucesso",
"dhcp_new_static_lease": "Nova concessão estática",
@@ -525,6 +525,7 @@
"disable_ipv6": "Desativar IPv6",
"disable_ipv6_desc": "Se este recurso estiver ativado, todas as consultas de DNS para endereços IPv6 (tipo AAAA) serão ignoradas.",
"fastest_addr": "Endereço de IP mais rápido",
"fastest_addr_desc": "Consulta todos os servidores DNS e retorna o endereço IP mais rápido entre todas as respostas. Isso torna as consultas DNS mais lentas, pois o AdGuard Home tem que esperar pelas respostas de todos os servidores DNS, mas melhora a conectividade geral.",
"autofix_warning_text": "Se clicar em \"Corrigir\", o AdGuardHome irá configurar o seu sistema para utilizar o servidor DNS do AdGuardHome.",
"autofix_warning_list": "Ele irá realizar estas tarefas: <0>Desativar sistema DNSStubListener</0> <0>Definir endereço do servidor DNS para 127.0.0.1</0> <0>Substituir o alvo simbólico do link /etc/resolv.conf para /run/systemd/resolv.conf</0> <0>Parar DNSStubListener (recarregar serviço resolvido pelo sistema)</0>",
"autofix_warning_result": "Como resultado, todos as solicitações DNS do seu sistema serão processadas pelo AdGuard Home por padrão.",

View File

@@ -58,7 +58,7 @@
"dhcp_warning": "Se tu quiser activar o servidor DHCP de qualquer maneira, certifique-se de que não haja outro servidor DHCP activo em tua rede, pois isso pode quebrar a conectividade com a Internet para dispositivos na rede!",
"dhcp_error": "O AdGuard Home não conseguiu determinar se há noutro servidor DHCP ativo na rede.",
"dhcp_static_ip_error": "Para usar o servidor DHCP, deve definir um endereço IP estático. AdGuard Home não conseguiu determinar se essa interface de rede está configurada usando o endereço de IP estático. Por favor, defina um endereço IP estático manualmente.",
"dhcp_dynamic_ip_found": "O seu sistema usa a configuração de endereço IP dinâmico para a interface <0>{{interfaceName}}</0>. Para usar o servidor DHCP, deve definir um endereço de IP estático. O seu endereço IP actual é <0> {{ipAddress}} </ 0>. AdGuard Home irá definir automaticamente este endereço IP como estático se pressionar o botão \"Activar DHCP\".",
"dhcp_dynamic_ip_found": "O seu sistema usa a configuração de endereço IP dinâmico para a interface <0>{{interfaceName}}</0>. Para usar o servidor DHCP, deve definir um endereço de IP estático. O seu endereço IP actual é <0> {{ipAddress}} </ 0>. AdGuard Home irá definir automaticamente este endereço IP como estático se pressionar o botão \"Activar servidor DHCP\".",
"dhcp_lease_added": "Concessão estática \"{{key}}\" adicionada com sucesso",
"dhcp_lease_deleted": "Concessão estática \"{{key}}\" excluída com sucesso",
"dhcp_new_static_lease": "Nova concessão estática",
@@ -525,6 +525,7 @@
"disable_ipv6": "Desactivar IPv6",
"disable_ipv6_desc": "Se este recurso estiver ativado, todas as consultas de DNS para endereços IPv6 (tipo AAAA) serão ignoradas.",
"fastest_addr": "Endereço de IP mais rápido",
"fastest_addr_desc": "Consulta todos os servidores DNS e retorna o endereço IP mais rápido entre todas as respostas. Isso torna as consultas DNS mais lentas, pois o AdGuard Home tem que esperar pelas respostas de todos os servidores DNS, mas melhora a conectividade geral.",
"autofix_warning_text": "Se clicar em \"Corrigir\", o AdGuardHome irá configurar o seu sistema para utilizar o servidor DNS do AdGuardHome.",
"autofix_warning_list": "Ele irá realizar estas tarefas: <0>Desactivar sistema DNSStubListener</0> <0>Definir endereço do servidor DNS para 127.0.0.1</0> <0>Substituir o alvo simbólico do link /etc/resolv.conf para /run/systemd/resolv.conf</0> <0>Parar DNSStubListener (recarregar serviço resolvido pelo sistema)</0>",
"autofix_warning_result": "Como resultado, todos as solicitações DNS do seu sistema serão processadas pelo AdGuard Home por predefinição.",

View File

@@ -58,7 +58,7 @@
"dhcp_warning": "Если вы все равно хотите включить DHCP-сервер, убедитесь, что в сети больше нет активных DHCP-серверов. Иначе это может сломать доступ в сеть для подключённых устройств!",
"dhcp_error": "AdGuard Home не смог определить присутствие других DHCP-серверов в сети.",
"dhcp_static_ip_error": "Чтобы использовать DHCP-сервер, должен быть установлен статический IP-адрес. AdGuard Home не смог определить, использует ли этот сетевой интерфейс статический IP-адрес. Пожалуйста, установите его вручную.",
"dhcp_dynamic_ip_found": "Ваша система использует динамический IP-адрес для интерфейса <0>{{interfaceName}}</0>. Чтобы использовать DHCP-сервер, необходимо установить статический IP-адрес. Ваш текущий IP-адрес <0>{{ipAddress}}</0>. Мы автоматически установим его как статический, если вы нажмёте кнопку «Включить DHCP».",
"dhcp_dynamic_ip_found": "Ваша система использует динамический IP-адрес для интерфейса <0>{{interfaceName}}</0>. Чтобы использовать DHCP-сервер, необходимо установить статический IP-адрес. Ваш текущий IP-адрес <0>{{ipAddress}}</0>. Мы автоматически установим его как статический, если вы нажмёте кнопку «Включить DHCP-сервер».",
"dhcp_lease_added": "Статическая аренда «{{key}}» успешно добавлена",
"dhcp_lease_deleted": "Статическая аренда «{{key}}» успешно удалена",
"dhcp_new_static_lease": "Новая статическая аренда",
@@ -311,7 +311,7 @@
"install_devices_router": "Роутер",
"install_devices_router_desc": "Такая настройка автоматически покроет все устройства, использующие ваш домашний роутер, и вам не нужно будет настраивать каждое из них в отдельности.",
"install_devices_address": "DNS-сервер AdGuard Home доступен по следующим адресам",
"install_devices_router_list_1": "Откройте настройки вашего роутера. Обычно вы можете открыть их в вашем браузере, например, http://192.168.0.1/ или http://192.168.1.1/. Вас могут попросить ввести пароль. Если вы не помните его, пароль часто можно сбросить, нажав на кнопку на самом роутере, но помните, что эта процедура может привести к потере всей конфигурации роутера. Некоторые роутеры требуют специального приложения, которое в этом случае должно быть уже установлено на ваш компьютер или телефон.",
"install_devices_router_list_1": "Откройте настройки вашего роутера. Обычно вы можете открыть их в вашем браузере, например, http://192.168.0.1/ или http://192.168.1.1/. Вас могут попросить ввести пароль. Если вы не помните его, пароль часто можно сбросить, нажав на кнопку на самом роутере, но помните, что эта процедура может привести к потере всей конфигурации роутера. Если вашему роутеру необходимо приложение для настройки, установите его на свой телефон или ПК и воспользуйтесь им для настройки роутера.",
"install_devices_router_list_2": "Найдите настройки DHCP или DNS. Найдите буквы «DNS» рядом с текстовым полем, в которое можно ввести два или три ряда цифр, разделенных на 4 группы от одной до трёх цифр.",
"install_devices_router_list_3": "Введите туда адрес вашего AdGuard Home.",
"install_devices_router_list_4": "Вы не можете установить собственный DNS-сервер на некоторых типах маршрутизаторов. В этом случае может помочь настройка AdGuard Home в качестве <0>DHCP-сервера</0>. В противном случае вам следует обратиться к руководству по настройке DNS-серверов для вашей конкретной модели маршрутизатора.",

View File

@@ -3,6 +3,9 @@
"example_upstream_comment": "ඔබට අදහසක් සඳහන් කළ හැකිය",
"parallel_requests": "සමාන්තර ඉල්ලීම්",
"load_balancing": "ධාරිතාව තුලනය",
"local_ptr_title": "පෞද්ගලික ව.නා.ප. සේවාදායකයන්",
"local_ptr_placeholder": "පේළියකට එක් සේවාදායක ලිපිනය බැගින් යොදන්න",
"resolve_clients_title": "අනුග්‍රාහකවල අ.ජා. කෙ. ලිපින ප්‍රතිවර්ත විසඳීම සබල කරන්න",
"check_dhcp_servers": "ග.ධා.වි.කෙ. සේවාදායකයන් සඳහා පරීක්ෂා කරන්න",
"save_config": "වින්‍යාසය සුරකින්න",
"enabled_dhcp": "ග.ධා.වි.කෙ. සේවාදායකය සබල කර ඇත",
@@ -36,7 +39,7 @@
"dhcp_warning": "ඔබට කෙසේ හෝ ග.ධා.වි.කෙ. සේවාදායකය සබල කිරීමට අවශ්‍ය නම්, ඔබේ ජාලයේ වෙනත් ක්‍රියාකාරී ග.ධා.වි.කෙ. සේවාදායකයක් නොමැති බව තහවුරු කරගන්න. මෙය සම්බන්ධිත උපාංග සඳහා අන්තර්ජාලය බිඳ දැමිය හැකිය!",
"dhcp_error": "ජාලයේ තවත් ග.ධා.වි.කෙ. සේවාදායකයක් තිබේද යන්න නිශ්චය කළ නොහැකි විය.",
"dhcp_static_ip_error": "ග.ධා.වි.කෙ. සේවාදායකය භාවිතා කිරීම සඳහා ස්ථිතික අන්තර්ජාල කෙටුම්පත් (IP) ලිපිනයක් සැකසිය යුතුය. මෙම ජාල අතුරුමුහුණත ස්ථිතික අ.ජා. කෙ. ලිපිනයක් භාවිතයෙන් වින්‍යාසගත කර තිබේද යන්න තීරණය කිරීමට ඇඩ්ගාර්ඩ් හෝම් අසමත් විය. කරුණාකර ස්ථිතික අ.ජා. කෙ. ලිපිනයක් අතින් සකසන්න.",
"dhcp_dynamic_ip_found": "ඔබගේ පද්ධතිය <0>{{interfaceName}}</0> අතුරු මුහුණත සඳහා ගතික අන්තර්ජාල කෙටුම්පත් (IP) ලිපින වින්‍යාසය භාවිතා කරයි. ග.ධා.වි.කෙ. සේවාදායකය භාවිතා කිරීම සඳහා ස්ථිතික අ.ජා. කෙ. ලිපිනයක් සැකසිය යුතුය. ඔබගේ වර්තමාන අ.ජා. කෙ. ලිපිනය <0>{{ipAddress}}</0> වේ. ඔබ ග.ධා.වි.කෙ. සබල කරන්න බොත්තම එබුවහොත් ඇඩ්ගාර්ඩ් හෝම් ස්වයංක්‍රීයව මෙම අ.ජා. කෙ. ලිපිනය ස්ථිතික ලෙස සකසනු ඇත.",
"dhcp_dynamic_ip_found": "ඔබගේ පද්ධතිය <0>{{interfaceName}}</0> අතුරු මුහුණත සඳහා ගතික අන්තර්ජාල කෙටුම්පත් (IP) ලිපින වින්‍යාසය භාවිතා කරයි. ග.ධා.වි.කෙ. සේවාදායකය භාවිතා කිරීම සඳහා ස්ථිතික අ.ජා. කෙ. ලිපිනයක් සැකසිය යුතුය. ඔබගේ වර්තමාන අ.ජා. කෙ. ලිපිනය <0>{{ipAddress}}</0> වේ. ඔබ \"ග.ධා.වි.කෙ. සබල කරන්න\" බොත්තම එබුවහොත් ඇඩ්ගාර්ඩ් හෝම් ස්වයංක්‍රීයව මෙම අ.ජා. කෙ. ලිපිනය ස්ථිතික ලෙස සකසනු ඇත.",
"dhcp_reset": "ග.ධා.වි.කෙ. වින්‍යාසය යළි පිහිටුවීමට අවශ්‍ය බව ඔබට විශ්වාස ද?",
"country": "රට",
"city": "නගරය",
@@ -84,6 +87,9 @@
"top_clients": "ජනප්‍රිය අනුග්‍රාහකයන්",
"no_clients_found": "අනුග්‍රාහකයින් හමු නොවිණි",
"general_statistics": "පොදු සංඛ්‍යාලේඛන",
"number_of_dns_query_days": "පසුගිය දින {{count}} සඳහා සැකසූ ව.නා.ප. විමසුම් ගණන",
"number_of_dns_query_days_plural": "පසුගිය දින {{count}} සඳහා සැකසූ ව.නා.ප. විමසුම් ගණන",
"number_of_dns_query_24_hours": "පසුගිය හෝරා 24 සඳහා සැකසූ ව.නා.ප. විමසුම් ගණන",
"number_of_dns_query_blocked_24_hours": "දැන්වීම් වාරණ පෙරහන් සහ ධාරක වාරණ ලැයිස්තු මගින් අවහිර කරන ලද ව.නා.ප. ඉල්ලීම් ගණන",
"number_of_dns_query_blocked_24_hours_by_sec": "ඇඩ්ගාර්ඩ් පිරික්සුම් ආරක්ෂණ ඒකකය මගින් අවහිර කරන ලද ව.නා.ප. ඉල්ලීම් ගණන",
"number_of_dns_query_blocked_24_hours_adult": "අවහිර කළ වැඩිහිටි වියමන අඩවි ගණන",
@@ -109,6 +115,8 @@
"encryption_settings": "සංකේතාංකන සැකසුම්",
"dhcp_settings": "ග.ධා.වි.කෙ. සැකසුම්",
"upstream_dns": "Upstream ව.නා.ප. සේවාදායකයන්",
"upstream_dns_help": "පේළියකට එක් සේවාදායක ලිපිනය බැගින් ඇතුළත් කරන්න. upstream ව.නා.ප. (DNS) \n සේවාදායකයන් වින්‍යාසගත කිරීම ගැන <a>තව දැනගන්න</a>.",
"upstream_dns_configured_in_file": "{{path}} හි වින්‍යාසගත කර ඇත",
"apply_btn": "යොදන්න",
"disabled_filtering_toast": "පෙරීම අබල කර ඇත",
"enabled_filtering_toast": "පෙරීම සබල කර ඇත",
@@ -194,6 +202,7 @@
"query_log_response_status": "තත්ත්වය: {{value}}",
"query_log_filtered": "{{filter}} මගින් පෙරහන් කරන ලදි",
"query_log_confirm_clear": "සම්පූර්ණ විමසුම් ලොගය ඉවත් කිරීමට අවශ්‍ය යැයි ඔබට විශ්වාසද?",
"query_log_updated": "විමසුම් ලොගය සාර්ථකව යාවත්කාලීන කරන ලදි",
"query_log_clear": "විමසුම් ලොග ඉවත් කරන්න",
"query_log_retention": "විමසුම් ලොග රඳවා තබා ගැනීම",
"query_log_enable": "ලොගය සබල කරන්න",
@@ -309,6 +318,8 @@
"encryption_key_input": "ඔබගේ සහතිකය සඳහා PEM-කේතාංකනය කළ පුද්ගලික යතුර පිටපත් කර මෙහි අලවන්න.",
"encryption_enable": "සංකේතාංකනය සබල කරන්න (HTTPS, DNS-over-HTTPS සහ DNS-over-TLS)",
"encryption_enable_desc": "සංකේතාංකනය සබල කර ඇත්නම්, ඇඩ්ගාර්ඩ් හෝම් පරිපාලක අතුරුමුහුණත HTTPS හරහා ක්‍රියා කරනු ඇති අතර ව.නා.ප. සේවාදායකය DNS-over-HTTPS සහ DNS-over-TLS හරහා ලැබෙන ඉල්ලීම් සඳහා සවන් දෙනු ඇත.",
"encryption_chain_valid": "සහතික දාමය වලංගු ය",
"encryption_chain_invalid": "සහතික දාමය වලංගු නොවේ",
"encryption_key_valid": "මෙය වලංගු {{type}} පුද්ගලික යතුරකි",
"encryption_key_invalid": "මෙය වලංගු නොවන {{type}} පුද්ගලික යතුරකි",
"encryption_subject": "මාතෘකාව",
@@ -323,6 +334,7 @@
"form_error_password": "මුරපදය නොගැලපුුුුුුණි",
"reset_settings": "සැකසුම් යළි පිහිටුවන්න",
"update_announcement": "ඇඩ්ගාර්ඩ් හෝම් {{version}} දැන් ලබා ගත හැකිය! වැඩි විස්තර සඳහා <0>මෙහි ක්ලික් කරන්න</0>.",
"setup_guide": "පිහිටුවීමේ මාර්ගෝපදේශය",
"dns_addresses": "ව.නා.ප. ලිපින",
"dns_start": "ව.නා.ප. සේවාදායකය ආරම්භ වෙමින් පවතී",
"dns_status_error": "ව.නා.ප. සේවාදායකයේ තත්වය පරීක්ෂා කිරීමේදී දෝෂයකි",
@@ -345,6 +357,7 @@
"client_identifier": "හඳුන්වනය",
"ip_address": "අ.ජා. කෙ. (IP) ලිපිනය",
"form_enter_ip": "අ.ජා. කෙ. (IP) ඇතුළත් කරන්න",
"form_enter_subnet_ip": "\"{{cidr}}\" අනුජාලයෙහි අ.ජා. කෙ. ලිපිනයක් යොදන්න.",
"form_enter_mac": "මා.ප්‍ර.පා. (MAC) ඇතුළත් කරන්න",
"form_enter_id": "හඳුන්වනය ඇතුළත් කරන්න",
"form_add_id": "හඳුන්වනයක් එක් කරන්න",
@@ -354,6 +367,7 @@
"client_deleted": "\"{{key}}\" අනුග්‍රාහකය සාර්ථකව ඉවත් කරන ලදි",
"client_added": "\"{{key}}\" අනුග්‍රාහකය සාර්ථකව එකතු කරන ලදි",
"client_updated": "\"{{key}}\" අනුග්‍රාහකය සාර්ථකව යාවත්කාල කරන ලදි",
"clients_not_found": "අනුග්‍රාහකයින් හමු නොවිණි",
"client_confirm_delete": "\"{{key}}\" අනුග්‍රාහකය ඉවත් කිරීමට අවශ්‍ය බව ඔබට විශ්වාසද?",
"list_confirm_delete": "මෙම ලැයිස්තුව ඉවත් කිරීමට අවශ්‍ය බව ඔබට විශ්වාස ද?",
"auto_clients_desc": "ඇඩ්ගාර්ඩ් හෝම් භාවිතා කරන අනුග්‍රාහකයන්‌ගේ දත්ත, නමුත් වින්‍යාසය තුළ ගබඩා කර නොමැති",
@@ -370,9 +384,12 @@
"check_updates_now": "යාවත්කාල කිරීම සඳහා දැන් පරීක්ෂා කරන්න",
"dns_privacy": "ව.නා.ප. රහස්‍යතා",
"setup_dns_privacy_3": "<0>මෙහි ඔබට භාවිතා කළ හැකි මෘදුකාංග ලැයිස්තුවක් ඇත.</0>",
"setup_dns_privacy_other_title": "වෙනත් ක්‍රියාවට නැංවූ දෑ",
"setup_dns_privacy_other_2": "<0>ඩීඑන්එස්ප්‍රොක්සි</0> දන්නා සියලුම ආරක්ෂිත ව.නා.ප. කෙටුම්පත් සඳහා සහය දක්වයි.",
"setup_dns_privacy_other_3": "<1>DNS-over-HTTPS</1> සඳහා <0>dnscrypt-පෙරකලාසිය</0> සහය දක්වයි.",
"setup_dns_privacy_other_4": "<1>DNS-over-HTTPS</1> සඳහා <0>මොසිල්ලා ෆයර්ෆොක්ස්</0> සහය දක්වයි.",
"setup_dns_privacy_other_5": "<0>මෙහි</0> සහ <1>මෙහි</1> තවත් ක්‍රියාවට නැංවූ දෑ ඔබට හමුවනු ඇත.",
"setup_dns_privacy_ioc_mac": "අයිඕඑස් සහ මැක්ඕඑස් වින්‍යාසය",
"setup_dns_notice": "ඔබට <1>DNS-over-HTTPS</1> හෝ <1>DNS-over-TLS</1> භාවිතා කිරීම සඳහා ඇඩ්ගාර්ඩ් හෝම් සැකසුම් තුළ <0>සංකේතාංකනය වින්‍යාසගත</0> කිරීමට අවශ්‍ය වේ.",
"rewrite_added": "\"{{key}}\" සඳහා ව.නා.ප. නැවත ලිවීම සාර්ථකව එකතු කරන ලදි",
"rewrite_add": "ව.නා.ප. නැවත ලිවීමක් එකතු කරන්න",

View File

@@ -1,15 +1,20 @@
{
"client_settings": "Nastavenie klienta",
"example_upstream_reserved": "Môžete zadať DNS upstream <0>pre konkrétnu doménu (domény)</0>",
"example_upstream_comment": "Môžete napísať komentár",
"upstream_parallel": "Používať paralelné dopyty na zrýchlenie súčasným dopytovaním všetkých upstream serverov súčasne.",
"parallel_requests": "Paralelné dopyty",
"load_balancing": "Vyrovnávanie záťaže",
"load_balancing_desc": "Dopytovať len jeden server v danom čase. AdGuard Home použije na výber servera vážený náhodný algoritmus, aby sa najrýchlejší server používal častejšie.",
"bootstrap_dns": "Bootstrap DNS servery",
"bootstrap_dns_desc": "Bootstrap DNS servery sa používajú na rozlíšenie IP adries DoH/DoT rezolverov, ktoré zadáte ako upstreams.",
"local_ptr_title": "Súkromné DNS servery",
"local_ptr_desc": "DNS server alebo servery, ktoré AdGuard Home použije na dopyty na lokálne poskytované zdroje. Napríklad tento server sa použije na riešenie názvov hostiteľov klientov pre klientov so súkromnými IP adresami. Ak nie je nastavené inak, AdGuard Home automaticky použije Váš predvolený prekladač DNS.",
"local_ptr_desc": "DNS servery, ktoré AdGuard Home použije na dopyty na lokálne poskytované zdroje. Napríklad tento server sa použije na preklad názvov hostiteľov klientov pre klientov so súkromnými adresami IP. Ak nie je nastavené, AdGuard Home automaticky použije Váš predvolený DNS prekladač.",
"local_ptr_placeholder": "Na každý riadok zadajte adresu jedného servera",
"resolve_clients_title": "Povoliť rozlíšenie názvov hostiteľských mien klientov",
"resolve_clients_desc": "Ak je povolené, AdGuard Home sa pokúsi automaticky rozlíšiť hostiteľské mená klientov z ich IP adries zaslaním dotazu PTR príslušnému rezolveru (súkromný DNS server pre miestnych klientov, server pre zákazníkov s verejnou IP adresou).",
"resolve_clients_title": "Povoliť spätný preklad IP adries klientov",
"resolve_clients_desc": "Ak je povolené, AdGuard Home sa pokúsi automaticky rozlíšiť hostiteľské mená klientov z ich IP adries zaslaním dopytu PTR príslušnému rezolveru (súkromný DNS server pre miestnych klientov, upstream server pre zákazníkov s verejnou IP adresou).",
"check_dhcp_servers": "Skontrolovať DHCP servery",
"save_config": "Uložiť konfiguráciu",
"enabled_dhcp": "DHCP server zapnutý",
"disabled_dhcp": "DHCP server vypnutý",
"unavailable_dhcp": "DHCP nie je dostupné",
@@ -18,10 +23,12 @@
"dhcp_description": "Ak Váš smerovač neposkytuje možnosť nastaviť DHCP, môžete použiť vlastný zabudovaný DHCP server AdGuard.",
"dhcp_enable": "Zapnúť DHCP server",
"dhcp_disable": "Vypnúť DHCP server",
"dhcp_not_found": "Je bezpečné zapnúť vstavaný DHCP server - AdGuard Home v sieti nenašiel žiadne aktívne DHCP servery. Odporúčame Vám však, aby ste ho znova manuálne skontrolovali, pretože náš automatický test momentálne neposkytuje 100% záruku.",
"dhcp_found": "V sieti bol nájdený aktívny DHCP server. Nie je bezpečné povoliť vstavaný DHCP server.",
"dhcp_leases": "DHCP prenájom",
"dhcp_static_leases": "DHCP statické prenájmy",
"dhcp_leases_not_found": "Neboli nájdené žiadne DHCP prenájmy",
"dhcp_config_saved": "Konfigurácia DHCP servera bola úspešne uložená",
"dhcp_ipv4_settings": "Nastavenia DHCP IPv4",
"dhcp_ipv6_settings": "Nastavenia DHCP IPv6",
"form_error_required": "Povinná položka",
@@ -48,11 +55,16 @@
"ip": "IP",
"dhcp_table_hostname": "Meno hostiteľa",
"dhcp_table_expires": "Vyprší",
"dhcp_warning": "Ak chcete server DHCP napriek tomu zapnúť, uistite sa, že v sieti nie je žiadny iný aktívny DHCP server. V opačnom prípade sa môže prerušiť internet pre už pripojené zariadenia!",
"dhcp_error": "AdGuard Home nevie určiť, či je v sieti iný aktívny DHCP server.",
"dhcp_static_ip_error": "Aby bolo možné používať DHCP server, musí byť nastavená statická IP adresa. AdGuard Home nedokázal určiť, či je toto sieťové rozhranie nakonfigurované pomocou statickej adresy IP. Nastavte statickú IP adresu manuálne.",
"dhcp_dynamic_ip_found": "Váš systém používa pre rozhranie <0>{{interfaceName}}</0> dynamickú konfiguráciu IP adresy. Aby bolo možné používať DHCP server, musí byť nastavená statická IP adresa. Vaša aktuálna IP adresa je <0>{{ipAddress}}</0>. ak Ak stlačíte tlačidlo \"Povoliť DHCP server\", AdGuard Home automaticky nastaví túto IP adresu ako statickú.",
"dhcp_lease_added": "Statický \"{{key}}\" prenájmu bol úspešne pridaný",
"dhcp_lease_deleted": "Statický \"{{key}}\" prenájmu bol úspešne vymazaný",
"dhcp_new_static_lease": "Nový statický prenájom",
"dhcp_static_leases_not_found": "Nebol nájdený žiadny statický DHCP prenájom",
"dhcp_add_static_lease": "Pridať statický prenájom",
"dhcp_reset": "Naozaj chcete vymazať DHCP konfiguráciu?",
"country": "Krajina",
"city": "Mesto",
"delete_confirm": "Naozaj chcete vymazať \"{{key}}\"?",
@@ -99,7 +111,14 @@
"top_clients": "Najčastejší klienti",
"no_clients_found": "Neboli nájdení žiadni klienti",
"general_statistics": "Všeobecná štatistika",
"number_of_dns_query_days": "Počet DNS dopytov spracovaných za posledný {{count}} deň",
"number_of_dns_query_days_plural": "Počet DNS dopytov spracovaných za posledných {{count}} dní",
"number_of_dns_query_24_hours": "Počet DNS dopytov spracovaných za posledných 24 hodín",
"number_of_dns_query_blocked_24_hours": "Počet DNS dopytov zablokovaných filtrami reklamy a zoznamami blokovaných hostov",
"number_of_dns_query_blocked_24_hours_by_sec": "Počet DNS dopytov zablokovaných AdGuard modulom Bezpečné prehliadanie",
"number_of_dns_query_blocked_24_hours_adult": "Počet zablokovaných stránok pre dospelých",
"enforced_save_search": "Vynútené bezpečné vyhľadávanie",
"number_of_dns_query_to_safe_search": "Počet DNS dopytov na vyhľadávače, pri ktorých bolo vynútené bezpečné vyhľadávanie",
"average_processing_time": "Priemerný čas spracovania",
"average_processing_time_hint": "Priemerný čas spracovania DNS dopytu v milisekundách",
"block_domain_use_filters_and_hosts": "Blokovať domény pomocou filtrov a zoznamov adries",
@@ -121,6 +140,7 @@
"encryption_settings": "Nastavenia šifrovania",
"dhcp_settings": "Nastavenia DHCP",
"upstream_dns": "Upstream DNS servery",
"upstream_dns_help": "Zadajte jednu adresu server na každý riadok. <a>Získajte viac informácií</a> o konfigurácii upstream DNS serverov.",
"upstream_dns_configured_in_file": "Konfigurované v {{path}}",
"test_upstream_btn": "Test upstreamov",
"upstreams": "Upstreams",
@@ -249,6 +269,7 @@
"rate_limit": "Rýchlostný limit",
"edns_enable": "Povoliť klientsku podsiete EDNS",
"edns_cs_desc": "Ak je zapnuté, program AdGuard Home bude odosielať podsiete klientov na DNS servery.",
"rate_limit_desc": "Počet požiadaviek za sekundu, ktoré môže jeden klient vykonať. Nastavenie na hodnotu 0 znamená neobmedzene.",
"blocking_ipv4_desc": "IP adresa, ktorá sa má vrátiť v prípade blokovanej žiadosti A",
"blocking_ipv6_desc": "IP adresa, ktorá sa má vrátiť v prípade blokovanej žiadosti AAAA",
"blocking_mode_default": "Predvolené: Odpovedať nulovou adresou IP (0,0.0.0 pre A; :: pre AAAA), keď je blokovaná pravidlom v štýle Adblock; odpovedať IP adresou uvedenou v pravidle, keď je blokovaná pravidlom v štýle /etc/hosts",
@@ -271,6 +292,7 @@
"install_settings_listen": "Sieťové rozhranie",
"install_settings_port": "Port",
"install_settings_interface_link": "Vaše administrátorské webové rozhranie AdGuard Home bude k dispozícii na týchto adresách:",
"form_error_port": "Zadajte platné číslo portu",
"install_settings_dns": "DNS server",
"install_settings_dns_desc": "Budete musieť konfigurovať Vaše zariadenia alebo smerovač, aby používali DNS server na nasledujúcich adresách:",
"install_settings_all_interfaces": "Všetky rozhrania",
@@ -289,8 +311,10 @@
"install_devices_router": "Smerovač",
"install_devices_router_desc": "Toto nastavenie automaticky pokryje všetky zariadenia pripojené k Vášmu domácemu smerovaču a nebudete ich musieť konfigurovať manuálne.",
"install_devices_address": "DNS server AdGuard Home používa nasledujúce adresy",
"install_devices_router_list_1": "Otvorte predvoľby Vášho smerovača. Zvyčajne ho môžete získať z Vášho prehliadača prostredníctvom URL adresy, ako napr. http://192.168.0.1/ alebo http://192.168.1.1/. Možno bude potrebné zadať heslo. Ak si ho nepamätáte, môžete často resetovať heslo stlačením tlačidla na samotnom smerovači, uvedomte si však, že ak sa zvolíte tento postup, pravdepodobne stratíte celú konfiguráciu smerovača. Ak Váš smerovač vyžaduje na nastavenie vlastnú aplikáciu, nainštalujte si ju do telefónu alebo počítača a použite ju na prístup k nastaveniam smerovača.",
"install_devices_router_list_2": "Nájdite nastavenia DHCP/DNS. Hľadajte skratku DNS vedľa poľa, ktoré umožňuje vložiť dve alebo tri sady čísel, každé rozdelené do štyroch skupín s jedným až tromi číslicami.",
"install_devices_router_list_3": "Zadajte tam adresy Vášho AdGuard Home servera.",
"install_devices_router_list_4": "Na niektorých typoch smerovačov nemôžete nastaviť vlastný DNS server. V takom prípade môže pomôcť, ak nastavíte AdGuard Home ako <0>DHCP server</0>. V opačnom prípade by ste mali vyhľadať príručku, ako prispôsobiť DNS servery konkrétnemu modelu smerovača.",
"install_devices_windows_list_1": "Otvorte panel Nastavenia cez menu Štart alebo vyhľadávanie Windows.",
"install_devices_windows_list_2": "Prejdite do kategórie Sieť a internet a potom do Centra sietí a zdieľania.",
"install_devices_windows_list_3": "Vyhľadajte položku Zmeniť možnosti adaptéra a kliknite na ňu",
@@ -316,6 +340,7 @@
"install_saved": "Úspešne uložené",
"encryption_title": "Šifrovanie",
"encryption_desc": "Podpora šifrovania (HTTPS/TLS) pre webové rozhranie DNS aj administrátora",
"encryption_config_saved": "Konfigurácia šifrovania uložená",
"encryption_server": "Meno servera",
"encryption_server_enter": "Zadajte meno Vašej domény",
"encryption_server_desc": "Ak chcete používať protokol HTTPS, musíte zadať názov servera, ktorý zodpovedá Vášmu certifikátu SSL alebo certifikátu so zástupnými znakmi. Ak pole nie je nastavené, bude akceptovať TLS pripojenia pre ľubovoľnú doménu.",
@@ -346,10 +371,13 @@
"encryption_reset": "Naozaj chcete obnoviť nastavenia šifrovania?",
"topline_expiring_certificate": "Váš SSL certifikát čoskoro vyprší. Aktualizujte <0>Nastavenia šifrovania</0>.",
"topline_expired_certificate": "Váš SSL certifikát vypršal. Aktualizujte <0>Nastavenia šifrovania</0>.",
"form_error_port_range": "Zadajte číslo portu v rozsahu 80-65535",
"form_error_port_unsafe": "Toto nie je bezpečný port",
"form_error_equal": "Nesmie byť rovnaká",
"form_error_password": "Heslo sa nezhoduje",
"reset_settings": "Obnoviť nastavenia",
"update_announcement": "AdGuard Home {{version}} je teraz k dispozícii! <0>Viac informácií nájdete tu</0>.",
"setup_guide": "Sprievodca nastavením",
"dns_addresses": "DNS adresy",
"dns_start": "Spúšťa sa DNS server",
"dns_status_error": "Chyba pri zisťovaní stavu DNS servera",
@@ -395,6 +423,7 @@
"access_disallowed_title": "Nepovolení klienti",
"access_disallowed_desc": "Zoznam CIDR alebo IP adries. Ak je nakonfigurovaný, AdGuard Home bude ignorovať dopyty z týchto IP adries",
"access_blocked_title": "Nepovolené domény",
"access_blocked_desc": "Nezamieňajte si to s filtrami. AdGuard Home zruší DNS dopyty obsahujúce tieto domény. Tu môžete zadať presné názvy domén, zástupné znaky a pravidlá filtrácie URL adries, napr. 'example.org', '*.example.org' alebo '|| example.org ^'.",
"access_settings_saved": "Nastavenia prístupu úspešne uložené",
"updates_checked": "Aktualizácie úspešne skontrolované",
"updates_version_equal": "AdGuard Home je aktuálny",
@@ -497,6 +526,7 @@
"disable_ipv6": "Vypnúť IPv6",
"disable_ipv6_desc": "Ak je táto funkcia zapnutá, všetky dotazy DNS na adresy IPv6 (typ AAAA) budú zrušené.",
"fastest_addr": "Najrýchlejšia IP adresa",
"fastest_addr_desc": "Dopytovať všetky servery DNS a vrátiť najrýchlejšiu IP adresu zo všetkých odpovedí. Toto spomalí DNS dopyty, pretože AdGuard Home musí čakať na odpovede zo všetkých serverov DNS, ale zlepší sa celkové pripojenie.",
"autofix_warning_text": "Ak kliknete na „Opraviť“, AdGuardHome nakonfiguruje Váš systém tak, aby používal DNS server AdGuardHome.",
"autofix_warning_list": "Bude vykonávať tieto úlohy: <0>Deaktivovať systém DNSStubListener</0> <0>Nastaviť adresu servera DNS na 127.0.0.1</0> <0>Nahradiť cieľový symbolický odkaz /etc/resolv.conf na /run/systemd/resolve/resolv.conf</0> <0>Zastaviť službu DNSStubListener (znova načítať službu systemd-resolved)</0>",
"autofix_warning_result": "Výsledkom bude, že všetky DNS dopyty z Vášho systému budú štandardne spracované službou AdGuard Home.",
@@ -526,6 +556,7 @@
"set_static_ip": "Nastaviť statickú IP adresu",
"install_static_ok": "Dobré správy! Statická IP adresa je už nakonfigurovaná",
"install_static_error": "AdGuard Home ho nemôže automaticky nakonfigurovať pre toto sieťové rozhranie. Vyhľadajte návod, ako to urobiť manuálne.",
"install_static_configure": "AdGuard Home zistil, že sa používa dynamická IP adresa <0>{{ip}}</0>. Chcete ju použiť ako svoju statickú adresu?",
"confirm_static_ip": "AdGuard Home nakonfiguruje {{ip}} ako statickú IP adresu. Chcete pokračovať?",
"list_updated": "{{count}} zoznam aktualizovaný",
"list_updated_plural": "{{count}} zoznamov aktualizovaných",
@@ -563,6 +594,7 @@
"filter_category_security_desc": "Zoznamy, ktoré sa špecializujú na blokovanie domén škodlivého softvéru alebo podvodov",
"filter_category_regional_desc": "Zoznamy zamerané na regionálne reklamy a sledovacie servery",
"filter_category_other_desc": "Iné blokovacie zoznamy",
"setup_config_to_enable_dhcp_server": "K zapnutiu DHCP servera je potrebné nastaviť konfiguráciu",
"original_response": "Pôvodná odozva",
"click_to_view_queries": "Kliknite pre zobrazenie dopytov",
"port_53_faq_link": "Port 53 je často obsadený službami \"DNSStubListener\" alebo \"systemd-resolved\". Prečítajte si <0>tento návod</0> o tom, ako to vyriešiť.",

View File

@@ -58,7 +58,7 @@
"dhcp_warning": "Če želite vseeno omogočiti strežnik DHCP, se prepričajte, da v vašem omrežju ni nobenega drugega aktivnega strežnika DHCP, saj lahko to prekine internetno povezljivost naprav v omrežju!",
"dhcp_error": "AdGuard Home ni mogel ugotoviti, ali je v omrežju še en aktivni strežnik DHCP.",
"dhcp_static_ip_error": "Za uporabo strežnika DHCP mora biti nastavljen statični naslov IP. AdGuard Home ni uspel ugotoviti, ali je ta omrežni vmesnik nastavljen s statičnim naslovom IP. Prosimo, nastavite statični naslov IP ročno.",
"dhcp_dynamic_ip_found": "Vaš sistem uporablja dinamično nastavitev naslova IP za vmesnik <0>{{interfaceName}}</0>. Za uporabo strežnika DHCP morate nastaviti statični naslov IP. Vaš trenutni naslov IP je<0>{{ipAddress}}</0>. AdGuard Home bo samodejno nastavil ta naslov IP kot statičen, če pritisnete gumb 'Omogoči DHCP'.",
"dhcp_dynamic_ip_found": "Vaš sistem uporablja dinamično nastavitev naslova IP kartice <0>{{interfaceName}}</0>. Za uporabo strežnika DHCP morate nastaviti statični naslov IP. Vaš trenutni naslov IP je<0>{{ipAddress}}</0>. AdGuard Home bo samodejno nastavil ta naslov IP kot statičen, če pritisnete gumb 'Omogoči strežnik DHCP'.",
"dhcp_lease_added": "Statičen najem \"{{key}}\" je uspešno dodan",
"dhcp_lease_deleted": "Statičen najem \"{{key}}\" je uspešno izbrisan",
"dhcp_new_static_lease": "Nov statični najem",
@@ -311,7 +311,7 @@
"install_devices_router": "Usmerjevalnik",
"install_devices_router_desc": "Ta namestitev bo samodejno pokrila vse naprave, povezane z domačim usmerjevalnikom, zato vam jih ni treba ročno konfigurirati.",
"install_devices_address": "AdGuard Home strežnik DNS posluša naslednje naslove",
"install_devices_router_list_1": "Odprite nastavitve vašega usmerjevalnika. Običajno lahko do njega dostopate iz brskalnika prek URL-ja, kot je http://192.168.0.1/ ali http://192.168.1.1/. Morda boste pozvani, da vnesete geslo. Če se tega ne spomnite, lahko geslo pogosto ponastavite s pritiskom na gumb na samem usmerjevalniku, vendar se zavedajte, da če izberete ta postopek, boste verjetno izgubili celotne nastavitve usmerjevalnika. Nekateri usmerjevalniki zahtevajo posebno aplikacijo, ki naj bi bila v tem primeru že nameščena v vašem računalniku ali telefonu.",
"install_devices_router_list_1": "Odprite nastavitve vašega usmerjevalnika. Običajno lahko imate dostop do njega iz brskalnika prek URL naslova, kot je http://192.168.0.1/ ali http://192.168.1.1/. Morda boste pozvani, da vnesete geslo. Če se tega ne spomnite, lahko geslo pogosto ponastavite s pritiskom na gumb na samem usmerjevalniku, vendar se zavedajte, da če izberete ta postopek, boste verjetno izgubili celotne nastavitve usmerjevalnika. Nekateri usmerjevalniki zahtevajo posebno aplikacijo, ki mora v tem primeru biti že nameščena v vašem računalniku ali telefonu.",
"install_devices_router_list_2": "Poiščite nastavitve DHCP/DNS. Poiščite črke DNS poleg polja, ki dovoljuje dva ali tri naborov številk, pri čemer je vsaka razdeljena na štiri skupine z enim do tremi števili.",
"install_devices_router_list_3": "Tam vnesite svoje naslove strežnikov AdGuard Home.",
"install_devices_router_list_4": "Pri nekaterih vrstah usmerjevalnikov strežnika DNS po meri ni mogoče nastaviti. V tem primeru vam lahko pomaga nastavitev AdGuard Home kot <0>strežnika DHCP</0>. V nasprotnem primeru bi morali v priročniku usmerjevalnika preveriti, kako prilagodite strežnike DNS na vašem določenem modelu usmerjevalnika.",

View File

@@ -9,10 +9,10 @@
"bootstrap_dns": "DNS Önyükleme sunucuları",
"bootstrap_dns_desc": "DNS Önyükleme sunucuları, seçtiğiniz üst sunucuların DoH/DoT çözücülerine ait ip adreslerinin çözülmesi için kullanılır.",
"local_ptr_title": "Özel DNS sunucuları",
"local_ptr_desc": "AdGuard Home'un yerel olarak sunulan kaynaklarla ilgili sorgular için kullanacağı DNS sunucusu veya sunucuları. Örneğin, bu sunucu özel IP adreslerine sahip istemciler için istemcilerin ana bilgisayar adlarını çözümlemek için kullanılacak. Ayarlanmazsa, AdGuard Home otomatik olarak varsayılan DNS çözümleyicinizi kullanır.",
"local_ptr_desc": "AdGuard Home'un yerel olarak sunulan kaynaklar için sorgular için kullanacağı DNS sunucuları. Örneğin, bu sunucu özel IP adreslerine sahip istemciler için istemcilerin ana bilgisayar adlarını çözümlemek için kullanılacak. Ayarlanmazsa, AdGuard Home otomatik olarak varsayılan DNS çözümleyicinizi kullanır.",
"local_ptr_placeholder": "Her satıra bir sunucu adresi girin",
"resolve_clients_title": "İstemcilerin ana bilgisayar adı çözümlemesini etkinleştir",
"resolve_clients_desc": "Etkinleştirilirse, AdGuard Home karşılık gelen bir çözümleyiciye (yerel istemciler için özel DNS sunucusu, genel IP'si olan istemciler için üst sunucu) bir PTR sorgusu göndererek istemcilerin ana bilgisayar adlarını IP adreslerinden otomatik olarak çözümlemeye çalışacak.",
"resolve_clients_title": "İstemcilerin IP adreslerinin ters çözümlenmesini etkinleştir",
"resolve_clients_desc": "Etkinleştirilirse, AdGuard Home ilgili çözümleyicilere (yerel istemciler için özel DNS sunucuları, genel IP adreslerine sahip istemciler için üst sunucusu) PTR sorguları göndererek istemcilerin IP adreslerini ana bilgisayar adlarına ters olarak çözümlemeye çalışır.",
"check_dhcp_servers": "DHCP sunucularını denetle",
"save_config": "Yapılandırmayı kaydet",
"enabled_dhcp": "DHCP sunucusu etkinleştirildi",
@@ -58,7 +58,7 @@
"dhcp_warning": "DHCP sunucusunu yine de etkinleştirmek istiyorsanız, ağınızda başka aktif DHCP sunucusu olmadığından emin olun çünkü bu, ağdaki cihazların İnternet bağlantısını kesebilir!",
"dhcp_error": "AdGuard Home, ağda başka bir etkin DHCP sunucusu olup olmadığını belirleyemedi.",
"dhcp_static_ip_error": "DHCP sunucusunu kullanmak için statik bir IP adresi ayarlanmalıdır. AdGuard Home, bu ağ arayüzünün statik bir IP adresi kullanılarak yapılandırılıp yapılandırılmadığını belirleyemedi. Lütfen elle statik bir IP adresi ayarlayın.",
"dhcp_dynamic_ip_found": "Sisteminiz <0>{{interfaceName}}</0> arayüzü için dinamik IP adresi yapılandırması kullanıyor. DHCP sunucusunu kullanmak için statik bir IP adresi ayarlanmalı. Geçerli IP adresiniz <0>{{ipAddress}}</0>. \"DHCP'yi Etkinleştir\" düğmesine basarsanız, AdGuard Home bu IP adresini otomatikman statik olarak ayarlayacak.",
"dhcp_dynamic_ip_found": "Sisteminiz <0>{{interfaceName}}</0> arayüzü için dinamik IP adresi yapılandırması kullanıyor. DHCP sunucusunu kullanmak için statik bir IP adresi ayarlanmalı. Geçerli IP adresiniz <0>{{ipAddress}}</0>. \"DHCP sunucusunu etkinleştir\" düğmesine basarsanız, AdGuard Home bu IP adresini otomatikman statik olarak ayarlayacak.",
"dhcp_lease_added": "Sabit kiralama \"{{key}}\" başarıyla eklendi",
"dhcp_lease_deleted": "Sabit kiralama \"{{key}}\" başarıyla silindi",
"dhcp_new_static_lease": "Yeni sabit kiralama",
@@ -311,7 +311,7 @@
"install_devices_router": "Yönlendirici",
"install_devices_router_desc": "Bu kurulum evdeki yönlendiricinize bağlı tüm cihazlarınızı otomatik olarak kapsar ve her birini elle ayarlamanız gerekmez.",
"install_devices_address": "AdGuard Home DNS sunucusu şu adresi dinleyecektir",
"install_devices_router_list_1": "Yönlendiricinizin ayarlarına girin. Genellikle, tarayıcınızdan http://192.168.0.1/ veya http://192.168.1.1/ gibi bir URL aracılığıyla erişebilirsiniz. Bir parola girmeniz istenebilir. Hatırlamıyorsanız, genellikle yönlendiricinin üzerindeki bir düğmeye basarak parolayı sıfırlayabilirsiniz, ancak bu yöntemin seçilmesi durumunda muhtemelen tüm yönlendirici yapılandırmasını kaybedeceğinizi unutmayın. Bazı yönlendiriciler, bu durumda bilgisayarınıza veya telefonunuza önceden yüklenmiş olması gereken özel bir uygulama gerektirir.",
"install_devices_router_list_1": "Yönlendiricinizin ayarlarına girin. Genellikle tarayıcınızdan http://192.168.0.1/ veya http://192.168.1.1/ gibi bir URL aracılığıyla erişebilirsiniz. Bir parola girmeniz istenebilir. Hatırlamıyorsanız, genellikle yönlendiricinin üzerindeki bir düğmeye basarak parolayı sıfırlayabilirsiniz, ancak bu yöntemin seçilmesi durumunda muhtemelen tüm yönlendirici yapılandırmasını kaybedeceğinizi unutmayın. Yönlendiricinizin kurulması için bir uygulama gerekiyorsa, lütfen uygulamayı telefonunuza veya PC'nize yükleyin ve yönlendiricinin ayarlarına erişmek için kullanın.",
"install_devices_router_list_2": "DHCP/DNS ayarlarını bulun. DNS satırlarını arayın, genelde iki veya üç tanedir, üç rakam girilebilen dört ayrı grup içeren satırdır.",
"install_devices_router_list_3": "AdGuard Home sunucusunun adresini o kısma yazın.",
"install_devices_router_list_4": "Bazı yönlendirici türlerinde özel bir DNS sunucusu kurulamaz. Bu durumda, AdGuard Home'u bir <0>DHCP sunucusu</0> olarak kurmak yardımcı olabilir. Aksi takdirde, belirli yönlendirici modelinizdeki DNS sunucularını nasıl özelleştireceğiniz konusunda yönlendirici kılavuzunu kontrol etmelisiniz.",

View File

@@ -4,6 +4,9 @@
"load_balancing": "Cân bằng tải",
"bootstrap_dns": "Máy chủ DNS Bootstrap",
"bootstrap_dns_desc": "Máy chủ DNS Bootstrap được sử dụng để phân giải địa chỉ IP của bộ phân giải DoH/DoT mà bạn chỉ định là ngược tuyến.",
"local_ptr_desc": "Máy chủ DNS hoặc các máy chủ mà AdGuard Home sẽ sử dụng cho các truy vấn về tài nguyên được phân phối cục bộ. Ví dụ: máy chủ này sẽ được sử dụng để phân giải tên máy khách của máy khách cho các máy khách có địa chỉ IP riêng. Nếu không được cài đặt, AdGuard Home sẽ tự động sử dụng trình phân giải DNS mặc định của bạn.",
"local_ptr_placeholder": "Nhập một địa chỉ máy chủ trên mỗi dòng",
"resolve_clients_title": "Kích hoạt cho phép phân giải ngược về địa chỉ IP của máy khách",
"check_dhcp_servers": "Kiểm tra máy chủ DHCP",
"enabled_dhcp": "Máy chủ DHCP đã kích hoạt",
"disabled_dhcp": "Máy chủ DHCP đã tắt",

View File

@@ -9,10 +9,10 @@
"bootstrap_dns": "Bootstrap DNS 服务器",
"bootstrap_dns_desc": "Bootstrap DNS 服务器用于解析您指定为上游的 DoH / DoT 解析器的 IP 地址。",
"local_ptr_title": "私人 DNS 服务器",
"local_ptr_desc": "AdGuard Home 用于查询本地服务资源的 DNS 服务或服务器。例如,该服务器将被用作具有私人 IP 地址的客户机解析客户机的主机名。如果没有设置AdGuard Home 将自动使用您的默认 DNS 解析器",
"local_ptr_desc": "AdGuard Home 用于查询本地服务资源的 DNS 服务器。例如,该服务器将被用作具有私人 IP 地址的客户机解析客户机的主机名。如果没有设置AdGuard Home 将自动使用您的默认 DNS 解析器",
"local_ptr_placeholder": "每行输入一个服务器地址",
"resolve_clients_title": "启用客户端主机名解析",
"resolve_clients_desc": "如果启用AdGuard Home 将尝试通过发送一个 PTR 查询到应的解析器 (本地客户端的私人 DNS 服务器,公有 IP 客户端的上游服务器) 来自动解析来自其 IP 地址的客户端主机名。",
"resolve_clients_title": "启用客户端的 IP 地址的反向解析",
"resolve_clients_desc": "如果启用AdGuard Home 将尝试通过发送 PTR 查询到应的解析器 (本地客户端的私人 DNS 服务器,公有 IP 客户端的上游服务器) 将 IP 地址反向解析成其客户端主机名。",
"check_dhcp_servers": "检查 DHCP 服务器",
"save_config": "保存配置",
"enabled_dhcp": "DHCP 服务器已启用",
@@ -38,6 +38,7 @@
"form_error_mac_format": "无效的 MAC 格式",
"form_error_client_id_format": "无效的客户端 ID 格式",
"form_error_server_name": "无效的服务器名",
"form_error_subnet": "子网 \"{{cidr}}\" 不包含 IP 地址 \"{{ip}}\"",
"form_error_positive": "必须大于 0",
"form_error_negative": "必须大于等于 0",
"range_end_error": "必须大于范围起始值",
@@ -57,7 +58,7 @@
"dhcp_warning": "如果你想要启用内置的 DHCP 服务器,请确保在当前网络中没有其它起作用的 DHCP 服务器。否则,此操作可能会破坏已连接设备的网络连接!",
"dhcp_error": "AdGuard Home 无法确定在当前网络中是否存在其它 DHCP 服务器。",
"dhcp_static_ip_error": "要使用 DHCP 服务器,则必须设置静态 IP 地址。AdGuard Home 无法确定此网络接口是否已被配置为使用静态 IP 地址。请手动为此网络接口设置静态 IP 地址。",
"dhcp_dynamic_ip_found": "您的系统对网络接口 <0>{{interfaceName}}</0> 使用了动态 IP 地址配置。要使用 DHCP 服务器,则必须对此网络接口使用静态 IP 地址配置。此网络接口当前的 IP 地址为 <0>{{ipAddress}}</0>。如您点击“启用 DHCP” 按钮AdGuard Home 将自动修改此网络接口以使用静态 IP 地址。",
"dhcp_dynamic_ip_found": "您的系统对网络接口 <0>{{interfaceName}}</0> 使用了动态 IP 地址配置。要使用 DHCP 服务器,则必须对此网络接口使用静态 IP 地址配置。此网络接口当前的 IP 地址为 <0>{{ipAddress}}</0>。如您点击“启用 DHCP 服务器” 按钮AdGuard Home 将自动修改此网络接口以使用静态 IP 地址。",
"dhcp_lease_added": "静态租约 \"{{key}}\" 已成功添加",
"dhcp_lease_deleted": "静态租约 \"{{key}}\" 已成功删除",
"dhcp_new_static_lease": "新建静态租约",
@@ -310,7 +311,7 @@
"install_devices_router": "路由器",
"install_devices_router_desc": "此设置将自动覆盖连接到您的家庭路由器的所有设备,您不需要手动配置它们。",
"install_devices_address": "AdGuard Home DNS 服务器正在监听以下地址",
"install_devices_router_list_1": "打开您的路由器配置界面。通常情况下,您可以通过浏览器访问地址(如 http://192.168.0.1/ 或 http://192.168.1.1 )。打开后您可能需要输入密码以进入配置界面。如果您不记得密码,通常可以通过路由器上的重置按钮来重设密码。但是,请注意,如您进行此操作,您最可能会失去所有路由器的配置。一些路由器可能需要通过特定的应用进行这一操作,请确保您已经在计算机或手机上安装了相关应用。",
"install_devices_router_list_1": "打开您的路由器配置界面。通常情况下,您可以通过浏览器访问地址(如 http://192.168.0.1/ 或 http://192.168.1.1 )。打开后您可能需要输入密码以进入配置界面。如果您不记得密码,通常可以通过路由器上的重置按钮来重设密码。但是,请注意,如您进行此操作,您最可能会失去所有路由器的配置。如果您的路由器需要通过特定的应用进行这一操作,请将相关应用程序安装到您的手机或计算机上并使用它设置您的路由器。",
"install_devices_router_list_2": "找到路由器的 DHCP/DNS 设置页面。您会在 DNS 这一单词旁边找到两到三行允许输入的输入框,每一行输入框分为四组,每组允许输入一到三个数字。",
"install_devices_router_list_3": "请在此处输入您的 AdGuard Home 服务器地址。",
"install_devices_router_list_4": "在某些类型的路由器上无法设置自定义 DNS 服务器。在此情况下将 AdGuard Home 设置为 <0>DHCP 服务器</0>,可能会有所帮助。否则您应该查找如何根据特定路由器型号设置 DNS 服务器的使用手册。",
@@ -400,6 +401,7 @@
"ip_address": "IP 地址",
"client_identifier_desc": "客户端可通过 IP 、MAC 地址、CIDR 或特殊 ID可用于 DoT/DoH/DoQ被识别。<0>这里</0>您可多了解如何识别客户端。",
"form_enter_ip": "输入 IP",
"form_enter_subnet_ip": "输入一个 IP 地址,其须位于子网\"{{cidr}}\"",
"form_enter_mac": "输入 MAC",
"form_enter_id": "输入标识符",
"form_add_id": "添加标识符",

View File

@@ -58,7 +58,7 @@
"dhcp_warning": "如果您無論如何想要啟用動態主機設定協定DHCP伺服器確保在您的網路中無其它現行的 DHCP 伺服器,因為對於該網路上的裝置,這可能破壞其網際網路連線!",
"dhcp_error": "AdGuard Home 無法確定於該網路上是否有另外現行的動態主機設定協定DHCP伺服器。",
"dhcp_static_ip_error": "為了使用動態主機設定協定DHCP伺服器靜態 IP 位址必須被設定。AdGuard Home 未能確定此網路介面是否被配置使用靜態 IP 位址。請手動地設定靜態 IP 位址。",
"dhcp_dynamic_ip_found": "您的系統使用動態 IP 位址配置供介面 <0>{{interfaceName}}</0>。為了使用動態主機設定協定DHCP伺服器靜態 IP 位址必須被設定。您現行的 IP 位址為 <0>{{ipAddress}}</0>。如果您按\"啟用 DHCP\" 按鈕AdGuard Home 將自動地設定此 IP 位址作為靜態。",
"dhcp_dynamic_ip_found": "您的系統使用動態 IP 位址配置供介面 <0>{{interfaceName}}</0>。為了使用動態主機設定協定DHCP伺服器靜態 IP 位址必須被設定。您現行的 IP 位址為 <0>{{ipAddress}}</0>。如果您按\"啟用 DHCP 伺服器\" 按鈕AdGuard Home 將自動地設定此 IP 位址作為靜態。",
"dhcp_lease_added": "靜態租約 \"{{key}}\" 被成功地加入",
"dhcp_lease_deleted": "靜態租約 \"{{key}}\" 被成功地刪除",
"dhcp_new_static_lease": "新的靜態租約",
@@ -311,7 +311,7 @@
"install_devices_router": "路由器",
"install_devices_router_desc": "此設置將自動地涵蓋所有被連線至您的家庭路由器之裝置,且您將無需手動地配置它們每個。",
"install_devices_address": "AdGuard Home DNS 伺服器正在監聽下列的位址",
"install_devices_router_list_1": "開啟用於您的路由器之偏好設定。通常地,您可透過網址,諸如 http://192.168.0.1/ 或 http://192.168.1.1/,從您的瀏覽器中存取它。您可能被提醒輸入密碼。如果您不記得它,您經常可透過按壓於該路由器本身上的按鈕來重置密碼,但請明白如果此步驟被選擇,您將可能失去整個路由器配置。某些路由器需要特定的應用程式,既然如此其應已被安裝於您的電腦或手機上。",
"install_devices_router_list_1": "開啟用於您的路由器之偏好設定。通常地,您可透過網址,諸如 http://192.168.0.1/ 或 http://192.168.1.1/,從您的瀏覽器中存取它。您可能被提醒輸入密碼。如果您不記得它,您經常可透過按壓於該路由器本身上的按鈕來重置密碼,但請明白如果此步驟被選擇,您將可能失去整個路由器配置。如果您的路由器需要應用程式去設置它,請於您的手機或個人電腦上安裝該應用程式,並使用它來存取該路由器的設定。",
"install_devices_router_list_2": "找到 DHCP/DNS 設定。尋找緊鄰著允許兩組或三組數字集的欄位之 DNS 字母,每組被拆成四個含有一至三個數字的群集。",
"install_devices_router_list_3": "在那裡輸入您的 AdGuard Home 伺服器位址。",
"install_devices_router_list_4": "於某些路由器機型上,自訂的 DNS 伺服器無法被設置。在這種情況下,設置 AdGuard Home 作為 <0>DHCP</0> 伺服器可能有所幫助。否則,您應查明有關如何對您的特定路由器型號自訂 DNS 伺服器之路由器用法說明。",

15
go.mod
View File

@@ -3,11 +3,11 @@ module github.com/AdguardTeam/AdGuardHome
go 1.15
require (
github.com/AdguardTeam/dnsproxy v0.35.5
github.com/AdguardTeam/golibs v0.4.4
github.com/AdguardTeam/dnsproxy v0.37.1
github.com/AdguardTeam/golibs v0.4.5
github.com/AdguardTeam/urlfilter v0.14.4
github.com/NYTimes/gziphandler v1.1.1
github.com/ameshkov/dnscrypt/v2 v2.0.3
github.com/ameshkov/dnscrypt/v2 v2.1.3
github.com/digineo/go-ipset/v2 v2.2.1
github.com/fsnotify/fsnotify v1.4.9
github.com/go-ping/ping v0.0.0-20210216210419-25d1413fb7bb
@@ -16,15 +16,11 @@ require (
github.com/gobuffalo/packr/v2 v2.8.1 // indirect
github.com/google/go-cmp v0.5.5 // indirect
github.com/google/renameio v1.0.1-0.20210406141108-81588dbe0453
github.com/hugelgupf/socketpair v0.0.0-20190730060125-05d35a94e714
github.com/insomniacslk/dhcp v0.0.0-20210310193751-cfd4d47082c2
github.com/kardianos/service v1.2.0
github.com/karrick/godirwalk v1.16.1 // indirect
github.com/lucas-clemente/quic-go v0.19.3
github.com/marten-seemann/qtls-go1-15 v0.1.4 // indirect
github.com/mdlayher/ethernet v0.0.0-20190606142754-0394541c37b7
github.com/lucas-clemente/quic-go v0.20.1
github.com/mdlayher/netlink v1.4.0
github.com/mdlayher/raw v0.0.0-20191009151244-50f2db8cc065
github.com/miekg/dns v1.1.40
github.com/rogpeppe/go-internal v1.7.0 // indirect
github.com/satori/go.uuid v1.2.0
@@ -32,7 +28,6 @@ require (
github.com/spf13/cobra v1.1.3 // indirect
github.com/stretchr/testify v1.7.0
github.com/ti-mo/netfilter v0.4.0
github.com/u-root/u-root v7.0.0+incompatible
go.etcd.io/bbolt v1.3.5
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4
@@ -44,3 +39,5 @@ require (
gopkg.in/yaml.v2 v2.4.0
howett.net/plist v0.0.0-20201203080718-1454fab16a06
)
replace github.com/insomniacslk/dhcp => github.com/AdguardTeam/dhcp v0.0.0-20210420175708-50b0efd52063

40
go.sum
View File

@@ -18,12 +18,15 @@ dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBr
dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4=
dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU=
git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg=
github.com/AdguardTeam/dnsproxy v0.35.5 h1:SsRF0eDzuLGaSUDKABIu9Mn1joi4v4kvEU1vju2DQPQ=
github.com/AdguardTeam/dnsproxy v0.35.5/go.mod h1:dkI9VWh43XlOzF2XogDm1EmoVl7PANOR4isQV6X9LZs=
github.com/AdguardTeam/dhcp v0.0.0-20210420175708-50b0efd52063 h1:RBsQppxEJEqHApY6WDBkM2H0UG5wt57RcT0El2WGdp8=
github.com/AdguardTeam/dhcp v0.0.0-20210420175708-50b0efd52063/go.mod h1:TKl4jN3Voofo4UJIicyNhWGp/nlQqQkFxmwIFTvBkKI=
github.com/AdguardTeam/dnsproxy v0.37.1 h1:vULyF1+xSI7vV99m8GD2hmOuCQrpu87awyeSe5qtFbA=
github.com/AdguardTeam/dnsproxy v0.37.1/go.mod h1:xkJWEuTr550gPDmB9azsciKZzSXjf9wMn+Ji54PQ4gE=
github.com/AdguardTeam/golibs v0.4.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
github.com/AdguardTeam/golibs v0.4.2/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
github.com/AdguardTeam/golibs v0.4.4 h1:cM9UySQiYFW79zo5XRwnaIWVzfW4eNXmZktMrWbthpw=
github.com/AdguardTeam/golibs v0.4.4/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
github.com/AdguardTeam/golibs v0.4.5 h1:RRA9ZsmbJEN4OllAx0BcfvSbRBxxpWluJijBYmtp13U=
github.com/AdguardTeam/golibs v0.4.5/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
github.com/AdguardTeam/gomitmproxy v0.2.0/go.mod h1:Qdv0Mktnzer5zpdpi5rAwixNJzW2FN91LjKJCkVbYGU=
github.com/AdguardTeam/urlfilter v0.14.4 h1:lrS7lrfxVCFh4TFB6nwPp5UE4n1XNvv3zUetduD9mZw=
github.com/AdguardTeam/urlfilter v0.14.4/go.mod h1:klx4JbOfc4EaNb5lWLqOwfg+pVcyRukmoJRvO55lL5U=
@@ -41,9 +44,8 @@ github.com/aead/poly1305 v0.0.0-20180717145839-3fee0db0b635 h1:52m0LGchQBBVqJRyY
github.com/aead/poly1305 v0.0.0-20180717145839-3fee0db0b635/go.mod h1:lmLxL+FV291OopO93Bwf9fQLQeLyt33VJRUg5VJ30us=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/ameshkov/dnscrypt/v2 v2.0.1/go.mod h1:nbZnxJt4edIPx2Haa8n2XtC2g5AWcsdQiSuXkNH8eDI=
github.com/ameshkov/dnscrypt/v2 v2.0.3 h1:PE6VVc8QUMYJv9dTwcDcX5cYXf58XPi1WVPHrLf8MDs=
github.com/ameshkov/dnscrypt/v2 v2.0.3/go.mod h1:nbZnxJt4edIPx2Haa8n2XtC2g5AWcsdQiSuXkNH8eDI=
github.com/ameshkov/dnscrypt/v2 v2.1.3 h1:DG4Uf7LSDg6XDj9sp3maxh3Ur26jeGQaP5MeYosn6v0=
github.com/ameshkov/dnscrypt/v2 v2.1.3/go.mod h1:+8SbPbVXpxxcUsgGi8eodkqWPo1MyNHxKYC8hDpqLSo=
github.com/ameshkov/dnsstamps v1.0.1/go.mod h1:Ii3eUu73dx4Vw5O4wjzmT5+lkCwovjzaEZZ4gKyIH5A=
github.com/ameshkov/dnsstamps v1.0.3 h1:Srzik+J9mivH1alRACTbys2xOxs0lRH9qnTA7Y1OYVo=
github.com/ameshkov/dnsstamps v1.0.3/go.mod h1:Ii3eUu73dx4Vw5O4wjzmT5+lkCwovjzaEZZ4gKyIH5A=
@@ -126,15 +128,13 @@ github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7a
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20191027212112-611e8accdfc9/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc=
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
github.com/golang/mock v1.5.0 h1:jlYHihg//f7RRwuPfptm04yp4s7O6Kw8EZiVYIGcH0g=
github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
@@ -203,9 +203,6 @@ github.com/hugelgupf/socketpair v0.0.0-20190730060125-05d35a94e714 h1:/jC7qQFrv8
github.com/hugelgupf/socketpair v0.0.0-20190730060125-05d35a94e714/go.mod h1:2Goc3h8EklBH5mspfHFxBnEoURQCGzQQH1ga9Myjvis=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/insomniacslk/dhcp v0.0.0-20210310193751-cfd4d47082c2 h1:NpTIlXznCStsY88jU+Gh1Dy5dt/jYV4z4uU8h2TUOt4=
github.com/insomniacslk/dhcp v0.0.0-20210310193751-cfd4d47082c2/go.mod h1:TKl4jN3Voofo4UJIicyNhWGp/nlQqQkFxmwIFTvBkKI=
github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
@@ -246,8 +243,8 @@ github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/lucas-clemente/quic-go v0.19.3 h1:eCDQqvGBB+kCTkA0XrAFtNe81FMa0/fn4QSoeAbmiF4=
github.com/lucas-clemente/quic-go v0.19.3/go.mod h1:ADXpNbTQjq1hIzCpB+y/k5iz4n4z4IwqoLb94Kh5Hu8=
github.com/lucas-clemente/quic-go v0.20.1 h1:hb5m76V8QS/8Nw/suHvXqo3BMHAozvIkcnzpJdpanSk=
github.com/lucas-clemente/quic-go v0.20.1/go.mod h1:fZq/HUDIM+mW6X6wtzORjC0E/WDBMKe5Hf9bgjISwLk=
github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
@@ -259,11 +256,10 @@ github.com/markbates/oncer v1.0.0/go.mod h1:Z59JA581E9GP6w96jai+TGqafHPW+cPfRxz2
github.com/markbates/safe v1.0.1 h1:yjZkbvRM6IzKj9tlu/zMJLS0n/V351OZWRnF3QfaUxI=
github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0=
github.com/marten-seemann/qpack v0.2.1/go.mod h1:F7Gl5L1jIgN1D11ucXefiuJS9UMVP2opoCp2jDKb7wc=
github.com/marten-seemann/qtls v0.10.0 h1:ECsuYUKalRL240rRD4Ri33ISb7kAQ3qGDlrrl55b2pc=
github.com/marten-seemann/qtls v0.10.0/go.mod h1:UvMd1oaYDACI99/oZUYLzMCkBXQVT0aGm99sJhbT8hs=
github.com/marten-seemann/qtls-go1-15 v0.1.1/go.mod h1:GyFwywLKkRt+6mfU99csTEY1joMZz5vmB1WNZH3P81I=
github.com/marten-seemann/qtls-go1-15 v0.1.4 h1:RehYMOyRW8hPVEja1KBVsFVNSm35Jj9Mvs5yNoZZ28A=
github.com/marten-seemann/qtls-go1-15 v0.1.4/go.mod h1:GyFwywLKkRt+6mfU99csTEY1joMZz5vmB1WNZH3P81I=
github.com/marten-seemann/qtls-go1-16 v0.1.3 h1:XEZ1xGorVy9u+lJq+WXNE+hiqRYLNvJGYmwfwKQN2gU=
github.com/marten-seemann/qtls-go1-16 v0.1.3/go.mod h1:gNpI2Ol+lRS3WwSOtIUUtRwZEQMXjYK+dQSBFbethAk=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
@@ -290,7 +286,6 @@ github.com/mdlayher/raw v0.0.0-20191009151244-50f2db8cc065 h1:aFkJ6lx4FPip+S+Uw4
github.com/mdlayher/raw v0.0.0-20191009151244-50f2db8cc065/go.mod h1:7EpbotpCmVZcu+KCX4g9WaRNuu11uyhiW7+Le1dKawg=
github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4=
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/miekg/dns v1.1.29/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM=
github.com/miekg/dns v1.1.35/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM=
github.com/miekg/dns v1.1.40 h1:pyyPFfGMnciYUk/mXpKkVmeMQjfXqt3FAJ2hy7tPiLA=
github.com/miekg/dns v1.1.40/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM=
@@ -436,7 +431,6 @@ go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
@@ -480,6 +474,7 @@ golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKG
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -576,8 +571,8 @@ golang.org/x/sys v0.0.0-20201101102859-da207088b7d1/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20201112073958-5cba982894dd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201118182958-a01c418693c7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201214095126-aec9a390925b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201218084310-7d0127a74742/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201231184435-2d18734c6014/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210110051926-789bb1bd4061/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210123111255-9b0068b26619/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -588,7 +583,6 @@ golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXR
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d h1:SZxvLBoTP5yHO3Frd4z4vrF+DBX9vMVanchswa69toE=
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
@@ -710,7 +704,5 @@ honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt
howett.net/plist v0.0.0-20201203080718-1454fab16a06 h1:QDxUo/w2COstK1wIBYpzQlHX/NqaQTcf9jyz347nI58=
howett.net/plist v0.0.0-20201203080718-1454fab16a06/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck=
sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0=

View File

@@ -3,12 +3,26 @@ package aghnet
import (
"fmt"
"net"
"strconv"
"strings"
"github.com/AdguardTeam/AdGuardHome/internal/agherr"
"golang.org/x/net/idna"
)
// IsValidHostOuterRune returns true if r is a valid initial or final rune for
// a hostname label.
func IsValidHostOuterRune(r rune) (ok bool) {
return (r >= 'a' && r <= 'z') ||
(r >= 'A' && r <= 'Z') ||
(r >= '0' && r <= '9')
}
// isValidHostRune returns true if r is a valid rune for a hostname label.
func isValidHostRune(r rune) (ok bool) {
return r == '-' || IsValidHostOuterRune(r)
}
// ValidateHardwareAddress returns an error if hwa is not a valid EUI-48,
// EUI-64, or 20-octet InfiniBand link-layer address.
func ValidateHardwareAddress(hwa net.HardwareAddr) (err error) {
@@ -36,38 +50,32 @@ const maxDomainNameLen = 253
const invalidCharMsg = "invalid char %q at index %d in %q"
// isValidHostFirstRune returns true if r is a valid first rune for a hostname
// label.
func isValidHostFirstRune(r rune) (ok bool) {
return (r >= 'a' && r <= 'z') ||
(r >= 'A' && r <= 'Z') ||
(r >= '0' && r <= '9')
}
// isValidHostRune returns true if r is a valid rune for a hostname label.
func isValidHostRune(r rune) (ok bool) {
return r == '-' || isValidHostFirstRune(r)
}
// ValidateDomainNameLabel returns an error if label is not a valid label of
// a domain name.
func ValidateDomainNameLabel(label string) (err error) {
if len(label) > maxDomainLabelLen {
l := len(label)
if l > maxDomainLabelLen {
return fmt.Errorf("%q is too long, max: %d", label, maxDomainLabelLen)
} else if len(label) == 0 {
} else if l == 0 {
return agherr.Error("label is empty")
}
if r := label[0]; !isValidHostFirstRune(rune(r)) {
if r := label[0]; !IsValidHostOuterRune(rune(r)) {
return fmt.Errorf(invalidCharMsg, r, 0, label)
} else if l == 1 {
return nil
}
for i, r := range label[1:] {
for i, r := range label[1 : l-1] {
if !isValidHostRune(r) {
return fmt.Errorf(invalidCharMsg, r, i+1, label)
}
}
if r := label[l-1]; !IsValidHostOuterRune(rune(r)) {
return fmt.Errorf(invalidCharMsg, r, l-1, label)
}
return nil
}
@@ -85,7 +93,9 @@ func ValidateDomainName(name string) (err error) {
}
l := len(name)
if l == 0 || l > maxDomainNameLen {
if l == 0 {
return agherr.Error("domain name is empty")
} else if l > maxDomainNameLen {
return fmt.Errorf("%q is too long, max: %d", name, maxDomainNameLen)
}
@@ -99,3 +109,59 @@ func ValidateDomainName(name string) (err error) {
return nil
}
// The maximum lengths of generated hostnames for different IP versions.
const (
ipv4HostnameMaxLen = len("192-168-100-10-")
ipv6HostnameMaxLen = len("ff80-f076-0000-0000-0000-0000-0000-0010")
)
// generateIPv4Hostname generates the hostname for specific IP version.
func generateIPv4Hostname(ipv4 net.IP) (hostname string) {
hnData := make([]byte, 0, ipv4HostnameMaxLen)
for i, part := range ipv4 {
if i > 0 {
hnData = append(hnData, '-')
}
hnData = strconv.AppendUint(hnData, uint64(part), 10)
}
return string(hnData)
}
// generateIPv6Hostname generates the hostname for specific IP version.
func generateIPv6Hostname(ipv6 net.IP) (hostname string) {
hnData := make([]byte, 0, ipv6HostnameMaxLen)
for i, partsNum := 0, net.IPv6len/2; i < partsNum; i++ {
if i > 0 {
hnData = append(hnData, '-')
}
for _, val := range ipv6[i*2 : i*2+2] {
if val < 10 {
hnData = append(hnData, '0')
}
hnData = strconv.AppendUint(hnData, uint64(val), 16)
}
}
return string(hnData)
}
// GenerateHostname generates the hostname from ip. In case of using IPv4 the
// result should be like:
//
// 192-168-10-1
//
// In case of using IPv6, the result is like:
//
// ff80-f076-0000-0000-0000-0000-0000-0010
//
func GenerateHostname(ip net.IP) (hostname string) {
if ipv4 := ip.To4(); ipv4 != nil {
return generateIPv4Hostname(ipv4)
} else if ipv6 := ip.To16(); ipv6 != nil {
return generateIPv6Hostname(ipv6)
}
return ""
}

View File

@@ -88,6 +88,14 @@ func TestValidateDomainName(t *testing.T) {
name: "success_idna",
in: "пример.рф",
wantErrMsg: "",
}, {
name: "success_one",
in: "e",
wantErrMsg: "",
}, {
name: "empty",
in: "",
wantErrMsg: `domain name is empty`,
}, {
name: "bad_symbol",
in: "!!!",
@@ -111,6 +119,11 @@ func TestValidateDomainName(t *testing.T) {
in: "example.-aa.com",
wantErrMsg: `invalid domain name label at index 1:` +
` invalid char '-' at index 0 in "-aa"`,
}, {
name: "bad_label_last_symbol",
in: "example-.aa.com",
wantErrMsg: `invalid domain name label at index 0:` +
` invalid char '-' at index 7 in "example-"`,
}, {
name: "bad_label_symbol",
in: "example.a!!!.com",
@@ -131,3 +144,43 @@ func TestValidateDomainName(t *testing.T) {
})
}
}
func TestGenerateHostName(t *testing.T) {
testCases := []struct {
name string
want string
ip net.IP
}{{
name: "good_ipv4",
want: "127-0-0-1",
ip: net.IP{127, 0, 0, 1},
}, {
name: "bad_ipv4",
want: "",
ip: net.IP{127, 0, 0, 1, 0},
}, {
name: "good_ipv6",
want: "fe00-0000-0000-0000-0000-0000-0000-0001",
ip: net.ParseIP("fe00::1"),
}, {
name: "bad_ipv6",
want: "",
ip: net.IP{
0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff,
},
}, {
name: "nil",
want: "",
ip: nil,
}}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
hostname := GenerateHostname(tc.ip)
assert.Equal(t, tc.want, hostname)
})
}
}

View File

@@ -15,9 +15,6 @@ import (
// implementation must be safe for concurrent use.
type HostGenFunc func() (host string)
// unit is an alias for an existing map value.
type unit = struct{}
// SystemResolvers helps to work with local resolvers' addresses provided by OS.
type SystemResolvers interface {
// Get returns the slice of local resolvers' addresses.

View File

@@ -11,6 +11,7 @@ import (
"time"
"github.com/AdguardTeam/AdGuardHome/internal/agherr"
"github.com/AdguardTeam/AdGuardHome/internal/aghstrings"
)
// defaultHostGen is the default method of generating host for Refresh.
@@ -24,8 +25,8 @@ type systemResolvers struct {
resolver *net.Resolver
hostGenFunc HostGenFunc
// addrs is the map that contains cached local resolvers' addresses.
addrs map[string]unit
// addrs is the set that contains cached local resolvers' addresses.
addrs *aghstrings.Set
addrsLock sync.RWMutex
}
@@ -50,7 +51,7 @@ func newSystemResolvers(refreshIvl time.Duration, hostGenFunc HostGenFunc) (sr S
PreferGo: true,
},
hostGenFunc: hostGenFunc,
addrs: make(map[string]unit),
addrs: aghstrings.NewSet(),
}
s.resolver.Dial = s.dialFunc
@@ -75,7 +76,7 @@ func (sr *systemResolvers) dialFunc(_ context.Context, _, address string) (_ net
sr.addrsLock.Lock()
defer sr.addrsLock.Unlock()
sr.addrs[host] = unit{}
sr.addrs.Add(host)
return nil, fakeDialErr
}
@@ -84,13 +85,5 @@ func (sr *systemResolvers) Get() (rs []string) {
sr.addrsLock.RLock()
defer sr.addrsLock.RUnlock()
addrs := sr.addrs
rs = make([]string, len(addrs))
var i int
for addr := range addrs {
rs[i] = addr
i++
}
return rs
return sr.addrs.Values()
}

View File

@@ -0,0 +1,71 @@
package aghstrings
// unit is a convenient alias for struct{}
type unit = struct{}
// Set is a set of strings.
type Set struct {
m map[string]unit
}
// NewSet returns a new string set containing strs.
func NewSet(strs ...string) (set *Set) {
set = &Set{
m: make(map[string]unit, len(strs)),
}
for _, s := range strs {
set.Add(s)
}
return set
}
// Add adds s to the set. Add panics if the set is a nil set, just like a nil
// map does.
func (set *Set) Add(s string) {
set.m[s] = unit{}
}
// Del deletes s from the set. Calling Del on a nil set has no effect, just
// like delete on an empty map doesn't.
func (set *Set) Del(s string) {
if set != nil {
delete(set.m, s)
}
}
// Has returns true if s is in the set. Calling Has on a nil set returns false,
// just like indexing on an empty map does.
func (set *Set) Has(s string) (ok bool) {
if set != nil {
_, ok = set.m[s]
}
return ok
}
// Len returns the length of the set. A nil set has a length of zero, just like
// an empty map.
func (set *Set) Len() (n int) {
if set == nil {
return 0
}
return len(set.m)
}
// Values returns all values in the set. The order of the values is undefined.
// Values returns nil if the set is nil.
func (set *Set) Values() (strs []string) {
if set == nil {
return nil
}
strs = make([]string, 0, len(set.m))
for s := range set.m {
strs = append(strs, s)
}
return strs
}

View File

@@ -0,0 +1,56 @@
package aghstrings
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestSet(t *testing.T) {
const s = "a"
t.Run("nil", func(t *testing.T) {
var set *Set
assert.NotPanics(t, func() {
set.Del(s)
})
assert.NotPanics(t, func() {
assert.False(t, set.Has(s))
})
assert.NotPanics(t, func() {
assert.Equal(t, 0, set.Len())
})
assert.NotPanics(t, func() {
assert.Nil(t, set.Values())
})
assert.Panics(t, func() {
set.Add(s)
})
})
t.Run("non_nil", func(t *testing.T) {
set := NewSet()
assert.Equal(t, 0, set.Len())
ok := set.Has(s)
assert.False(t, ok)
set.Add(s)
ok = set.Has(s)
assert.True(t, ok)
assert.Equal(t, []string{s}, set.Values())
set.Del(s)
ok = set.Has(s)
assert.False(t, ok)
set = NewSet(s)
assert.Equal(t, 1, set.Len())
})
}

View File

@@ -10,9 +10,9 @@ import (
"runtime"
"time"
"github.com/AdguardTeam/AdGuardHome/internal/dhcpd/nclient4"
"github.com/AdguardTeam/golibs/log"
"github.com/insomniacslk/dhcp/dhcpv4"
"github.com/insomniacslk/dhcp/dhcpv4/nclient4"
"github.com/insomniacslk/dhcp/dhcpv6"
"github.com/insomniacslk/dhcp/dhcpv6/nclient6"
"github.com/insomniacslk/dhcp/iana"

View File

@@ -115,6 +115,7 @@ const (
LeaseChangedAdded = iota
LeaseChangedAddedStatic
LeaseChangedRemovedStatic
LeaseChangedRemovedAll
LeaseChangedDBStore
)
@@ -241,16 +242,14 @@ func (s *Server) WriteDiskConfig(c *ServerConfig) {
}
// Start will listen on port 67 and serve DHCP requests.
func (s *Server) Start() error {
err := s.srv4.Start()
func (s *Server) Start() (err error) {
err = s.srv4.Start()
if err != nil {
log.Error("DHCPv4: start: %s", err)
return err
}
err = s.srv6.Start()
if err != nil {
log.Error("DHCPv6: start: %s", err)
return err
}

View File

@@ -110,3 +110,8 @@ func (r *ipRange) offset(ip net.IP) (offset uint64, ok bool) {
// construction.
return offsetInt.Uint64(), true
}
// String implements the fmt.Stringer interface for *ipRange.
func (r *ipRange) String() (s string) {
return fmt.Sprintf("%s-%s", r.start, r.end)
}

View File

@@ -1,554 +0,0 @@
// Copyright 2018 the u-root Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
// +build go1.12
// Package nclient4 is a small, minimum-functionality client for DHCPv4.
//
// It only supports the 4-way DHCPv4 Discover-Offer-Request-Ack handshake as
// well as the Request-Ack renewal process.
// Originally from here: github.com/insomniacslk/dhcp/dhcpv4/nclient4
// with the difference that this package can be built on UNIX (not just Linux),
// because github.com/mdlayher/raw package supports it.
package nclient4
import (
"bytes"
"context"
"errors"
"fmt"
"net"
"sync"
"sync/atomic"
"time"
"github.com/insomniacslk/dhcp/dhcpv4"
)
const (
defaultBufferCap = 5
// DefaultTimeout is the default value for read-timeout if option WithTimeout is not set
DefaultTimeout = 5 * time.Second
// DefaultRetries is amount of retries will be done if no answer was received within read-timeout amount of time
DefaultRetries = 3
// MaxMessageSize is the value to be used for DHCP option "MaxMessageSize".
MaxMessageSize = 1500
// ClientPort is the port that DHCP clients listen on.
ClientPort = 68
// ServerPort is the port that DHCP servers and relay agents listen on.
ServerPort = 67
)
// DefaultServers is the address of all link-local DHCP servers and
// relay agents.
var DefaultServers = &net.UDPAddr{
IP: net.IPv4bcast,
Port: ServerPort,
}
var (
// ErrNoResponse is returned when no response packet is received.
ErrNoResponse = errors.New("no matching response packet received")
// ErrNoConn is returned when NewWithConn is called with nil-value as conn.
ErrNoConn = errors.New("conn is nil")
// ErrNoIfaceHWAddr is returned when NewWithConn is called with nil-value as ifaceHWAddr
ErrNoIfaceHWAddr = errors.New("ifaceHWAddr is nil")
)
// pendingCh is a channel associated with a pending TransactionID.
type pendingCh struct {
// SendAndRead closes done to indicate that it wishes for no more
// messages for this particular XID.
done <-chan struct{}
// ch is used by the receive loop to distribute DHCP messages.
ch chan<- *dhcpv4.DHCPv4
}
// Logger is a handler which will be used to output logging messages
type Logger interface {
// PrintMessage print _all_ DHCP messages
PrintMessage(prefix string, message *dhcpv4.DHCPv4)
// Printf is use to print the rest debugging information
Printf(format string, v ...interface{})
}
// EmptyLogger prints nothing
type EmptyLogger struct{}
// Printf is just a dummy function that does nothing
func (e EmptyLogger) Printf(format string, v ...interface{}) {}
// PrintMessage is just a dummy function that does nothing
func (e EmptyLogger) PrintMessage(prefix string, message *dhcpv4.DHCPv4) {}
// Printfer is used for actual output of the logger. For example *log.Logger is a Printfer.
type Printfer interface {
// Printf is the function for logging output. Arguments are handled in the manner of fmt.Printf.
Printf(format string, v ...interface{})
}
// ShortSummaryLogger is a wrapper for Printfer to implement interface Logger.
// DHCP messages are printed in the short format.
type ShortSummaryLogger struct {
// Printfer is used for actual output of the logger
Printfer
}
// Printf prints a log message as-is via predefined Printfer
func (s ShortSummaryLogger) Printf(format string, v ...interface{}) {
s.Printfer.Printf(format, v...)
}
// PrintMessage prints a DHCP message in the short format via predefined Printfer
func (s ShortSummaryLogger) PrintMessage(prefix string, message *dhcpv4.DHCPv4) {
s.Printf("%s: %s", prefix, message)
}
// DebugLogger is a wrapper for Printfer to implement interface Logger.
// DHCP messages are printed in the long format.
type DebugLogger struct {
// Printfer is used for actual output of the logger
Printfer
}
// Printf prints a log message as-is via predefined Printfer
func (d DebugLogger) Printf(format string, v ...interface{}) {
d.Printfer.Printf(format, v...)
}
// PrintMessage prints a DHCP message in the long format via predefined Printfer
func (d DebugLogger) PrintMessage(prefix string, message *dhcpv4.DHCPv4) {
d.Printf("%s: %s", prefix, message.Summary())
}
// Client is an IPv4 DHCP client.
type Client struct {
ifaceHWAddr net.HardwareAddr
conn net.PacketConn
timeout time.Duration
retry int
logger Logger
// bufferCap is the channel capacity for each TransactionID.
bufferCap int
// serverAddr is the UDP address to send all packets to.
//
// This may be an actual broadcast address, or a unicast address.
serverAddr *net.UDPAddr
// closed is an atomic bool set to 1 when done is closed.
closed uint32
// done is closed to unblock the receive loop.
done chan struct{}
// wg protects any spawned goroutines, namely the receiveLoop.
wg sync.WaitGroup
pendingMu sync.Mutex
// pending stores the distribution channels for each pending
// TransactionID. receiveLoop uses this map to determine which channel
// to send a new DHCP message to.
pending map[dhcpv4.TransactionID]*pendingCh
}
// New returns a client usable with an unconfigured interface.
func New(iface string, opts ...ClientOpt) (*Client, error) {
return new(iface, nil, nil, opts...)
}
// NewWithConn creates a new DHCP client that sends and receives packets on the
// given interface.
func NewWithConn(conn net.PacketConn, ifaceHWAddr net.HardwareAddr, opts ...ClientOpt) (*Client, error) {
return new(``, conn, ifaceHWAddr, opts...)
}
func new(iface string, conn net.PacketConn, ifaceHWAddr net.HardwareAddr, opts ...ClientOpt) (*Client, error) {
c := &Client{
ifaceHWAddr: ifaceHWAddr,
timeout: DefaultTimeout,
retry: DefaultRetries,
serverAddr: DefaultServers,
bufferCap: defaultBufferCap,
conn: conn,
logger: EmptyLogger{},
done: make(chan struct{}),
pending: make(map[dhcpv4.TransactionID]*pendingCh),
}
for _, opt := range opts {
err := opt(c)
if err != nil {
return nil, fmt.Errorf("unable to apply option: %w", err)
}
}
if c.ifaceHWAddr == nil {
if iface == `` {
return nil, ErrNoIfaceHWAddr
}
i, err := net.InterfaceByName(iface)
if err != nil {
return nil, fmt.Errorf("unable to get interface information: %w", err)
}
c.ifaceHWAddr = i.HardwareAddr
}
if c.conn == nil {
var err error
if iface == `` {
return nil, ErrNoConn
}
c.conn, err = NewRawUDPConn(iface, ClientPort) // broadcast
if err != nil {
return nil, fmt.Errorf("unable to open a broadcasting socket: %w", err)
}
}
c.wg.Add(1)
go c.receiveLoop()
return c, nil
}
// Close closes the underlying connection.
func (c *Client) Close() error {
// Make sure not to close done twice.
if !atomic.CompareAndSwapUint32(&c.closed, 0, 1) {
return nil
}
err := c.conn.Close()
// Closing c.done sets off a chain reaction:
//
// Any SendAndRead unblocks trying to receive more messages, which
// means rem() gets called.
//
// rem() should be unblocking receiveLoop if it is blocked.
//
// receiveLoop should then exit gracefully.
close(c.done)
// Wait for receiveLoop to stop.
c.wg.Wait()
return err
}
func (c *Client) isClosed() bool {
return atomic.LoadUint32(&c.closed) != 0
}
func (c *Client) receiveLoop() {
defer c.wg.Done()
for {
// TODO: Clients can send a "max packet size" option in their
// packets, IIRC. Choose a reasonable size and set it.
b := make([]byte, MaxMessageSize)
n, _, err := c.conn.ReadFrom(b)
if err != nil {
if !c.isClosed() {
c.logger.Printf("error reading from UDP connection: %v", err)
}
return
}
msg, err := dhcpv4.FromBytes(b[:n])
if err != nil {
// Not a valid DHCP packet; keep listening.
continue
}
if msg.OpCode != dhcpv4.OpcodeBootReply {
// Not a response message.
continue
}
// This is a somewhat non-standard check, by the looks
// of RFC 2131. It should work as long as the DHCP
// server is spec-compliant for the HWAddr field.
if c.ifaceHWAddr != nil && !bytes.Equal(c.ifaceHWAddr, msg.ClientHWAddr) {
// Not for us.
continue
}
c.pendingMu.Lock()
p, ok := c.pending[msg.TransactionID]
if ok {
select {
case <-p.done:
close(p.ch)
delete(c.pending, msg.TransactionID)
// This send may block.
case p.ch <- msg:
}
}
c.pendingMu.Unlock()
}
}
// ClientOpt is a function that configures the Client.
type ClientOpt func(c *Client) error
// WithTimeout configures the retransmission timeout.
//
// Default is 5 seconds.
func WithTimeout(d time.Duration) ClientOpt {
return func(c *Client) (err error) {
c.timeout = d
return
}
}
// WithLogger set the logger (see interface Logger).
func WithLogger(newLogger Logger) ClientOpt {
return func(c *Client) (err error) {
c.logger = newLogger
return
}
}
// WithUnicast forces client to send messages as unicast frames.
// By default client sends messages as broadcast frames even if server address is defined.
//
// srcAddr is both:
// * The source address of outgoing frames.
// * The address to be listened for incoming frames.
func WithUnicast(srcAddr *net.UDPAddr) ClientOpt {
return func(c *Client) (err error) {
if srcAddr == nil {
srcAddr = &net.UDPAddr{Port: ServerPort}
}
c.conn, err = net.ListenUDP("udp4", srcAddr)
if err != nil {
err = fmt.Errorf("unable to start listening UDP port: %w", err)
}
return
}
}
// WithHWAddr tells to the Client to receive messages destinated to selected
// hardware address
func WithHWAddr(hwAddr net.HardwareAddr) ClientOpt {
return func(c *Client) (err error) {
c.ifaceHWAddr = hwAddr
return
}
}
// WithRetry configures the number of retransmissions to attempt.
//
// Default is 3.
func WithRetry(r int) ClientOpt {
return func(c *Client) (err error) {
c.retry = r
return
}
}
// WithServerAddr configures the address to send messages to.
func WithServerAddr(n *net.UDPAddr) ClientOpt {
return func(c *Client) (err error) {
c.serverAddr = n
return
}
}
// Matcher matches DHCP packets.
type Matcher func(*dhcpv4.DHCPv4) bool
// IsMessageType returns a matcher that checks for the message type.
//
// If t is MessageTypeNone, all packets are matched.
func IsMessageType(t dhcpv4.MessageType) Matcher {
return func(p *dhcpv4.DHCPv4) bool {
return p.MessageType() == t || t == dhcpv4.MessageTypeNone
}
}
// DiscoverOffer sends a DHCPDiscover message and returns the first valid offer
// received.
func (c *Client) DiscoverOffer(ctx context.Context, modifiers ...dhcpv4.Modifier) (offer *dhcpv4.DHCPv4, err error) {
// RFC 2131, Section 4.4.1, Table 5 details what a DISCOVER packet should
// contain.
discover, err := dhcpv4.NewDiscovery(c.ifaceHWAddr, dhcpv4.PrependModifiers(modifiers,
dhcpv4.WithOption(dhcpv4.OptMaxMessageSize(MaxMessageSize)))...)
if err != nil {
err = fmt.Errorf("unable to create a discovery request: %w", err)
return
}
offer, err = c.SendAndRead(ctx, c.serverAddr, discover, IsMessageType(dhcpv4.MessageTypeOffer))
if err != nil {
err = fmt.Errorf("got an error while the discovery request: %w", err)
return
}
return
}
// Request completes the 4-way Discover-Offer-Request-Ack handshake.
//
// Note that modifiers will be applied *both* to Discover and Request packets.
func (c *Client) Request(ctx context.Context, modifiers ...dhcpv4.Modifier) (offer, ack *dhcpv4.DHCPv4, err error) {
offer, err = c.DiscoverOffer(ctx, modifiers...)
if err != nil {
err = fmt.Errorf("unable to receive an offer: %w", err)
return
}
// TODO(chrisko): should this be unicast to the server?
request, err := dhcpv4.NewRequestFromOffer(offer, dhcpv4.PrependModifiers(modifiers,
dhcpv4.WithOption(dhcpv4.OptMaxMessageSize(MaxMessageSize)))...)
if err != nil {
err = fmt.Errorf("unable to create a request: %w", err)
return
}
ack, err = c.SendAndRead(ctx, c.serverAddr, request, nil)
if err != nil {
err = fmt.Errorf("got an error while processing the request: %w", err)
return
}
return
}
// ErrTransactionIDInUse is returned if there were an attempt to send a message
// with the same TransactionID as we are already waiting an answer for.
type ErrTransactionIDInUse struct {
// TransactionID is the transaction ID of the message which the error is related to.
TransactionID dhcpv4.TransactionID
}
// Error is just the method to comply interface "error".
func (err *ErrTransactionIDInUse) Error() string {
return fmt.Sprintf("transaction ID %s already in use", err.TransactionID)
}
// send sends p to destination and returns a response channel.
//
// Responses will be matched by transaction ID and ClientHWAddr.
//
// The returned lambda function must be called after all desired responses have
// been received in order to return the Transaction ID to the usable pool.
func (c *Client) send(dest *net.UDPAddr, msg *dhcpv4.DHCPv4) (resp <-chan *dhcpv4.DHCPv4, cancel func(), err error) {
c.pendingMu.Lock()
if _, ok := c.pending[msg.TransactionID]; ok {
c.pendingMu.Unlock()
return nil, nil, &ErrTransactionIDInUse{msg.TransactionID}
}
ch := make(chan *dhcpv4.DHCPv4, c.bufferCap)
done := make(chan struct{})
c.pending[msg.TransactionID] = &pendingCh{done: done, ch: ch}
c.pendingMu.Unlock()
cancel = func() {
// Why can't we just close ch here?
//
// Because receiveLoop may potentially be blocked trying to
// send on ch. We gotta unblock it first, and then we can take
// the lock and remove the XID from the pending transaction
// map.
close(done)
c.pendingMu.Lock()
if p, ok := c.pending[msg.TransactionID]; ok {
close(p.ch)
delete(c.pending, msg.TransactionID)
}
c.pendingMu.Unlock()
}
if _, err = c.conn.WriteTo(msg.ToBytes(), dest); err != nil {
cancel()
return nil, nil, fmt.Errorf("error writing packet to connection: %w", err)
}
return ch, cancel, nil
}
// This error should never be visible to users.
// It is used only to increase the timeout in retryFn.
var errDeadlineExceeded = errors.New("INTERNAL ERROR: deadline exceeded")
// SendAndRead sends a packet p to a destination dest and waits for the first
// response matching `match` as well as its Transaction ID and ClientHWAddr.
//
// If match is nil, the first packet matching the Transaction ID and
// ClientHWAddr is returned.
func (c *Client) SendAndRead(ctx context.Context, dest *net.UDPAddr, p *dhcpv4.DHCPv4, match Matcher) (*dhcpv4.DHCPv4, error) {
var response *dhcpv4.DHCPv4
err := c.retryFn(func(timeout time.Duration) error {
ch, rem, err := c.send(dest, p)
if err != nil {
return err
}
c.logger.PrintMessage("sent message", p)
defer rem()
for {
select {
case <-c.done:
return ErrNoResponse
case <-time.After(timeout):
return errDeadlineExceeded
case <-ctx.Done():
return ctx.Err()
case packet := <-ch:
if match == nil || match(packet) {
c.logger.PrintMessage("received message", packet)
response = packet
return nil
}
}
}
})
if err == errDeadlineExceeded {
return nil, ErrNoResponse
}
if err != nil {
return nil, err
}
return response, nil
}
func (c *Client) retryFn(fn func(timeout time.Duration) error) error {
timeout := c.timeout
// Each retry takes the amount of timeout at worst.
for i := 0; i < c.retry || c.retry < 0; i++ { // TODO: why is this called "retry" if this is "tries" ("retries"+1)?
switch err := fn(timeout); err {
case nil:
// Got it!
return nil
case errDeadlineExceeded:
// Double timeout, then retry.
timeout *= 2
default:
return err
}
}
return errDeadlineExceeded
}

View File

@@ -1,345 +0,0 @@
// Copyright 2018 the u-root Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build linux
// github.com/hugelgupf/socketpair is Linux-only
// +build go1.12
package nclient4
import (
"bytes"
"context"
"fmt"
"net"
"sync"
"testing"
"time"
"github.com/AdguardTeam/AdGuardHome/internal/aghtest"
"github.com/hugelgupf/socketpair"
"github.com/insomniacslk/dhcp/dhcpv4"
"github.com/insomniacslk/dhcp/dhcpv4/server4"
)
func TestMain(m *testing.M) {
aghtest.DiscardLogOutput(m)
}
type handler struct {
mu sync.Mutex
received []*dhcpv4.DHCPv4
// Each received packet can have more than one response (in theory,
// from different servers sending different Advertise, for example).
responses [][]*dhcpv4.DHCPv4
}
func (h *handler) handle(conn net.PacketConn, peer net.Addr, m *dhcpv4.DHCPv4) {
h.mu.Lock()
defer h.mu.Unlock()
h.received = append(h.received, m)
if len(h.responses) > 0 {
for _, resp := range h.responses[0] {
_, _ = conn.WriteTo(resp.ToBytes(), peer)
}
h.responses = h.responses[1:]
}
}
func serveAndClient(ctx context.Context, responses [][]*dhcpv4.DHCPv4, opts ...ClientOpt) (*Client, net.PacketConn) {
// Fake PacketConn connection.
clientRawConn, serverRawConn, err := socketpair.PacketSocketPair()
if err != nil {
panic(err)
}
clientConn := NewBroadcastUDPConn(clientRawConn, &net.UDPAddr{Port: ClientPort})
serverConn := NewBroadcastUDPConn(serverRawConn, &net.UDPAddr{Port: ServerPort})
o := []ClientOpt{WithRetry(1), WithTimeout(2 * time.Second)}
o = append(o, opts...)
mc, err := NewWithConn(clientConn, net.HardwareAddr{0xa, 0xb, 0xc, 0xd, 0xe, 0xf}, o...)
if err != nil {
panic(err)
}
h := &handler{responses: responses}
s, err := server4.NewServer("", nil, h.handle, server4.WithConn(serverConn))
if err != nil {
panic(err)
}
go func() {
_ = s.Serve()
}()
return mc, serverConn
}
func ComparePacket(got, want *dhcpv4.DHCPv4) error {
if got == nil && got == want {
return nil
}
if (want == nil || got == nil) && (got != want) {
return fmt.Errorf("packet got %v, want %v", got, want)
}
if !bytes.Equal(got.ToBytes(), want.ToBytes()) {
return fmt.Errorf("packet got %v, want %v", got, want)
}
return nil
}
func pktsExpected(got, want []*dhcpv4.DHCPv4) error {
if len(got) != len(want) {
return fmt.Errorf("got %d packets, want %d packets", len(got), len(want))
}
for i := range got {
if err := ComparePacket(got[i], want[i]); err != nil {
return err
}
}
return nil
}
func newPacketWeirdHWAddr(op dhcpv4.OpcodeType, xid dhcpv4.TransactionID) *dhcpv4.DHCPv4 {
p, err := dhcpv4.New()
if err != nil {
panic(fmt.Sprintf("newpacket: %v", err))
}
p.OpCode = op
p.TransactionID = xid
p.ClientHWAddr = net.HardwareAddr{0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 1, 2, 3, 4, 5, 6}
return p
}
func newPacket(op dhcpv4.OpcodeType, xid dhcpv4.TransactionID) *dhcpv4.DHCPv4 {
p, err := dhcpv4.New()
if err != nil {
panic(fmt.Sprintf("newpacket: %v", err))
}
p.OpCode = op
p.TransactionID = xid
p.ClientHWAddr = net.HardwareAddr{0xa, 0xb, 0xc, 0xd, 0xe, 0xf}
return p
}
func withBufferCap(n int) ClientOpt {
return func(c *Client) (err error) {
c.bufferCap = n
return
}
}
func TestSendAndRead(t *testing.T) {
for _, tt := range []struct {
desc string
send *dhcpv4.DHCPv4
server []*dhcpv4.DHCPv4
// If want is nil, we assume server[0] contains what is wanted.
want *dhcpv4.DHCPv4
wantErr error
}{
{
desc: "two response packets",
send: newPacket(dhcpv4.OpcodeBootRequest, [4]byte{0x33, 0x33, 0x33, 0x33}),
server: []*dhcpv4.DHCPv4{
newPacket(dhcpv4.OpcodeBootReply, [4]byte{0x33, 0x33, 0x33, 0x33}),
newPacket(dhcpv4.OpcodeBootReply, [4]byte{0x33, 0x33, 0x33, 0x33}),
newPacket(dhcpv4.OpcodeBootReply, [4]byte{0x33, 0x33, 0x33, 0x33}),
newPacket(dhcpv4.OpcodeBootReply, [4]byte{0x33, 0x33, 0x33, 0x33}),
newPacket(dhcpv4.OpcodeBootReply, [4]byte{0x33, 0x33, 0x33, 0x33}),
},
want: newPacket(dhcpv4.OpcodeBootReply, [4]byte{0x33, 0x33, 0x33, 0x33}),
},
{
desc: "one response packet",
send: newPacket(dhcpv4.OpcodeBootRequest, [4]byte{0x33, 0x33, 0x33, 0x33}),
server: []*dhcpv4.DHCPv4{
newPacket(dhcpv4.OpcodeBootReply, [4]byte{0x33, 0x33, 0x33, 0x33}),
},
want: newPacket(dhcpv4.OpcodeBootReply, [4]byte{0x33, 0x33, 0x33, 0x33}),
},
{
desc: "one response packet, one invalid XID, one invalid opcode, one invalid hwaddr",
send: newPacket(dhcpv4.OpcodeBootRequest, [4]byte{0x33, 0x33, 0x33, 0x33}),
server: []*dhcpv4.DHCPv4{
newPacket(dhcpv4.OpcodeBootReply, [4]byte{0x77, 0x33, 0x33, 0x33}),
newPacket(dhcpv4.OpcodeBootRequest, [4]byte{0x33, 0x33, 0x33, 0x33}),
newPacketWeirdHWAddr(dhcpv4.OpcodeBootReply, [4]byte{0x33, 0x33, 0x33, 0x33}),
newPacket(dhcpv4.OpcodeBootReply, [4]byte{0x33, 0x33, 0x33, 0x33}),
},
want: newPacket(dhcpv4.OpcodeBootReply, [4]byte{0x33, 0x33, 0x33, 0x33}),
},
{
desc: "discard wrong XID",
send: newPacket(dhcpv4.OpcodeBootRequest, [4]byte{0x33, 0x33, 0x33, 0x33}),
server: []*dhcpv4.DHCPv4{
newPacket(dhcpv4.OpcodeBootReply, [4]byte{0, 0, 0, 0}),
},
want: nil, // Explicitly empty.
wantErr: ErrNoResponse,
},
{
desc: "no response, timeout",
send: newPacket(dhcpv4.OpcodeBootRequest, [4]byte{0x33, 0x33, 0x33, 0x33}),
wantErr: ErrNoResponse,
},
} {
t.Run(tt.desc, func(t *testing.T) {
// Both server and client only get 2 seconds.
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
defer cancel()
mc, _ := serveAndClient(ctx, [][]*dhcpv4.DHCPv4{tt.server},
// Use an unbuffered channel to make sure we
// have no deadlocks.
withBufferCap(0))
defer mc.Close()
rcvd, err := mc.SendAndRead(context.Background(), DefaultServers, tt.send, nil)
if err != tt.wantErr {
t.Error(err)
}
if err = ComparePacket(rcvd, tt.want); err != nil {
t.Errorf("got unexpected packets: %v", err)
}
})
}
}
func TestParallelSendAndRead(t *testing.T) {
pkt := newPacket(dhcpv4.OpcodeBootRequest, [4]byte{0x33, 0x33, 0x33, 0x33})
// Both the server and client only get 2 seconds.
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
defer cancel()
mc, _ := serveAndClient(ctx, [][]*dhcpv4.DHCPv4{},
WithTimeout(10*time.Second),
// Use an unbuffered channel to make sure nothing blocks.
withBufferCap(0))
defer mc.Close()
var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
if _, err := mc.SendAndRead(context.Background(), DefaultServers, pkt, nil); err != ErrNoResponse {
t.Errorf("SendAndRead(%v) = %v, want %v", pkt, err, ErrNoResponse)
}
}()
wg.Add(1)
go func() {
defer wg.Done()
time.Sleep(4 * time.Second)
if err := mc.Close(); err != nil {
t.Errorf("closing failed: %v", err)
}
}()
wg.Wait()
}
func TestReuseXID(t *testing.T) {
pkt := newPacket(dhcpv4.OpcodeBootRequest, [4]byte{0x33, 0x33, 0x33, 0x33})
// Both the server and client only get 2 seconds.
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
defer cancel()
mc, _ := serveAndClient(ctx, [][]*dhcpv4.DHCPv4{})
defer mc.Close()
if _, err := mc.SendAndRead(context.Background(), DefaultServers, pkt, nil); err != ErrNoResponse {
t.Errorf("SendAndRead(%v) = %v, want %v", pkt, err, ErrNoResponse)
}
if _, err := mc.SendAndRead(context.Background(), DefaultServers, pkt, nil); err != ErrNoResponse {
t.Errorf("SendAndRead(%v) = %v, want %v", pkt, err, ErrNoResponse)
}
}
func TestSimpleSendAndReadDiscardGarbage(t *testing.T) {
pkt := newPacket(dhcpv4.OpcodeBootRequest, [4]byte{0x33, 0x33, 0x33, 0x33})
responses := newPacket(dhcpv4.OpcodeBootReply, [4]byte{0x33, 0x33, 0x33, 0x33})
// Both the server and client only get 2 seconds.
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
defer cancel()
mc, udpConn := serveAndClient(ctx, [][]*dhcpv4.DHCPv4{{responses}})
defer mc.Close()
// Too short for valid DHCPv4 packet.
_, _ = udpConn.WriteTo([]byte{0x01}, nil)
_, _ = udpConn.WriteTo([]byte{0x01, 0x2}, nil)
rcvd, err := mc.SendAndRead(ctx, DefaultServers, pkt, nil)
if err != nil {
t.Errorf("SendAndRead(%v) = %v, want nil", pkt, err)
}
if err = ComparePacket(rcvd, responses); err != nil {
t.Errorf("got unexpected packets: %v", err)
}
}
func TestMultipleSendAndRead(t *testing.T) {
for _, tt := range []struct {
desc string
send []*dhcpv4.DHCPv4
server [][]*dhcpv4.DHCPv4
wantErr []error
}{
{
desc: "two requests, two responses",
send: []*dhcpv4.DHCPv4{
newPacket(dhcpv4.OpcodeBootRequest, [4]byte{0x33, 0x33, 0x33, 0x33}),
newPacket(dhcpv4.OpcodeBootRequest, [4]byte{0x44, 0x44, 0x44, 0x44}),
},
server: [][]*dhcpv4.DHCPv4{
{ // Response for first packet.
newPacket(dhcpv4.OpcodeBootReply, [4]byte{0x33, 0x33, 0x33, 0x33}),
},
{ // Response for second packet.
newPacket(dhcpv4.OpcodeBootReply, [4]byte{0x44, 0x44, 0x44, 0x44}),
},
},
wantErr: []error{
nil,
nil,
},
},
} {
// Both server and client only get 2 seconds.
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
defer cancel()
mc, _ := serveAndClient(ctx, tt.server)
defer mc.Close()
for i, send := range tt.send {
ctx, cancel = context.WithTimeout(context.Background(), 2*time.Second)
defer cancel()
rcvd, err := mc.SendAndRead(ctx, DefaultServers, send, nil)
if wantErr := tt.wantErr[i]; err != wantErr {
t.Errorf("SendAndReadOne(%v): got %v, want %v", send, err, wantErr)
}
if err = pktsExpected([]*dhcpv4.DHCPv4{rcvd}, tt.server[i]); err != nil {
t.Errorf("got unexpected packets: %v", err)
}
}
}
}

View File

@@ -1,140 +0,0 @@
// Copyright 2018 the u-root Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
// +build go1.12
package nclient4
import (
"errors"
"io"
"net"
"github.com/mdlayher/ethernet"
"github.com/mdlayher/raw"
"github.com/u-root/u-root/pkg/uio"
)
// BroadcastMac is the broadcast MAC address.
//
// Any UDP packet sent to this address is broadcast on the subnet.
var BroadcastMac = net.HardwareAddr([]byte{255, 255, 255, 255, 255, 255})
// ErrUDPAddrIsRequired is an error used when a passed argument is not of type "*net.UDPAddr".
var ErrUDPAddrIsRequired = errors.New("must supply UDPAddr")
// NewRawUDPConn returns a UDP connection bound to the interface and port
// given based on a raw packet socket. All packets are broadcasted.
//
// The interface can be completely unconfigured.
func NewRawUDPConn(iface string, port int) (net.PacketConn, error) {
ifc, err := net.InterfaceByName(iface)
if err != nil {
return nil, err
}
rawConn, err := raw.ListenPacket(ifc, uint16(ethernet.EtherTypeIPv4), &raw.Config{LinuxSockDGRAM: true})
if err != nil {
return nil, err
}
return NewBroadcastUDPConn(rawConn, &net.UDPAddr{Port: port}), nil
}
// BroadcastRawUDPConn uses a raw socket to send UDP packets to the broadcast
// MAC address.
type BroadcastRawUDPConn struct {
// PacketConn is a raw DGRAM socket.
net.PacketConn
// boundAddr is the address this RawUDPConn is "bound" to.
//
// Calls to ReadFrom will only return packets destined to this address.
boundAddr *net.UDPAddr
}
// NewBroadcastUDPConn returns a PacketConn that marshals and unmarshals UDP
// packets, sending them to the broadcast MAC at on rawPacketConn.
//
// Calls to ReadFrom will only return packets destined to boundAddr.
func NewBroadcastUDPConn(rawPacketConn net.PacketConn, boundAddr *net.UDPAddr) net.PacketConn {
return &BroadcastRawUDPConn{
PacketConn: rawPacketConn,
boundAddr: boundAddr,
}
}
func udpMatch(addr, bound *net.UDPAddr) bool {
if bound == nil {
return true
}
if bound.IP != nil && !bound.IP.Equal(addr.IP) {
return false
}
return bound.Port == addr.Port
}
// ReadFrom implements net.PacketConn.ReadFrom.
//
// ReadFrom reads raw IP packets and will try to match them against
// upc.boundAddr. Any matching packets are returned via the given buffer.
func (upc *BroadcastRawUDPConn) ReadFrom(b []byte) (int, net.Addr, error) {
ipHdrMaxLen := IPv4MaximumHeaderSize
udpHdrLen := UDPMinimumSize
for {
pkt := make([]byte, ipHdrMaxLen+udpHdrLen+len(b))
n, _, err := upc.PacketConn.ReadFrom(pkt)
if err != nil {
return 0, nil, err
}
if n == 0 {
return 0, nil, io.EOF
}
pkt = pkt[:n]
buf := uio.NewBigEndianBuffer(pkt)
// To read the header length, access data directly.
ipHdr := IPv4(buf.Data())
ipHdr = IPv4(buf.Consume(int(ipHdr.HeaderLength())))
if ipHdr.TransportProtocol() != UDPProtocolNumber {
continue
}
udpHdr := UDP(buf.Consume(udpHdrLen))
addr := &net.UDPAddr{
IP: ipHdr.DestinationAddress(),
Port: int(udpHdr.DestinationPort()),
}
if !udpMatch(addr, upc.boundAddr) {
continue
}
srcAddr := &net.UDPAddr{
IP: ipHdr.SourceAddress(),
Port: int(udpHdr.SourcePort()),
}
// Extra padding after end of IP packet should be ignored,
// if not dhcp option parsing will fail.
dhcpLen := int(ipHdr.PayloadLength()) - udpHdrLen
return copy(b, buf.Consume(dhcpLen)), srcAddr, nil
}
}
// WriteTo implements net.PacketConn.WriteTo and broadcasts all packets at the
// raw socket level.
//
// WriteTo wraps the given packet in the appropriate UDP and IP header before
// sending it on the packet conn.
func (upc *BroadcastRawUDPConn) WriteTo(b []byte, addr net.Addr) (int, error) {
udpAddr, ok := addr.(*net.UDPAddr)
if !ok {
return 0, ErrUDPAddrIsRequired
}
// Using the boundAddr is not quite right here, but it works.
packet := udp4pkt(b, udpAddr, upc.boundAddr)
// Broadcasting is not always right, but hell, what the ARP do I know.
return upc.PacketConn.WriteTo(packet, &raw.Addr{HardwareAddr: BroadcastMac})
}

View File

@@ -1,377 +0,0 @@
// Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// This file contains code taken from gVisor.
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
// +build go1.12
package nclient4
import (
"encoding/binary"
"net"
"github.com/u-root/u-root/pkg/uio"
)
const (
versIHL = 0
tos = 1
totalLen = 2
id = 4
flagsFO = 6
ttl = 8
protocol = 9
checksum = 10
srcAddr = 12
dstAddr = 16
)
// TransportProtocolNumber is the number of a transport protocol.
type TransportProtocolNumber uint32
// IPv4Fields contains the fields of an IPv4 packet. It is used to describe the
// fields of a packet that needs to be encoded.
type IPv4Fields struct {
// IHL is the "internet header length" field of an IPv4 packet.
IHL uint8
// TOS is the "type of service" field of an IPv4 packet.
TOS uint8
// TotalLength is the "total length" field of an IPv4 packet.
TotalLength uint16
// ID is the "identification" field of an IPv4 packet.
ID uint16
// Flags is the "flags" field of an IPv4 packet.
Flags uint8
// FragmentOffset is the "fragment offset" field of an IPv4 packet.
FragmentOffset uint16
// TTL is the "time to live" field of an IPv4 packet.
TTL uint8
// Protocol is the "protocol" field of an IPv4 packet.
Protocol uint8
// Checksum is the "checksum" field of an IPv4 packet.
Checksum uint16
// SrcAddr is the "source ip address" of an IPv4 packet.
SrcAddr net.IP
// DstAddr is the "destination ip address" of an IPv4 packet.
DstAddr net.IP
}
// IPv4 represents an ipv4 header stored in a byte array.
// Most of the methods of IPv4 access to the underlying slice without
// checking the boundaries and could panic because of 'index out of range'.
// Always call IsValid() to validate an instance of IPv4 before using other methods.
type IPv4 []byte
const (
// IPv4MinimumSize is the minimum size of a valid IPv4 packet.
IPv4MinimumSize = 20
// IPv4MaximumHeaderSize is the maximum size of an IPv4 header. Given
// that there are only 4 bits to represents the header length in 32-bit
// units, the header cannot exceed 15*4 = 60 bytes.
IPv4MaximumHeaderSize = 60
// IPv4AddressSize is the size, in bytes, of an IPv4 address.
IPv4AddressSize = 4
// IPv4Version is the version of the ipv4 protocol.
IPv4Version = 4
)
var (
// IPv4Broadcast is the broadcast address of the IPv4 protocol.
IPv4Broadcast = net.IP{0xff, 0xff, 0xff, 0xff}
// IPv4Any is the non-routable IPv4 "any" meta address.
IPv4Any = net.IP{0, 0, 0, 0}
)
// Flags that may be set in an IPv4 packet.
const (
IPv4FlagMoreFragments = 1 << iota
IPv4FlagDontFragment
)
// HeaderLength returns the value of the "header length" field of the ipv4
// header.
func (b IPv4) HeaderLength() uint8 {
return (b[versIHL] & 0xf) * 4
}
// Protocol returns the value of the protocol field of the ipv4 header.
func (b IPv4) Protocol() uint8 {
return b[protocol]
}
// SourceAddress returns the "source address" field of the ipv4 header.
func (b IPv4) SourceAddress() net.IP {
return net.IP(b[srcAddr : srcAddr+IPv4AddressSize])
}
// DestinationAddress returns the "destination address" field of the ipv4
// header.
func (b IPv4) DestinationAddress() net.IP {
return net.IP(b[dstAddr : dstAddr+IPv4AddressSize])
}
// TransportProtocol implements Network.TransportProtocol.
func (b IPv4) TransportProtocol() TransportProtocolNumber {
return TransportProtocolNumber(b.Protocol())
}
// Payload implements Network.Payload.
func (b IPv4) Payload() []byte {
return b[b.HeaderLength():][:b.PayloadLength()]
}
// PayloadLength returns the length of the payload portion of the ipv4 packet.
func (b IPv4) PayloadLength() uint16 {
return b.TotalLength() - uint16(b.HeaderLength())
}
// TotalLength returns the "total length" field of the ipv4 header.
func (b IPv4) TotalLength() uint16 {
return binary.BigEndian.Uint16(b[totalLen:])
}
// SetTotalLength sets the "total length" field of the ipv4 header.
func (b IPv4) SetTotalLength(totalLength uint16) {
binary.BigEndian.PutUint16(b[totalLen:], totalLength)
}
// SetChecksum sets the checksum field of the ipv4 header.
func (b IPv4) SetChecksum(v uint16) {
binary.BigEndian.PutUint16(b[checksum:], v)
}
// SetFlagsFragmentOffset sets the "flags" and "fragment offset" fields of the
// ipv4 header.
func (b IPv4) SetFlagsFragmentOffset(flags uint8, offset uint16) {
v := (uint16(flags) << 13) | (offset >> 3)
binary.BigEndian.PutUint16(b[flagsFO:], v)
}
// SetSourceAddress sets the "source address" field of the ipv4 header.
func (b IPv4) SetSourceAddress(addr net.IP) {
copy(b[srcAddr:srcAddr+IPv4AddressSize], addr.To4())
}
// SetDestinationAddress sets the "destination address" field of the ipv4
// header.
func (b IPv4) SetDestinationAddress(addr net.IP) {
copy(b[dstAddr:dstAddr+IPv4AddressSize], addr.To4())
}
// CalculateChecksum calculates the checksum of the ipv4 header.
func (b IPv4) CalculateChecksum() uint16 {
return Checksum(b[:b.HeaderLength()], 0)
}
// Encode encodes all the fields of the ipv4 header.
func (b IPv4) Encode(i *IPv4Fields) {
b[versIHL] = (4 << 4) | ((i.IHL / 4) & 0xf)
b[tos] = i.TOS
b.SetTotalLength(i.TotalLength)
binary.BigEndian.PutUint16(b[id:], i.ID)
b.SetFlagsFragmentOffset(i.Flags, i.FragmentOffset)
b[ttl] = i.TTL
b[protocol] = i.Protocol
b.SetChecksum(i.Checksum)
copy(b[srcAddr:srcAddr+IPv4AddressSize], i.SrcAddr)
copy(b[dstAddr:dstAddr+IPv4AddressSize], i.DstAddr)
}
const (
udpSrcPort = 0
udpDstPort = 2
udpLength = 4
udpChecksum = 6
)
// UDPFields contains the fields of a UDP packet. It is used to describe the
// fields of a packet that needs to be encoded.
type UDPFields struct {
// SrcPort is the "source port" field of a UDP packet.
SrcPort uint16
// DstPort is the "destination port" field of a UDP packet.
DstPort uint16
// Length is the "length" field of a UDP packet.
Length uint16
// Checksum is the "checksum" field of a UDP packet.
Checksum uint16
}
// UDP represents a UDP header stored in a byte array.
type UDP []byte
const (
// UDPMinimumSize is the minimum size of a valid UDP packet.
UDPMinimumSize = 8
// UDPProtocolNumber is UDP's transport protocol number.
UDPProtocolNumber TransportProtocolNumber = 17
)
// SourcePort returns the "source port" field of the udp header.
func (b UDP) SourcePort() uint16 {
return binary.BigEndian.Uint16(b[udpSrcPort:])
}
// DestinationPort returns the "destination port" field of the udp header.
func (b UDP) DestinationPort() uint16 {
return binary.BigEndian.Uint16(b[udpDstPort:])
}
// Length returns the "length" field of the udp header.
func (b UDP) Length() uint16 {
return binary.BigEndian.Uint16(b[udpLength:])
}
// SetSourcePort sets the "source port" field of the udp header.
func (b UDP) SetSourcePort(port uint16) {
binary.BigEndian.PutUint16(b[udpSrcPort:], port)
}
// SetDestinationPort sets the "destination port" field of the udp header.
func (b UDP) SetDestinationPort(port uint16) {
binary.BigEndian.PutUint16(b[udpDstPort:], port)
}
// SetChecksum sets the "checksum" field of the udp header.
func (b UDP) SetChecksum(checksum uint16) {
binary.BigEndian.PutUint16(b[udpChecksum:], checksum)
}
// Payload returns the data contained in the UDP datagram.
func (b UDP) Payload() []byte {
return b[UDPMinimumSize:]
}
// Checksum returns the "checksum" field of the udp header.
func (b UDP) Checksum() uint16 {
return binary.BigEndian.Uint16(b[udpChecksum:])
}
// CalculateChecksum calculates the checksum of the udp packet, given the total
// length of the packet and the checksum of the network-layer pseudo-header
// (excluding the total length) and the checksum of the payload.
func (b UDP) CalculateChecksum(partialChecksum, totalLen uint16) uint16 {
// Add the length portion of the checksum to the pseudo-checksum.
tmp := make([]byte, 2)
binary.BigEndian.PutUint16(tmp, totalLen)
checksum := Checksum(tmp, partialChecksum)
// Calculate the rest of the checksum.
return Checksum(b[:UDPMinimumSize], checksum)
}
// Encode encodes all the fields of the udp header.
func (b UDP) Encode(u *UDPFields) {
binary.BigEndian.PutUint16(b[udpSrcPort:], u.SrcPort)
binary.BigEndian.PutUint16(b[udpDstPort:], u.DstPort)
binary.BigEndian.PutUint16(b[udpLength:], u.Length)
binary.BigEndian.PutUint16(b[udpChecksum:], u.Checksum)
}
func calculateChecksum(buf []byte, initial uint32) uint16 {
v := initial
l := len(buf)
if l&1 != 0 {
l--
v += uint32(buf[l]) << 8
}
for i := 0; i < l; i += 2 {
v += (uint32(buf[i]) << 8) + uint32(buf[i+1])
}
return ChecksumCombine(uint16(v), uint16(v>>16))
}
// Checksum calculates the checksum (as defined in RFC 1071) of the bytes in the
// given byte array.
//
// The initial checksum must have been computed on an even number of bytes.
func Checksum(buf []byte, initial uint16) uint16 {
return calculateChecksum(buf, uint32(initial))
}
// ChecksumCombine combines the two uint16 to form their checksum. This is done
// by adding them and the carry.
//
// Note that checksum a must have been computed on an even number of bytes.
func ChecksumCombine(a, b uint16) uint16 {
v := uint32(a) + uint32(b)
return uint16(v + v>>16)
}
// PseudoHeaderChecksum calculates the pseudo-header checksum for the
// given destination protocol and network address, ignoring the length
// field. Pseudo-headers are needed by transport layers when calculating
// their own checksum.
func PseudoHeaderChecksum(protocol TransportProtocolNumber, srcAddr, dstAddr net.IP) uint16 {
xsum := Checksum([]byte(srcAddr), 0)
xsum = Checksum([]byte(dstAddr), xsum)
return Checksum([]byte{0, uint8(protocol)}, xsum)
}
func udp4pkt(packet []byte, dest, src *net.UDPAddr) []byte {
ipLen := IPv4MinimumSize
udpLen := UDPMinimumSize
h := make([]byte, 0, ipLen+udpLen+len(packet))
hdr := uio.NewBigEndianBuffer(h)
ipv4fields := &IPv4Fields{
IHL: IPv4MinimumSize,
TotalLength: uint16(ipLen + udpLen + len(packet)),
TTL: 64, // Per RFC 1700's recommendation for IP time to live
Protocol: uint8(UDPProtocolNumber),
SrcAddr: src.IP.To4(),
DstAddr: dest.IP.To4(),
}
ipv4hdr := IPv4(hdr.WriteN(ipLen))
ipv4hdr.Encode(ipv4fields)
ipv4hdr.SetChecksum(^ipv4hdr.CalculateChecksum())
udphdr := UDP(hdr.WriteN(udpLen))
udphdr.Encode(&UDPFields{
SrcPort: uint16(src.Port),
DstPort: uint16(dest.Port),
Length: uint16(udpLen + len(packet)),
})
xsum := Checksum(packet, PseudoHeaderChecksum(
ipv4hdr.TransportProtocol(), ipv4fields.SrcAddr, ipv4fields.DstAddr))
udphdr.SetChecksum(^udphdr.CalculateChecksum(xsum, udphdr.Length()))
hdr.WriteBytes(packet)
return hdr.Data()
}

View File

@@ -64,9 +64,12 @@ type V4ServerConf struct {
leaseTime time.Duration // the time during which a dynamic lease is considered valid
dnsIPAddrs []net.IP // IPv4 addresses to return to DHCP clients as DNS server addresses
routerIP net.IP // value for Option Router
subnetMask net.IPMask // value for Option SubnetMask
options []dhcpOption
// subnet contains the DHCP server's subnet. The IP is the IP of the
// gateway.
subnet *net.IPNet
options []dhcpOption
// notify is a way to signal to other components that leases have
// change. notify must be called outside of locked sections, since the

View File

@@ -12,6 +12,7 @@ import (
"github.com/AdguardTeam/AdGuardHome/internal/agherr"
"github.com/AdguardTeam/AdGuardHome/internal/aghnet"
"github.com/AdguardTeam/AdGuardHome/internal/aghstrings"
"github.com/AdguardTeam/golibs/log"
"github.com/go-ping/ping"
"github.com/insomniacslk/dhcp/dhcpv4"
@@ -29,6 +30,9 @@ type v4Server struct {
// leased.
leasedOffsets *bitSet
// leaseHosts is the set of all hostnames of all known DHCP clients.
leaseHosts *aghstrings.Set
// leases contains all dynamic and static leases.
leases []*Lease
@@ -47,24 +51,24 @@ func (s *v4Server) WriteDiskConfig6(c *V6ServerConf) {
// ResetLeases - reset leases
func (s *v4Server) ResetLeases(leases []*Lease) {
if !s.conf.Enabled {
return
}
s.leasedOffsets = newBitSet()
s.leaseHosts = aghstrings.NewSet()
s.leases = nil
r := s.conf.ipRange
for _, l := range leases {
if !l.IsStatic() && !r.contains(l.IP) {
log.Debug(
"dhcpv4: skipping lease %s (%s): not within current ip range",
l.IP,
l.HWAddr,
)
continue
}
err := s.addLease(l)
if err != nil {
// TODO(a.garipov): Better error handling.
log.Error("dhcpv4: adding a lease for %s (%s): %s", l.IP, l.HWAddr, err)
log.Error(
"dhcpv4: reset: re-adding a lease for %s (%s): %s",
l.IP,
l.HWAddr,
err,
)
continue
}
@@ -174,17 +178,14 @@ func (s *v4Server) rmLeaseByIndex(i int) {
l := s.leases[i]
s.leases = append(s.leases[:i], s.leases[i+1:]...)
n = len(s.leases)
if n > 0 {
s.leases = s.leases[:n-1]
}
r := s.conf.ipRange
offset, ok := r.offset(l.IP)
if ok {
s.leasedOffsets.set(offset, false)
}
s.leaseHosts.Del(l.Hostname)
log.Debug("dhcpv4: removed lease %s (%s)", l.IP, l.HWAddr)
}
@@ -220,13 +221,8 @@ func (s *v4Server) rmDynamicLease(lease *Lease) (err error) {
}
func (s *v4Server) addStaticLease(l *Lease) (err error) {
subnet := &net.IPNet{
IP: s.conf.routerIP,
Mask: s.conf.subnetMask,
}
if !subnet.Contains(l.IP) {
return fmt.Errorf("subnet %s does not contain the ip %q", subnet, l.IP)
if sn := s.conf.subnet; !sn.Contains(l.IP) {
return fmt.Errorf("subnet %s does not contain the ip %q", sn, l.IP)
}
s.leases = append(s.leases, l)
@@ -237,6 +233,8 @@ func (s *v4Server) addStaticLease(l *Lease) (err error) {
s.leasedOffsets.set(offset, true)
}
s.leaseHosts.Add(l.Hostname)
return nil
}
@@ -248,6 +246,7 @@ func (s *v4Server) addDynamicLease(l *Lease) (err error) {
}
s.leases = append(s.leases, l)
s.leaseHosts.Add(l.Hostname)
s.leasedOffsets.set(offset, true)
return nil
@@ -255,6 +254,11 @@ func (s *v4Server) addDynamicLease(l *Lease) (err error) {
// addLease adds a dynamic or static lease.
func (s *v4Server) addLease(l *Lease) (err error) {
err = s.validateLease(l)
if err != nil {
return err
}
if l.IsStatic() {
return s.addStaticLease(l)
}
@@ -291,13 +295,13 @@ func (s *v4Server) AddStaticLease(l Lease) (err error) {
return fmt.Errorf("invalid ip %q, only ipv4 is supported", l.IP)
}
err = aghnet.ValidateHardwareAddress(l.HWAddr)
if err != nil {
return fmt.Errorf("validating lease: %w", err)
}
l.Expiry = time.Unix(leaseExpireStatic, 0)
l.Hostname, err = normalizeHostname(l.Hostname)
if err != nil {
return err
}
// Perform the following actions in an anonymous function to make sure
// that the lock gets unlocked before the notification step.
func() {
@@ -558,34 +562,77 @@ func (o *optFQDN) ToBytes() []byte {
return b
}
// normalizeHostname normalizes and validates a hostname sent by the client.
//
// TODO(a.garipov): Add client hostname uniqueness validations and rename the
// method to validateHostname.
func (s *v4Server) normalizeHostname(name string) (norm string, err error) {
// normalizeHostname normalizes a hostname sent by the client.
func normalizeHostname(name string) (norm string, err error) {
if name == "" {
return "", nil
}
// Some devices send hostnames with spaces, but we still want to accept
// them, so replace them with dashes and issue a warning.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/2946.
norm = strings.ReplaceAll(name, " ", "-")
state := "non-normalized"
if name != norm {
log.Debug("dhcpv4: normalized hostname %q into %q", name, norm)
state = "normalized"
norm = strings.ToLower(name)
parts := strings.FieldsFunc(norm, func(c rune) (ok bool) {
return c != '.' && !aghnet.IsValidHostOuterRune(c)
})
if len(parts) == 0 {
return "", fmt.Errorf("normalizing hostname %q: no valid parts", name)
}
err = aghnet.ValidateDomainName(norm)
if err != nil {
return "", fmt.Errorf("validating %s hostname: %w", state, err)
}
norm = strings.Join(parts, "-")
norm = strings.TrimSuffix(norm, "-")
return norm, nil
}
// validateHostname validates a hostname sent by the client.
func (s *v4Server) validateHostname(name string) (err error) {
defer agherr.Annotate("validating hostname: %s", &err)
if name == "" {
return nil
}
err = aghnet.ValidateDomainName(name)
if err != nil {
return err
}
if s.leaseHosts.Has(name) {
return agherr.Error("hostname exists")
}
return nil
}
// validateLease returns an error if the lease is invalid.
func (s *v4Server) validateLease(l *Lease) (err error) {
defer agherr.Annotate("validating lease: %s", &err)
if l == nil {
return agherr.Error("lease is nil")
}
err = aghnet.ValidateHardwareAddress(l.HWAddr)
if err != nil {
return err
}
err = s.validateHostname(l.Hostname)
if err != nil {
return err
}
if sn := s.conf.subnet; !sn.Contains(l.IP) {
return fmt.Errorf("subnet %s does not contain the ip %q", sn, l.IP)
}
r := s.conf.ipRange
if !l.IsStatic() && !r.contains(l.IP) {
return fmt.Errorf("dynamic lease range %s does not contain the ip %q", r, l.IP)
}
return nil
}
// Process Request request and return lease
// Return false if we don't need to reply
func (s *v4Server) processRequest(req, resp *dhcpv4.DHCPv4) (lease *Lease, ok bool) {
@@ -634,13 +681,44 @@ func (s *v4Server) processRequest(req, resp *dhcpv4.DHCPv4) (lease *Lease, ok bo
}
if !lease.IsStatic() {
lease.Hostname, err = s.normalizeHostname(req.HostName())
cliHostname := req.HostName()
var hostname string
hostname, err = normalizeHostname(cliHostname)
if err != nil {
log.Error("dhcpv4: cannot normalize hostname for %s: %s", mac, err)
return nil, false
// Go on and assign a hostname made from the IP.
}
if hostname != "" {
if cliHostname != hostname {
log.Debug(
"dhcpv4: normalized hostname %q into %q",
cliHostname,
hostname,
)
}
if lease.Hostname != hostname {
// Either a new lease or an old lease with a new
// hostname, so validate.
err = s.validateHostname(hostname)
if err != nil {
log.Error("dhcpv4: validating %s: %s", mac, err)
// Go on and assign a hostname made from
// the IP below.
hostname = ""
}
}
}
if hostname == "" {
hostname = aghnet.GenerateHostname(reqIP)
}
lease.Hostname = hostname
s.commitLease(lease)
} else if len(lease.Hostname) != 0 {
o := &optFQDN{
@@ -696,8 +774,8 @@ func (s *v4Server) process(req, resp *dhcpv4.DHCPv4) int {
copy(resp.YourIPAddr, l.IP)
resp.UpdateOption(dhcpv4.OptIPAddressLeaseTime(s.conf.leaseTime))
resp.UpdateOption(dhcpv4.OptRouter(s.conf.routerIP))
resp.UpdateOption(dhcpv4.OptSubnetMask(s.conf.subnetMask))
resp.UpdateOption(dhcpv4.OptRouter(s.conf.subnet.IP))
resp.UpdateOption(dhcpv4.OptSubnetMask(s.conf.subnet.Mask))
resp.UpdateOption(dhcpv4.OptDNS(s.conf.dnsIPAddrs...))
for _, opt := range s.conf.options {
@@ -754,7 +832,9 @@ func (s *v4Server) packetHandler(conn net.PacketConn, peer net.Addr, req *dhcpv4
}
// Start starts the IPv4 DHCP server.
func (s *v4Server) Start() error {
func (s *v4Server) Start() (err error) {
defer agherr.Annotate("dhcpv4: %w", &err)
if !s.conf.Enabled {
return nil
}
@@ -762,14 +842,14 @@ func (s *v4Server) Start() error {
ifaceName := s.conf.InterfaceName
iface, err := net.InterfaceByName(ifaceName)
if err != nil {
return fmt.Errorf("dhcpv4: finding interface %s by name: %w", ifaceName, err)
return fmt.Errorf("finding interface %s by name: %w", ifaceName, err)
}
log.Debug("dhcpv4: starting...")
dnsIPAddrs, err := ifaceDNSIPAddrs(iface, ipVersion4, defaultMaxAttempts, defaultBackoff)
if err != nil {
return fmt.Errorf("dhcpv4: interface %s: %w", ifaceName, err)
return fmt.Errorf("interface %s: %w", ifaceName, err)
}
if len(dnsIPAddrs) == 0 {
@@ -791,10 +871,24 @@ func (s *v4Server) Start() error {
log.Info("dhcpv4: listening")
go func() {
err = s.srv.Serve()
log.Debug("dhcpv4: srv.Serve: %s", err)
serr := s.srv.Serve()
// TODO(a.garipov): Uncomment in Go 1.16.
//
// if errors.Is(serr, net.ErrClosed) {
// log.Info("dhcpv4: server is closed")
//
// return
// }
if serr != nil {
log.Error("dhcpv4: srv.Serve: %s", serr)
}
}()
// Signal to the clients containers in packages home and dnsforward that
// it should reload the DHCP clients.
s.conf.notify(LeaseChangedAdded)
return nil
}
@@ -809,7 +903,11 @@ func (s *v4Server) Stop() {
if err != nil {
log.Error("dhcpv4: srv.Close: %s", err)
}
// now s.srv.Serve() will return
// Signal to the clients containers in packages home and dnsforward that
// it should remove all DHCP clients.
s.conf.notify(LeaseChangedRemovedAll)
s.srv = nil
}
@@ -817,6 +915,7 @@ func (s *v4Server) Stop() {
func v4Create(conf V4ServerConf) (srv DHCPServer, err error) {
s := &v4Server{}
s.conf = conf
s.leaseHosts = aghstrings.NewSet()
// TODO(a.garipov): Don't use a disabled server in other places or just
// use an interface.
@@ -824,7 +923,8 @@ func v4Create(conf V4ServerConf) (srv DHCPServer, err error) {
return s, nil
}
s.conf.routerIP, err = tryTo4(s.conf.GatewayIP)
var routerIP net.IP
routerIP, err = tryTo4(s.conf.GatewayIP)
if err != nil {
return s, fmt.Errorf("dhcpv4: %w", err)
}
@@ -832,8 +932,14 @@ func v4Create(conf V4ServerConf) (srv DHCPServer, err error) {
if s.conf.SubnetMask == nil {
return s, fmt.Errorf("dhcpv4: invalid subnet mask: %v", s.conf.SubnetMask)
}
s.conf.subnetMask = make([]byte, 4)
copy(s.conf.subnetMask, s.conf.SubnetMask.To4())
subnetMask := make([]byte, 4)
copy(subnetMask, s.conf.SubnetMask.To4())
s.conf.subnet = &net.IPNet{
IP: routerIP,
Mask: subnetMask,
}
s.conf.ipRange, err = newIPRange(conf.RangeStart, conf.RangeEnd)
if err != nil {

View File

@@ -23,7 +23,7 @@ func TestV4_AddRemove_static(t *testing.T) {
SubnetMask: net.IP{255, 255, 255, 0},
notify: notify4,
})
require.Nil(t, err)
require.NoError(t, err)
ls := s.GetLeases(LeasesStatic)
assert.Empty(t, ls)
@@ -33,23 +33,30 @@ func TestV4_AddRemove_static(t *testing.T) {
IP: net.IP{192, 168, 10, 150},
HWAddr: net.HardwareAddr{0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA},
}
require.Nil(t, s.AddStaticLease(l))
assert.NotNil(t, s.AddStaticLease(l))
err = s.AddStaticLease(l)
require.NoError(t, err)
err = s.AddStaticLease(l)
assert.Error(t, err)
ls = s.GetLeases(LeasesStatic)
require.Len(t, ls, 1)
assert.True(t, l.IP.Equal(ls[0].IP))
assert.Equal(t, l.HWAddr, ls[0].HWAddr)
assert.True(t, ls[0].IsStatic())
// Try to remove static lease.
assert.NotNil(t, s.RemoveStaticLease(Lease{
err = s.RemoveStaticLease(Lease{
IP: net.IP{192, 168, 10, 110},
HWAddr: net.HardwareAddr{0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA},
}))
})
assert.Error(t, err)
// Remove static lease.
require.Nil(t, s.RemoveStaticLease(l))
err = s.RemoveStaticLease(l)
require.NoError(t, err)
ls = s.GetLeases(LeasesStatic)
assert.Empty(t, ls)
}
@@ -63,7 +70,7 @@ func TestV4_AddReplace(t *testing.T) {
SubnetMask: net.IP{255, 255, 255, 0},
notify: notify4,
})
require.Nil(t, err)
require.NoError(t, err)
s, ok := sIface.(*v4Server)
require.True(t, ok)
@@ -78,7 +85,7 @@ func TestV4_AddReplace(t *testing.T) {
for i := range dynLeases {
err = s.addLease(&dynLeases[i])
require.Nil(t, err)
require.NoError(t, err)
}
stLeases := []Lease{{
@@ -90,7 +97,8 @@ func TestV4_AddReplace(t *testing.T) {
}}
for _, l := range stLeases {
require.Nil(t, s.AddStaticLease(l))
err = s.AddStaticLease(l)
require.NoError(t, err)
}
ls := s.GetLeases(LeasesStatic)
@@ -113,32 +121,35 @@ func TestV4StaticLease_Get(t *testing.T) {
SubnetMask: net.IP{255, 255, 255, 0},
notify: notify4,
})
require.Nil(t, err)
require.NoError(t, err)
s, ok := sIface.(*v4Server)
require.True(t, ok)
s.conf.dnsIPAddrs = []net.IP{{192, 168, 10, 1}}
l := Lease{
IP: net.IP{192, 168, 10, 150},
HWAddr: net.HardwareAddr{0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA},
}
require.Nil(t, s.AddStaticLease(l))
err = s.AddStaticLease(l)
require.NoError(t, err)
var req, resp *dhcpv4.DHCPv4
mac := net.HardwareAddr{0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA}
t.Run("discover", func(t *testing.T) {
var terr error
req, err = dhcpv4.NewDiscovery(mac)
require.NoError(t, err)
req, terr = dhcpv4.NewDiscovery(mac)
require.Nil(t, terr)
resp, err = dhcpv4.NewReplyFromRequest(req)
require.NoError(t, err)
resp, terr = dhcpv4.NewReplyFromRequest(req)
require.Nil(t, terr)
assert.Equal(t, 1, s.process(req, resp))
})
require.Nil(t, err)
// Don't continue if we got any errors in the previous subtest.
require.NoError(t, err)
t.Run("offer", func(t *testing.T) {
assert.Equal(t, dhcpv4.MessageTypeOffer, resp.MessageType())
@@ -146,19 +157,21 @@ func TestV4StaticLease_Get(t *testing.T) {
assert.True(t, l.IP.Equal(resp.YourIPAddr))
assert.True(t, s.conf.GatewayIP.Equal(resp.Router()[0]))
assert.True(t, s.conf.GatewayIP.Equal(resp.ServerIdentifier()))
assert.Equal(t, s.conf.subnetMask, resp.SubnetMask())
assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask())
assert.Equal(t, s.conf.leaseTime.Seconds(), resp.IPAddressLeaseTime(-1).Seconds())
})
t.Run("request", func(t *testing.T) {
req, err = dhcpv4.NewRequestFromOffer(resp)
require.Nil(t, err)
require.NoError(t, err)
resp, err = dhcpv4.NewReplyFromRequest(req)
require.Nil(t, err)
require.NoError(t, err)
assert.Equal(t, 1, s.process(req, resp))
})
require.Nil(t, err)
require.NoError(t, err)
t.Run("ack", func(t *testing.T) {
assert.Equal(t, dhcpv4.MessageTypeAck, resp.MessageType())
@@ -166,17 +179,19 @@ func TestV4StaticLease_Get(t *testing.T) {
assert.True(t, l.IP.Equal(resp.YourIPAddr))
assert.True(t, s.conf.GatewayIP.Equal(resp.Router()[0]))
assert.True(t, s.conf.GatewayIP.Equal(resp.ServerIdentifier()))
assert.Equal(t, s.conf.subnetMask, resp.SubnetMask())
assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask())
assert.Equal(t, s.conf.leaseTime.Seconds(), resp.IPAddressLeaseTime(-1).Seconds())
})
dnsAddrs := resp.DNS()
require.Len(t, dnsAddrs, 1)
assert.True(t, s.conf.GatewayIP.Equal(dnsAddrs[0]))
t.Run("check_lease", func(t *testing.T) {
ls := s.GetLeases(LeasesStatic)
require.Len(t, ls, 1)
assert.True(t, l.IP.Equal(ls[0].IP))
assert.Equal(t, mac, ls[0].HWAddr)
})
@@ -196,10 +211,11 @@ func TestV4DynamicLease_Get(t *testing.T) {
"82 ip 1.2.3.4",
},
})
require.Nil(t, err)
require.NoError(t, err)
s, ok := sIface.(*v4Server)
require.True(t, ok)
s.conf.dnsIPAddrs = []net.IP{{192, 168, 10, 1}}
var req, resp *dhcpv4.DHCPv4
@@ -207,15 +223,16 @@ func TestV4DynamicLease_Get(t *testing.T) {
t.Run("discover", func(t *testing.T) {
req, err = dhcpv4.NewDiscovery(mac)
require.Nil(t, err)
require.NoError(t, err)
resp, err = dhcpv4.NewReplyFromRequest(req)
require.Nil(t, err)
require.NoError(t, err)
assert.Equal(t, 1, s.process(req, resp))
})
// Don't continue if we got any errors in the previous subtest.
require.Nil(t, err)
require.NoError(t, err)
t.Run("offer", func(t *testing.T) {
assert.Equal(t, dhcpv4.MessageTypeOffer, resp.MessageType())
@@ -226,9 +243,10 @@ func TestV4DynamicLease_Get(t *testing.T) {
router := resp.Router()
require.Len(t, router, 1)
assert.Equal(t, s.conf.GatewayIP, router[0])
assert.Equal(t, s.conf.subnetMask, resp.SubnetMask())
assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask())
assert.Equal(t, s.conf.leaseTime.Seconds(), resp.IPAddressLeaseTime(-1).Seconds())
assert.Equal(t, []byte("012"), resp.Options[uint8(dhcpv4.OptionFQDN)])
@@ -236,16 +254,16 @@ func TestV4DynamicLease_Get(t *testing.T) {
})
t.Run("request", func(t *testing.T) {
var terr error
req, err = dhcpv4.NewRequestFromOffer(resp)
require.NoError(t, err)
req, terr = dhcpv4.NewRequestFromOffer(resp)
require.Nil(t, terr)
resp, err = dhcpv4.NewReplyFromRequest(req)
require.NoError(t, err)
resp, terr = dhcpv4.NewReplyFromRequest(req)
require.Nil(t, terr)
assert.Equal(t, 1, s.process(req, resp))
})
require.Nil(t, err)
require.NoError(t, err)
t.Run("ack", func(t *testing.T) {
assert.Equal(t, dhcpv4.MessageTypeAck, resp.MessageType())
@@ -253,24 +271,26 @@ func TestV4DynamicLease_Get(t *testing.T) {
assert.True(t, s.conf.RangeStart.Equal(resp.YourIPAddr))
assert.True(t, s.conf.GatewayIP.Equal(resp.Router()[0]))
assert.True(t, s.conf.GatewayIP.Equal(resp.ServerIdentifier()))
assert.Equal(t, s.conf.subnetMask, resp.SubnetMask())
assert.Equal(t, s.conf.subnet.Mask, resp.SubnetMask())
assert.Equal(t, s.conf.leaseTime.Seconds(), resp.IPAddressLeaseTime(-1).Seconds())
})
dnsAddrs := resp.DNS()
require.Len(t, dnsAddrs, 1)
assert.True(t, net.IP{192, 168, 10, 1}.Equal(dnsAddrs[0]))
// check lease
t.Run("check_lease", func(t *testing.T) {
ls := s.GetLeases(LeasesDynamic)
assert.Len(t, ls, 1)
require.Len(t, ls, 1)
assert.True(t, net.IP{192, 168, 10, 100}.Equal(ls[0].IP))
assert.Equal(t, mac, ls[0].HWAddr)
})
}
func TestV4Server_normalizeHostname(t *testing.T) {
func TestNormalizeHostname(t *testing.T) {
testCases := []struct {
name string
hostname string
@@ -292,24 +312,35 @@ func TestV4Server_normalizeHostname(t *testing.T) {
wantErrMsg: "",
want: "my-device-01",
}, {
name: "error",
hostname: "!!!",
wantErrMsg: `validating non-normalized hostname: ` +
`invalid domain name label at index 0: ` +
`invalid char '!' at index 0 in "!!!"`,
want: "",
name: "success_underscores",
hostname: "my_device_01",
wantErrMsg: "",
want: "my-device-01",
}, {
name: "error_spaces",
hostname: "! ! !",
wantErrMsg: `validating normalized hostname: ` +
`invalid domain name label at index 0: ` +
`invalid char '!' at index 0 in "!-!-!"`,
want: "",
name: "error_part",
hostname: "device !!!",
wantErrMsg: "",
want: "device",
}, {
name: "error_part_spaces",
hostname: "device ! ! !",
wantErrMsg: "",
want: "device",
}, {
name: "error",
hostname: "!!!",
wantErrMsg: `normalizing hostname "!!!": no valid parts`,
want: "",
}, {
name: "error_spaces",
hostname: "! ! !",
wantErrMsg: `normalizing hostname "! ! !": no valid parts`,
want: "",
}}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
got, err := (&v4Server{}).normalizeHostname(tc.hostname)
got, err := normalizeHostname(tc.hostname)
if tc.wantErrMsg == "" {
assert.NoError(t, err)
} else {

View File

@@ -14,6 +14,7 @@ import (
"sync"
"github.com/AdguardTeam/AdGuardHome/internal/aghnet"
"github.com/AdguardTeam/AdGuardHome/internal/aghstrings"
"github.com/AdguardTeam/dnsproxy/upstream"
"github.com/AdguardTeam/golibs/cache"
"github.com/AdguardTeam/golibs/log"
@@ -422,9 +423,9 @@ func (d *DNSFilter) CheckHost(
return Result{}, nil
}
// checkAutoHosts compares the host against our autohosts table. The err is
// checkEtcHosts compares the host against our /etc/hosts table. The err is
// always nil, it is only there to make this a valid hostChecker function.
func (d *DNSFilter) checkAutoHosts(
func (d *DNSFilter) checkEtcHosts(
host string,
qtype uint16,
_ *FilteringSettings,
@@ -477,10 +478,10 @@ func (d *DNSFilter) processRewrites(host string, qtype uint16) (res Result) {
res.Reason = Rewritten
}
cnames := map[string]bool{}
cnames := aghstrings.NewSet()
origHost := host
for len(rr) != 0 && rr[0].Type == dns.TypeCNAME {
log.Debug("Rewrite: CNAME for %s is %s", host, rr[0].Answer)
log.Debug("rewrite: CNAME for %s is %s", host, rr[0].Answer)
if host == rr[0].Answer { // "host == CNAME" is an exception
res.Reason = NotFilteredNotFound
@@ -489,12 +490,13 @@ func (d *DNSFilter) processRewrites(host string, qtype uint16) (res Result) {
}
host = rr[0].Answer
_, ok := cnames[host]
if ok {
log.Info("Rewrite: breaking CNAME redirection loop: %s. Question: %s", host, origHost)
if cnames.Has(host) {
log.Info("rewrite: breaking CNAME redirection loop: %s. Question: %s", host, origHost)
return res
}
cnames[host] = false
cnames.Add(host)
res.CanonName = rr[0].Answer
rr = findRewrites(d.Rewrites, host)
}
@@ -509,7 +511,7 @@ func (d *DNSFilter) processRewrites(host string, qtype uint16) (res Result) {
}
res.IPList = append(res.IPList, r.IP)
log.Debug("Rewrite: A/AAAA for %s is %s", host, r.IP)
log.Debug("rewrite: A/AAAA for %s is %s", host, r.IP)
}
}
@@ -829,8 +831,8 @@ func New(c *Config, blockFilters []Filter) *DNSFilter {
}
d.hostCheckers = []hostChecker{{
check: d.checkAutoHosts,
name: "autohosts",
check: d.checkEtcHosts,
name: "etchosts",
}, {
check: d.matchHost,
name: "filtering",

View File

@@ -17,8 +17,11 @@ import (
type accessCtx struct {
lock sync.Mutex
allowedClients map[string]bool // IP addresses of whitelist clients
disallowedClients map[string]bool // IP addresses of clients that should be blocked
// allowedClients are the IP addresses of clients in the allowlist.
allowedClients *aghstrings.Set
// disallowedClients are the IP addresses of clients in the blocklist.
disallowedClients *aghstrings.Set
allowedClientsIPNet []net.IPNet // CIDRs of whitelist clients
disallowedClientsIPNet []net.IPNet // CIDRs of clients that should be blocked
@@ -26,15 +29,20 @@ type accessCtx struct {
blockedHostsEngine *urlfilter.DNSEngine // finds hosts that should be blocked
}
func (a *accessCtx) Init(allowedClients, disallowedClients, blockedHosts []string) error {
err := processIPCIDRArray(&a.allowedClients, &a.allowedClientsIPNet, allowedClients)
if err != nil {
return err
func newAccessCtx(allowedClients, disallowedClients, blockedHosts []string) (a *accessCtx, err error) {
a = &accessCtx{
allowedClients: aghstrings.NewSet(),
disallowedClients: aghstrings.NewSet(),
}
err = processIPCIDRArray(&a.disallowedClients, &a.disallowedClientsIPNet, disallowedClients)
err = processIPCIDRArray(a.allowedClients, &a.allowedClientsIPNet, allowedClients)
if err != nil {
return err
return nil, fmt.Errorf("processing allowed clients: %w", err)
}
err = processIPCIDRArray(a.disallowedClients, &a.disallowedClientsIPNet, disallowedClients)
if err != nil {
return nil, fmt.Errorf("processing disallowed clients: %w", err)
}
b := &strings.Builder{}
@@ -51,21 +59,20 @@ func (a *accessCtx) Init(allowedClients, disallowedClients, blockedHosts []strin
listArray = append(listArray, list)
rulesStorage, err := filterlist.NewRuleStorage(listArray)
if err != nil {
return fmt.Errorf("filterlist.NewRuleStorage(): %w", err)
return nil, fmt.Errorf("filterlist.NewRuleStorage(): %w", err)
}
a.blockedHostsEngine = urlfilter.NewDNSEngine(rulesStorage)
return nil
return a, nil
}
// Split array of IP or CIDR into 2 containers for fast search
func processIPCIDRArray(dst *map[string]bool, dstIPNet *[]net.IPNet, src []string) error {
*dst = make(map[string]bool)
func processIPCIDRArray(dst *aghstrings.Set, dstIPNet *[]net.IPNet, src []string) error {
for _, s := range src {
ip := net.ParseIP(s)
if ip != nil {
(*dst)[s] = true
dst.Add(s)
continue
}
@@ -73,6 +80,7 @@ func processIPCIDRArray(dst *map[string]bool, dstIPNet *[]net.IPNet, src []strin
if err != nil {
return err
}
*dstIPNet = append(*dstIPNet, *ipnet)
}
@@ -89,9 +97,8 @@ func (a *accessCtx) IsBlockedIP(ip net.IP) (bool, string) {
a.lock.Lock()
defer a.lock.Unlock()
if len(a.allowedClients) != 0 || len(a.allowedClientsIPNet) != 0 {
_, ok := a.allowedClients[ipStr]
if ok {
if a.allowedClients.Len() != 0 || len(a.allowedClientsIPNet) != 0 {
if a.allowedClients.Has(ipStr) {
return false, ""
}
@@ -106,8 +113,7 @@ func (a *accessCtx) IsBlockedIP(ip net.IP) (bool, string) {
return true, ""
}
_, ok := a.disallowedClients[ipStr]
if ok {
if a.disallowedClients.Has(ipStr) {
return true, ipStr
}
@@ -186,10 +192,11 @@ func (s *Server) handleAccessSet(w http.ResponseWriter, r *http.Request) {
return
}
a := &accessCtx{}
err = a.Init(j.AllowedClients, j.DisallowedClients, j.BlockedHosts)
var a *accessCtx
a, err = newAccessCtx(j.AllowedClients, j.DisallowedClients, j.BlockedHosts)
if err != nil {
httpError(r, w, http.StatusBadRequest, "access.Init: %s", err)
httpError(r, w, http.StatusBadRequest, "creating access ctx: %s", err)
return
}

View File

@@ -82,7 +82,6 @@ func TestIsBlockedIP(t *testing.T) {
}
t.Run(prefix+tc.name, func(t *testing.T) {
aCtx := &accessCtx{}
allowedRules := rules
var disallowedRules []string
@@ -90,7 +89,8 @@ func TestIsBlockedIP(t *testing.T) {
allowedRules, disallowedRules = disallowedRules, allowedRules
}
require.Nil(t, aCtx.Init(allowedRules, disallowedRules, nil))
aCtx, err := newAccessCtx(allowedRules, disallowedRules, nil)
require.NoError(t, err)
disallowed, rule := aCtx.IsBlockedIP(tc.ip)
assert.Equal(t, tc.wantDis, disallowed)
@@ -100,12 +100,12 @@ func TestIsBlockedIP(t *testing.T) {
}
func TestIsBlockedDomain(t *testing.T) {
aCtx := &accessCtx{}
require.Nil(t, aCtx.Init(nil, nil, []string{
aCtx, err := newAccessCtx(nil, nil, []string{
"host1",
"*.host.com",
"||host3.com^",
}))
})
require.NoError(t, err)
testCases := []struct {
name string

View File

@@ -142,7 +142,7 @@ func processClientID(dctx *dnsContext) (rc resultCode) {
return resultCodeError
}
cliSrvName = qs.ConnectionState().ServerName
cliSrvName = qs.ConnectionState().TLS.ServerName
}
clientID, err := clientIDFromClientServerName(hostSrvName, cliSrvName, srvConf.StrictSNICheck)

View File

@@ -40,7 +40,7 @@ type testQUICSession struct {
// ConnectionState implements the quicSession interface for testQUICSession.
func (c testQUICSession) ConnectionState() (cs quic.ConnectionState) {
cs.ServerName = c.serverName
cs.TLS.ServerName = c.serverName
return cs
}

View File

@@ -140,58 +140,70 @@ func processInitial(ctx *dnsContext) (rc resultCode) {
return resultCodeSuccess
}
// Return TRUE if host names doesn't contain disallowed characters
func isHostnameOK(hostname string) bool {
for _, c := range hostname {
if !((c >= 'a' && c <= 'z') ||
(c >= 'A' && c <= 'Z') ||
(c >= '0' && c <= '9') ||
c == '.' || c == '-') {
log.Debug("dns: skipping invalid hostname %s from DHCP", hostname)
return false
}
}
return true
func (s *Server) setTableHostToIP(t hostToIPTable) {
s.tableHostToIPLock.Lock()
defer s.tableHostToIPLock.Unlock()
s.tableHostToIP = t
}
func (s *Server) setTableIPToHost(t ipToHostTable) {
s.tableIPToHostLock.Lock()
defer s.tableIPToHostLock.Unlock()
s.tableIPToHost = t
}
func (s *Server) onDHCPLeaseChanged(flags int) {
var err error
add := true
switch flags {
case dhcpd.LeaseChangedAdded,
dhcpd.LeaseChangedAddedStatic,
dhcpd.LeaseChangedRemovedStatic:
//
// Go on.
case dhcpd.LeaseChangedRemovedAll:
add = false
default:
return
}
hostToIP := make(map[string]net.IP)
m := make(map[string]string)
var hostToIP hostToIPTable
var ipToHost ipToHostTable
if add {
hostToIP = make(hostToIPTable)
ipToHost = make(ipToHostTable)
ll := s.dhcpServer.Leases(dhcpd.LeasesAll)
ll := s.dhcpServer.Leases(dhcpd.LeasesAll)
for _, l := range ll {
if len(l.Hostname) == 0 || !isHostnameOK(l.Hostname) {
continue
for _, l := range ll {
// TODO(a.garipov): Remove this after we're finished
// with the client hostname validations in the DHCP
// server code.
err = aghnet.ValidateDomainName(l.Hostname)
if err != nil {
log.Debug(
"dns: skipping invalid hostname %q from dhcp: %s",
l.Hostname,
err,
)
}
lowhost := strings.ToLower(l.Hostname)
ipToHost[l.IP.String()] = lowhost
ip := make(net.IP, 4)
copy(ip, l.IP.To4())
hostToIP[lowhost] = ip
}
lowhost := strings.ToLower(l.Hostname)
m[l.IP.String()] = lowhost
ip := make(net.IP, 4)
copy(ip, l.IP.To4())
hostToIP[lowhost] = ip
log.Debug("dns: added %d A/PTR entries from DHCP", len(ipToHost))
}
log.Debug("dns: added %d A/PTR entries from DHCP", len(m))
s.tableHostToIPLock.Lock()
s.tableHostToIP = hostToIP
s.tableHostToIPLock.Unlock()
s.tablePTRLock.Lock()
s.tablePTR = m
s.tablePTRLock.Unlock()
s.setTableHostToIP(hostToIP)
s.setTableIPToHost(ipToHost)
}
// processDetermineLocal determines if the client's IP address is from
@@ -248,7 +260,7 @@ func (s *Server) processInternalHosts(dctx *dnsContext) (rc resultCode) {
}
reqHost := strings.ToLower(q.Name)
host := strings.TrimSuffix(reqHost, s.autohostSuffix)
host := strings.TrimSuffix(reqHost, s.localDomainSuffix)
if host == reqHost {
return resultCodeSuccess
}
@@ -336,14 +348,14 @@ func (s *Server) processRestrictLocal(ctx *dnsContext) (rc resultCode) {
// ipToHost tries to get a hostname leased by DHCP. It's safe for concurrent
// use.
func (s *Server) ipToHost(ip net.IP) (host string, ok bool) {
s.tablePTRLock.Lock()
defer s.tablePTRLock.Unlock()
s.tableIPToHostLock.Lock()
defer s.tableIPToHostLock.Unlock()
if s.tablePTR == nil {
if s.tableIPToHost == nil {
return "", false
}
host, ok = s.tablePTR[ip.String()]
host, ok = s.tableIPToHost[ip.String()]
return host, ok
}

View File

@@ -90,8 +90,8 @@ func TestServer_ProcessInternalHosts_localRestriction(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
s := &Server{
autohostSuffix: defaultAutohostSuffix,
tableHostToIP: map[string]net.IP{
localDomainSuffix: defaultLocalDomainSuffix,
tableHostToIP: hostToIPTable{
"example": knownIP,
},
}
@@ -157,35 +157,35 @@ func TestServer_ProcessInternalHosts(t *testing.T) {
}{{
name: "success_external",
host: examplecom,
suffix: defaultAutohostSuffix,
suffix: defaultLocalDomainSuffix,
wantIP: nil,
wantRes: resultCodeSuccess,
qtyp: dns.TypeA,
}, {
name: "success_external_non_a",
host: examplecom,
suffix: defaultAutohostSuffix,
suffix: defaultLocalDomainSuffix,
wantIP: nil,
wantRes: resultCodeSuccess,
qtyp: dns.TypeCNAME,
}, {
name: "success_internal",
host: examplelan,
suffix: defaultAutohostSuffix,
suffix: defaultLocalDomainSuffix,
wantIP: knownIP,
wantRes: resultCodeSuccess,
qtyp: dns.TypeA,
}, {
name: "success_internal_unknown",
host: "example-new.lan",
suffix: defaultAutohostSuffix,
suffix: defaultLocalDomainSuffix,
wantIP: nil,
wantRes: resultCodeFinish,
qtyp: dns.TypeA,
}, {
name: "success_internal_aaaa",
host: examplelan,
suffix: defaultAutohostSuffix,
suffix: defaultLocalDomainSuffix,
wantIP: nil,
wantRes: resultCodeSuccess,
qtyp: dns.TypeAAAA,
@@ -201,8 +201,8 @@ func TestServer_ProcessInternalHosts(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
s := &Server{
autohostSuffix: tc.suffix,
tableHostToIP: map[string]net.IP{
localDomainSuffix: tc.suffix,
tableHostToIP: hostToIPTable{
"example": knownIP,
},
}

View File

@@ -43,6 +43,15 @@ var defaultBlockedHosts = []string{"version.bind", "id.server", "hostname.bind"}
var webRegistered bool
// hostToIPTable is an alias for the type of Server.tableHostToIP.
type hostToIPTable = map[string]net.IP
// ipToHostTable is an alias for the type of Server.tableIPToHost.
//
// TODO(a.garipov): Define an IPMap type in aghnet and use here and in other
// places?
type ipToHostTable = map[string]string
// Server is the main way to start a DNS server.
//
// Example:
@@ -61,19 +70,19 @@ type Server struct {
stats stats.Stats
access *accessCtx
// autohostSuffix is the suffix used to detect internal hosts. It must
// be a valid top-level domain plus dots on each side.
autohostSuffix string
// localDomainSuffix is the suffix used to detect internal hosts. It
// must be a valid domain name plus dots on each side.
localDomainSuffix string
ipset ipsetCtx
subnetDetector *aghnet.SubnetDetector
localResolvers *proxy.Proxy
tableHostToIP map[string]net.IP // "hostname -> IP" table for internal addresses (DHCP)
tableHostToIP hostToIPTable
tableHostToIPLock sync.Mutex
tablePTR map[string]string // "IP -> hostname" table for reverse lookup
tablePTRLock sync.Mutex
tableIPToHost ipToHostTable
tableIPToHostLock sync.Mutex
// DNS proxy instance for internal usage
// We don't Start() it and so no listen port is required.
@@ -85,9 +94,11 @@ type Server struct {
conf ServerConfig
}
// defaultAutohostSuffix is the default suffix used to detect internal hosts
// when no suffix is provided. See the documentation for Server.autohostSuffix.
const defaultAutohostSuffix = ".lan."
// defaultLocalDomainSuffix is the default suffix used to detect internal hosts
// when no suffix is provided.
//
// See the documentation for Server.localDomainSuffix.
const defaultLocalDomainSuffix = ".lan."
// DNSCreateParams are parameters to create a new server.
type DNSCreateParams struct {
@@ -96,11 +107,11 @@ type DNSCreateParams struct {
QueryLog querylog.QueryLog
DHCPServer dhcpd.ServerInterface
SubnetDetector *aghnet.SubnetDetector
AutohostTLD string
LocalDomain string
}
// tldToSuffix converts a top-level domain into an autohost suffix.
func tldToSuffix(tld string) (suffix string) {
// domainNameToSuffix converts a domain name into a local domain suffix.
func domainNameToSuffix(tld string) (suffix string) {
l := len(tld) + 2
b := make([]byte, l)
b[0] = '.'
@@ -113,24 +124,24 @@ func tldToSuffix(tld string) (suffix string) {
// NewServer creates a new instance of the dnsforward.Server
// Note: this function must be called only once
func NewServer(p DNSCreateParams) (s *Server, err error) {
var autohostSuffix string
if p.AutohostTLD == "" {
autohostSuffix = defaultAutohostSuffix
var localDomainSuffix string
if p.LocalDomain == "" {
localDomainSuffix = defaultLocalDomainSuffix
} else {
err = aghnet.ValidateDomainNameLabel(p.AutohostTLD)
err = aghnet.ValidateDomainName(p.LocalDomain)
if err != nil {
return nil, fmt.Errorf("autohost tld: %w", err)
return nil, fmt.Errorf("local domain: %w", err)
}
autohostSuffix = tldToSuffix(p.AutohostTLD)
localDomainSuffix = domainNameToSuffix(p.LocalDomain)
}
s = &Server{
dnsFilter: p.DNSFilter,
stats: p.Stats,
queryLog: p.QueryLog,
subnetDetector: p.SubnetDetector,
autohostSuffix: autohostSuffix,
dnsFilter: p.DNSFilter,
stats: p.Stats,
queryLog: p.QueryLog,
subnetDetector: p.SubnetDetector,
localDomainSuffix: localDomainSuffix,
}
if p.DHCPServer != nil {
@@ -329,19 +340,6 @@ func (s *Server) collectDNSIPAddrs() (addrs []string, err error) {
return addrs[:i], nil
}
// unit is used to show the presence of a value in a set.
type unit = struct{}
// sliceToSet converts a slice of strings into a string set.
func sliceToSet(strs []string) (set map[string]unit) {
set = make(map[string]unit, len(strs))
for _, s := range strs {
set[s] = unit{}
}
return set
}
// setupResolvers initializes the resolvers for local addresses. For internal
// use only.
func (s *Server) setupResolvers(localAddrs []string) (err error) {
@@ -366,16 +364,14 @@ func (s *Server) setupResolvers(localAddrs []string) (err error) {
return err
}
ourAddrsSet := sliceToSet(ourAddrs)
ourAddrsSet := aghstrings.NewSet(ourAddrs...)
// TODO(e.burkov): The approach of subtracting sets of strings is not
// really applicable here since in case of listening on all network
// interfaces we should check the whole interface's network to cut off
// all the loopback addresses as well.
localAddrs = aghstrings.FilterOut(localAddrs, func(s string) (ok bool) {
_, ok = ourAddrsSet[s]
return ok
return ourAddrsSet.Has(s)
})
var upsConfig proxy.UpstreamConfig
@@ -453,10 +449,7 @@ func (s *Server) Prepare(config *ServerConfig) error {
// --
s.prepareIntlProxy()
// Initialize DNS access module
// --
s.access = &accessCtx{}
err = s.access.Init(s.conf.AllowedClients, s.conf.DisallowedClients, s.conf.BlockedHosts)
s.access, err = newAccessCtx(s.conf.AllowedClients, s.conf.DisallowedClients, s.conf.BlockedHosts)
if err != nil {
return err
}

View File

@@ -232,10 +232,10 @@ func sendTestMessages(t *testing.T, conn *dns.Conn) {
for i := 0; i < testMessagesCount; i++ {
req := createGoogleATestMessage()
err := conn.WriteMsg(req)
assert.Nilf(t, err, "cannot write message #%d: %s", i, err)
assert.NoErrorf(t, err, "cannot write message #%d: %s", i, err)
res, err := conn.ReadMsg()
assert.Nilf(t, err, "cannot read response to message #%d: %s", i, err)
assert.NoErrorf(t, err, "cannot read response to message #%d: %s", i, err)
assertGoogleAResponse(t, res)
}
}
@@ -334,7 +334,7 @@ func TestDoTServer(t *testing.T) {
func TestDoQServer(t *testing.T) {
s, _ := createTestTLS(t, TLSConfig{
QUICListenAddrs: []*net.UDPAddr{{}},
QUICListenAddrs: []*net.UDPAddr{{IP: net.IP{127, 0, 0, 1}}},
})
s.conf.UpstreamConfig.Upstreams = []upstream.Upstream{
&aghtest.TestUpstream{
@@ -1088,7 +1088,6 @@ func TestPTRResponseFromHosts(t *testing.T) {
_, _ = hf.WriteString(" 127.0.0.1 host # comment \n")
_, _ = hf.WriteString(" ::1 localhost#comment \n")
// Init auto hosts.
c.EtcHosts.Init(hf.Name())
t.Cleanup(c.EtcHosts.Close)
@@ -1145,17 +1144,24 @@ func TestNewServer(t *testing.T) {
in: DNSCreateParams{},
wantErrMsg: "",
}, {
name: "success_autohost_tld",
name: "success_local_tld",
in: DNSCreateParams{
AutohostTLD: "mynet",
LocalDomain: "mynet",
},
wantErrMsg: "",
}, {
name: "bad_autohost_tld",
name: "success_local_domain",
in: DNSCreateParams{
AutohostTLD: "!!!",
LocalDomain: "my.local.net",
},
wantErrMsg: `autohost tld: invalid char '!' at index 0 in "!!!"`,
wantErrMsg: "",
}, {
name: "bad_local_domain",
in: DNSCreateParams{
LocalDomain: "!!!",
},
wantErrMsg: `local domain: invalid domain name label at index 0: ` +
`invalid char '!' at index 0 in "!!!"`,
}}
for _, tc := range testCases {

View File

@@ -83,7 +83,7 @@ type clientsContainer struct {
ipToRC map[string]*RuntimeClient // IP -> runtime client
lock sync.Mutex
allTags map[string]bool
allTags *aghstrings.Set
// dhcpServer is used for looking up clients IP addresses by MAC addresses
dhcpServer *dhcpd.Server
@@ -111,19 +111,14 @@ func (clients *clientsContainer) Init(
clients.idIndex = make(map[string]*Client)
clients.ipToRC = make(map[string]*RuntimeClient)
clients.allTags = make(map[string]bool)
for _, t := range clientTags {
clients.allTags[t] = false
}
clients.allTags = aghstrings.NewSet(clientTags...)
clients.dhcpServer = dhcpServer
if etcHosts != nil {
clients.etcHosts = etcHosts
}
clients.etcHosts = etcHosts
clients.addFromConfig(objects)
if !clients.testing {
clients.addFromDHCP()
clients.updateFromDHCP(true)
if clients.dhcpServer != nil {
clients.dhcpServer.SetOnLeaseChanged(clients.onDHCPLeaseChanged)
}
@@ -165,9 +160,8 @@ type clientObject struct {
Upstreams []string `yaml:"upstreams"`
}
func (clients *clientsContainer) tagKnown(tag string) bool {
_, ok := clients.allTags[tag]
return ok
func (clients *clientsContainer) tagKnown(tag string) (ok bool) {
return clients.allTags.Has(tag)
}
func (clients *clientsContainer) addFromConfig(objects []clientObject) {
@@ -246,7 +240,9 @@ func (clients *clientsContainer) onDHCPLeaseChanged(flags int) {
case dhcpd.LeaseChangedAdded,
dhcpd.LeaseChangedAddedStatic,
dhcpd.LeaseChangedRemovedStatic:
clients.addFromDHCP()
clients.updateFromDHCP(true)
case dhcpd.LeaseChangedRemovedAll:
clients.updateFromDHCP(false)
}
}
@@ -770,9 +766,9 @@ func (clients *clientsContainer) addFromSystemARP() {
log.Debug("clients: added %d client aliases from 'arp -a' command output", n)
}
// addFromDHCP adds the clients that have a non-empty hostname from the DHCP
// updateFromDHCP adds the clients that have a non-empty hostname from the DHCP
// server.
func (clients *clientsContainer) addFromDHCP() {
func (clients *clientsContainer) updateFromDHCP(add bool) {
if clients.dhcpServer == nil {
return
}
@@ -782,6 +778,10 @@ func (clients *clientsContainer) addFromDHCP() {
clients.rmHostsBySrc(ClientSourceDHCP)
if !add {
return
}
leases := clients.dhcpServer.Leases(dhcpd.LeasesAll)
n := 0
for _, l := range leases {

View File

@@ -237,7 +237,7 @@ func (clients *clientsContainer) handleFindClient(w http.ResponseWriter, r *http
var cj clientJSON
if !ok {
var found bool
cj, found = clients.findTemporary(ip, idStr)
cj, found = clients.findRuntime(ip, idStr)
if !found {
continue
}
@@ -258,9 +258,9 @@ func (clients *clientsContainer) handleFindClient(w http.ResponseWriter, r *http
}
}
// findTemporary looks up the IP in temporary storages, like autohosts or
// blocklists.
func (clients *clientsContainer) findTemporary(ip net.IP, idStr string) (cj clientJSON, found bool) {
// findRuntime looks up the IP in runtime and temporary storages, like
// /etc/hosts tables, DHCP leases, or blocklists.
func (clients *clientsContainer) findRuntime(ip net.IP, idStr string) (cj clientJSON, found bool) {
if ip == nil {
return cj, false
}

View File

@@ -2,6 +2,7 @@ package home
import (
"errors"
"fmt"
"io/ioutil"
"net"
"os"
@@ -94,10 +95,10 @@ type dnsConfig struct {
FiltersUpdateIntervalHours uint32 `yaml:"filters_update_interval"` // time period to update filters (in hours)
DnsfilterConf dnsfilter.Config `yaml:",inline"`
// AutohostTLD is the top-level domain used for known internal hosts.
// LocalDomainName is the domain name used for known internal hosts.
// For example, a machine called "myhost" can be addressed as
// "myhost.lan" when AutohostTLD is "lan".
AutohostTLD string `yaml:"autohost_tld"`
// "myhost.lan" when LocalDomainName is "lan".
LocalDomainName string `yaml:"local_domain_name"`
// ResolveClients enables and disables resolving clients with RDNS.
ResolveClients bool `yaml:"resolve_clients"`
@@ -156,7 +157,7 @@ var config = configuration{
},
FilteringEnabled: true, // whether or not use filter lists
FiltersUpdateIntervalHours: 24,
AutohostTLD: "lan",
LocalDomainName: "lan",
ResolveClients: true,
},
TLS: tlsConfigSettings{
@@ -260,8 +261,7 @@ func readConfigFile() ([]byte, error) {
configFile := config.getConfigFilename()
d, err := ioutil.ReadFile(configFile)
if err != nil {
log.Error("Couldn't read config file %s: %s", configFile, err)
return nil, err
return nil, fmt.Errorf("couldn't read config file %s: %w", configFile, err)
}
return d, nil
}

View File

@@ -67,7 +67,7 @@ func initDNSServer() error {
Stats: Context.stats,
QueryLog: Context.queryLog,
SubnetDetector: Context.subnetDetector,
AutohostTLD: config.DNS.AutohostTLD,
LocalDomain: config.DNS.LocalDomainName,
}
if Context.dhcpServer != nil {
p.DHCPServer = Context.dhcpServer

View File

@@ -163,12 +163,14 @@ func setupContext(args options) {
err = parseConfig()
if err != nil {
log.Error("Failed to parse configuration, exiting")
log.Error("parsing configuration file: %s", err)
os.Exit(1)
}
if args.checkConfig {
log.Info("Configuration file is OK")
log.Info("configuration file is ok")
os.Exit(0)
}
}
@@ -201,8 +203,8 @@ func setupConfig(args options) {
if !args.noEtcHosts {
Context.etcHosts = &aghnet.EtcHostsContainer{}
Context.etcHosts.Init("")
Context.clients.Init(config.Clients, Context.dhcpServer, Context.etcHosts)
}
Context.clients.Init(config.Clients, Context.dhcpServer, Context.etcHosts)
config.Clients = nil
if (runtime.GOOS == "linux" || runtime.GOOS == "darwin") &&
@@ -330,7 +332,10 @@ func run(args options) {
}()
if Context.dhcpServer != nil {
_ = Context.dhcpServer.Start()
err = Context.dhcpServer.Start()
if err != nil {
log.Error("starting dhcp server: %s", err)
}
}
}

View File

@@ -6,52 +6,46 @@ import (
"net/http"
"strings"
"github.com/AdguardTeam/AdGuardHome/internal/aghstrings"
"github.com/AdguardTeam/golibs/log"
)
// --------------------
// internationalization
// --------------------
var allowedLanguages = map[string]bool{
"be": true,
"bg": true,
"cs": true,
"da": true,
"de": true,
"en": true,
"es": true,
"fa": true,
"fr": true,
"hr": true,
"hu": true,
"id": true,
"it": true,
"ja": true,
"ko": true,
"nl": true,
"no": true,
"pl": true,
"pt-br": true,
"pt-pt": true,
"ro": true,
"ru": true,
"si-lk": true,
"sk": true,
"sl": true,
"sr-cs": true,
"sv": true,
"th": true,
"tr": true,
"vi": true,
"zh-cn": true,
"zh-hk": true,
"zh-tw": true,
}
func isLanguageAllowed(language string) bool {
l := strings.ToLower(language)
return allowedLanguages[l]
}
// TODO(a.garipov): Get rid of a global variable?
var allowedLanguages = aghstrings.NewSet(
"be",
"bg",
"cs",
"da",
"de",
"en",
"es",
"fa",
"fr",
"hr",
"hu",
"id",
"it",
"ja",
"ko",
"nl",
"no",
"pl",
"pt-br",
"pt-pt",
"ro",
"ru",
"si-lk",
"sk",
"sl",
"sr-cs",
"sv",
"th",
"tr",
"vi",
"zh-cn",
"zh-hk",
"zh-tw",
)
func handleI18nCurrentLanguage(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/plain")
@@ -80,12 +74,15 @@ func handleI18nChangeLanguage(w http.ResponseWriter, r *http.Request) {
msg := "empty language specified"
log.Println(msg)
http.Error(w, msg, http.StatusBadRequest)
return
}
if !isLanguageAllowed(language) {
if !allowedLanguages.Has(language) {
msg := fmt.Sprintf("unknown language specified: %s", language)
log.Println(msg)
http.Error(w, msg, http.StatusBadRequest)
return
}

View File

@@ -90,7 +90,7 @@ func (r *RDNS) workerLoop() {
for ip := range r.ipCh {
host, err := r.exchanger.Exchange(ip)
if err != nil {
log.Error("rdns: resolving %q: %s", ip, err)
log.Debug("rdns: resolving %q: %s", ip, err)
continue
}

View File

@@ -9,6 +9,7 @@ import (
"testing"
"time"
"github.com/AdguardTeam/AdGuardHome/internal/aghstrings"
"github.com/AdguardTeam/AdGuardHome/internal/aghtest"
"github.com/AdguardTeam/dnsproxy/upstream"
"github.com/AdguardTeam/golibs/cache"
@@ -82,7 +83,7 @@ func TestRDNS_Begin(t *testing.T) {
list: map[string]*Client{},
idIndex: tc.cliIDIndex,
ipToRC: map[string]*RuntimeClient{},
allTags: map[string]bool{},
allTags: aghstrings.NewSet(),
},
}
ipCache.Clear()
@@ -172,7 +173,7 @@ func TestRDNS_WorkerLoop(t *testing.T) {
list: map[string]*Client{},
idIndex: map[string]*Client{},
ipToRC: map[string]*RuntimeClient{},
allTags: map[string]bool{},
allTags: aghstrings.NewSet(),
}
ch := make(chan net.IP)
rdns := &RDNS{

View File

@@ -2,11 +2,15 @@ package home
import (
"fmt"
"net/url"
"os"
"path"
"path/filepath"
"runtime"
"strconv"
"strings"
"github.com/AdguardTeam/AdGuardHome/internal/aghnet"
"github.com/AdguardTeam/golibs/log"
"github.com/google/renameio/maybe"
"golang.org/x/crypto/bcrypt"
@@ -14,7 +18,7 @@ import (
)
// currentSchemaVersion is the current schema version.
const currentSchemaVersion = 8
const currentSchemaVersion = 10
// These aliases are provided for convenience.
type (
@@ -74,6 +78,8 @@ func upgradeConfigSchema(oldVersion int, diskConf yobj) (err error) {
upgradeSchema5to6,
upgradeSchema6to7,
upgradeSchema7to8,
upgradeSchema8to9,
upgradeSchema9to10,
}
n := 0
@@ -455,7 +461,7 @@ func upgradeSchema7to8(diskConf yobj) (err error) {
bindHostVal := dns["bind_host"]
bindHost, ok := bindHostVal.(string)
if !ok {
return fmt.Errorf("undexpected type of dns.bind_host: %T", bindHostVal)
return fmt.Errorf("unexpected type of dns.bind_host: %T", bindHostVal)
}
delete(dns, "bind_host")
@@ -464,6 +470,148 @@ func upgradeSchema7to8(diskConf yobj) (err error) {
return nil
}
// upgradeSchema8to9 performs the following changes:
//
// # BEFORE:
// 'dns':
// 'autohost_tld': 'lan'
//
// # AFTER:
// 'dns':
// 'local_domain_name': 'lan'
//
func upgradeSchema8to9(diskConf yobj) (err error) {
log.Printf("Upgrade yaml: 8 to 9")
diskConf["schema_version"] = 9
dnsVal, ok := diskConf["dns"]
if !ok {
return nil
}
dns, ok := dnsVal.(yobj)
if !ok {
return fmt.Errorf("unexpected type of dns: %T", dnsVal)
}
autohostTLDVal, ok := dns["autohost_tld"]
if !ok {
// This happens when upgrading directly from v0.105.2, because
// dns.autohost_tld was never set to any value. Go on and leave
// it that way.
//
// See https://github.com/AdguardTeam/AdGuardHome/issues/2988.
return nil
}
autohostTLD, ok := autohostTLDVal.(string)
if !ok {
return fmt.Errorf("unexpected type of dns.autohost_tld: %T", autohostTLDVal)
}
delete(dns, "autohost_tld")
dns["local_domain_name"] = autohostTLD
return nil
}
// addQUICPort inserts a port into QUIC upstream's hostname if it is missing.
func addQUICPort(ups string, port int) (withPort string) {
if ups == "" || ups[0] == '#' {
return ups
}
var doms string
withPort = ups
if strings.HasPrefix(ups, "[/") {
domsAndUps := strings.Split(strings.TrimPrefix(ups, "[/"), "/]")
if len(domsAndUps) != 2 {
return ups
}
doms, withPort = "[/"+domsAndUps[0]+"/]", domsAndUps[1]
}
if !strings.Contains(withPort, "://") {
return ups
}
upsURL, err := url.Parse(withPort)
if err != nil || upsURL.Scheme != "quic" {
return ups
}
var host string
host, err = aghnet.SplitHost(upsURL.Host)
if err != nil || host != upsURL.Host {
return ups
}
upsURL.Host = strings.Join([]string{host, strconv.Itoa(port)}, ":")
return doms + upsURL.String()
}
// upgradeSchema9to10 performs the following changes:
//
// # BEFORE:
// 'dns':
// 'upstream_dns':
// - 'quic://some-upstream.com'
//
// # AFTER:
// 'dns':
// 'upstream_dns':
// - 'quic://some-upstream.com:784'
//
func upgradeSchema9to10(diskConf yobj) (err error) {
log.Printf("Upgrade yaml: 9 to 10")
diskConf["schema_version"] = 10
dnsVal, ok := diskConf["dns"]
if !ok {
return nil
}
var dns yobj
dns, ok = dnsVal.(yobj)
if !ok {
return fmt.Errorf("unexpected type of dns: %T", dnsVal)
}
const quicPort = 784
for _, upsField := range []string{
"upstream_dns",
"local_ptr_upstreams",
} {
var upsVal any
upsVal, ok = dns[upsField]
if !ok {
continue
}
var ups yarr
ups, ok = upsVal.(yarr)
if !ok {
return fmt.Errorf("unexpected type of dns.%s: %T", upsField, upsVal)
}
var u string
for i, uVal := range ups {
u, ok = uVal.(string)
if !ok {
return fmt.Errorf("unexpected type of upstream field: %T", uVal)
}
ups[i] = addQUICPort(u, quicPort)
}
dns[upsField] = ups
}
return nil
}
// TODO(a.garipov): Replace with log.Output when we port it to our logging
// package.
func funcName() string {

View File

@@ -13,7 +13,7 @@ func TestUpgradeSchema1to2(t *testing.T) {
diskConf := testDiskConf(1)
err := upgradeSchema1to2(diskConf)
require.Nil(t, err)
require.NoError(t, err)
require.Equal(t, diskConf["schema_version"], 2)
@@ -36,7 +36,7 @@ func TestUpgradeSchema2to3(t *testing.T) {
diskConf := testDiskConf(2)
err := upgradeSchema2to3(diskConf)
require.Nil(t, err)
require.NoError(t, err)
require.Equal(t, diskConf["schema_version"], 3)
@@ -74,7 +74,7 @@ func TestUpgradeSchema7to8(t *testing.T) {
}
err := upgradeSchema7to8(oldConf)
require.Nil(t, err)
require.NoError(t, err)
require.Equal(t, oldConf["schema_version"], 8)
@@ -90,6 +90,58 @@ func TestUpgradeSchema7to8(t *testing.T) {
assert.Equal(t, host, newBindHosts[0])
}
func TestUpgradeSchema8to9(t *testing.T) {
const tld = "foo"
t.Run("with_autohost_tld", func(t *testing.T) {
oldConf := yobj{
"dns": yobj{
"autohost_tld": tld,
},
"schema_version": 8,
}
err := upgradeSchema8to9(oldConf)
require.NoError(t, err)
require.Equal(t, oldConf["schema_version"], 9)
dnsVal, ok := oldConf["dns"]
require.True(t, ok)
newDNSConf, ok := dnsVal.(yobj)
require.True(t, ok)
localDomainName, ok := newDNSConf["local_domain_name"].(string)
require.True(t, ok)
assert.Equal(t, tld, localDomainName)
})
t.Run("without_autohost_tld", func(t *testing.T) {
oldConf := yobj{
"dns": yobj{},
"schema_version": 8,
}
err := upgradeSchema8to9(oldConf)
require.NoError(t, err)
require.Equal(t, oldConf["schema_version"], 9)
dnsVal, ok := oldConf["dns"]
require.True(t, ok)
newDNSConf, ok := dnsVal.(yobj)
require.True(t, ok)
// Should be nil in order to be set to the default value by the
// following config rewrite.
_, ok = newDNSConf["local_domain_name"]
require.False(t, ok)
})
}
// assertEqualExcept removes entries from configs and compares them.
func assertEqualExcept(t *testing.T, oldConf, newConf yobj, oldKeys, newKeys []string) {
t.Helper()
@@ -162,3 +214,157 @@ func testDNSConf(schemaVersion int) (dnsConf yobj) {
return dnsConf
}
func TestAddQUICPort(t *testing.T) {
testCases := []struct {
name string
ups string
want string
}{{
name: "simple_ip",
ups: "8.8.8.8",
want: "8.8.8.8",
}, {
name: "url_ipv4",
ups: "quic://8.8.8.8",
want: "quic://8.8.8.8:784",
}, {
name: "url_ipv4_with_port",
ups: "quic://8.8.8.8:25565",
want: "quic://8.8.8.8:25565",
}, {
name: "url_ipv6",
ups: "quic://[::1]",
want: "quic://[::1]:784",
}, {
name: "url_ipv6_invalid",
ups: "quic://::1",
want: "quic://::1",
}, {
name: "url_ipv6_with_port",
ups: "quic://[::1]:25565",
want: "quic://[::1]:25565",
}, {
name: "url_hostname",
ups: "quic://example.com",
want: "quic://example.com:784",
}, {
name: "url_hostname_with_port",
ups: "quic://example.com:25565",
want: "quic://example.com:25565",
}, {
name: "url_hostname_with_endpoint",
ups: "quic://example.com/some-endpoint",
want: "quic://example.com:784/some-endpoint",
}, {
name: "url_hostname_with_port_endpoint",
ups: "quic://example.com:25565/some-endpoint",
want: "quic://example.com:25565/some-endpoint",
}, {
name: "non-quic_proto",
ups: "tls://example.com",
want: "tls://example.com",
}, {
name: "comment",
ups: "# comment",
want: "# comment",
}, {
name: "blank",
ups: "",
want: "",
}, {
name: "with_domain_ip",
ups: "[/example.domain/]8.8.8.8",
want: "[/example.domain/]8.8.8.8",
}, {
name: "with_domain_url",
ups: "[/example.domain/]quic://example.com",
want: "[/example.domain/]quic://example.com:784",
}, {
name: "invalid_domain",
ups: "[/exmaple.domain]quic://example.com",
want: "[/exmaple.domain]quic://example.com",
}}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
withPort := addQUICPort(tc.ups, 784)
assert.Equal(t, tc.want, withPort)
})
}
}
func TestUpgradeSchema9to10(t *testing.T) {
const ultimateAns = 42
testCases := []struct {
ups any
want any
wantErr string
name string
}{{
ups: yarr{"quic://8.8.8.8"},
want: yarr{"quic://8.8.8.8:784"},
wantErr: "",
name: "success",
}, {
ups: ultimateAns,
want: nil,
wantErr: "unexpected type of dns.upstream_dns: int",
name: "bad_yarr_type",
}, {
ups: yarr{ultimateAns},
want: nil,
wantErr: "unexpected type of upstream field: int",
name: "bad_upstream_type",
}}
for _, tc := range testCases {
conf := yobj{
"dns": yobj{
"upstream_dns": tc.ups,
},
"schema_version": 9,
}
t.Run(tc.name, func(t *testing.T) {
err := upgradeSchema9to10(conf)
if tc.wantErr != "" {
require.Error(t, err)
assert.Equal(t, tc.wantErr, err.Error())
return
}
require.NoError(t, err)
require.Equal(t, conf["schema_version"], 10)
dnsVal, ok := conf["dns"]
require.True(t, ok)
newDNSConf, ok := dnsVal.(yobj)
require.True(t, ok)
fixedUps, ok := newDNSConf["upstream_dns"].(yarr)
require.True(t, ok)
assert.Equal(t, tc.want, fixedUps)
})
}
t.Run("no_dns", func(t *testing.T) {
err := upgradeSchema9to10(yobj{})
assert.NoError(t, err)
})
t.Run("bad_dns", func(t *testing.T) {
err := upgradeSchema9to10(yobj{
"dns": ultimateAns,
})
require.Error(t, err)
assert.Equal(t, "unexpected type of dns: int", err.Error())
})
}

View File

@@ -171,7 +171,7 @@ func (web *Web) Start() {
hostStr := web.conf.BindHost.String()
// we need to have new instance, because after Shutdown() the Server is not usable
web.httpServer = &http.Server{
ErrorLog: log.StdLog("web: http", log.DEBUG),
ErrorLog: log.StdLog("web: plain", log.DEBUG),
Addr: net.JoinHostPort(hostStr, strconv.Itoa(web.conf.BindPort)),
Handler: withMiddlewares(Context.mux, limitRequestBody),
ReadTimeout: web.conf.ReadTimeout,
@@ -184,7 +184,7 @@ func (web *Web) Start() {
if web.conf.BetaBindPort != 0 {
web.httpServerBeta = &http.Server{
ErrorLog: log.StdLog("web: http", log.DEBUG),
ErrorLog: log.StdLog("web: plain", log.DEBUG),
Addr: net.JoinHostPort(hostStr, strconv.Itoa(web.conf.BetaBindPort)),
Handler: withMiddlewares(Context.mux, limitRequestBody, web.wrapIndexBeta),
ReadTimeout: web.conf.ReadTimeout,