Compare commits

...

11 Commits

Author SHA1 Message Date
Eugene Burkov
d0772fda5f Pull request: 2807 listen address switching
Merge in DNS/adguard-home from 2807-addr-switch-bug to master

Updates #2807.

Squashed commit of the following:

commit 0340469a70c4f8b40d5b42930a967ea5e30f1331
Merge: 3ab4d43d 5c2ead5f
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Aug 3 19:57:31 2021 +0300

    Merge branch 'master' into 2807-addr-switch-bug

commit 3ab4d43d32e14e99ac49f75f797b69996d86c096
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Aug 3 19:21:08 2021 +0300

    all: upd dnsproxy
2021-08-03 20:03:13 +03:00
Ainar Garipov
5c2ead5f60 Pull request: home: fix tls config comparison
Closes #3411.

Squashed commit of the following:

commit 42deaa1ca804429a5c523641997b4e8d453952e6
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Aug 3 19:47:32 2021 +0300

    home: imp code

commit a69f6469e5e76e17c83537f7a763f047201fd15a
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Aug 3 18:54:59 2021 +0300

    home: fix tls config comparison
2021-08-03 19:55:04 +03:00
Ainar Garipov
c14bde280e Pull request: client: upd i18n
Merge in DNS/adguard-home from 2643-upd-i18n to master

Squashed commit of the following:

commit 12f4de7608c7a2335a137859301ff3a51e239596
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Aug 3 13:32:37 2021 +0300

    client: fix punct in fr

commit 01369e0985ffd0f8780e514f9af614909d3ecdb4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Aug 3 13:27:02 2021 +0300

    client: fix punct in de, fr

commit d06ea8fe2d2ca4f50e8721d9edb0a895062ac0a0
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Aug 3 13:07:57 2021 +0300

    client: upd i18n
2021-08-03 13:40:21 +03:00
Ainar Garipov
fb6bc322c1 Pull request: all: do not refuse reqs from untrusted proxies
Updates #2799.

Squashed commit of the following:

commit bc768fdd48b563017520f962480be4b2be90666a
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Aug 2 15:00:10 2021 +0300

    all: do not refuse reqs from untrusted proxies
2021-08-02 15:11:00 +03:00
Ainar Garipov
12db98230c Pull request: client: imp setup guide i18n
Merge in DNS/adguard-home from imp-i18n to master

Squashed commit of the following:

commit a109d8fd8a32ab20106d1df61ab945bb139c12e4
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Jul 30 16:01:09 2021 +0300

    client: imp setup guide i18n
2021-07-30 16:09:12 +03:00
Eugene Burkov
6fa1167251 Pull request: 3289 freebsd dhcp
Merge in DNS/adguard-home from 3289-freebsd-dhcp to master

Updates #3289.

Squashed commit of the following:

commit 1365d8f17293da611b860525d519a7bbd7851902
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Fri Jul 30 15:01:13 2021 +0300

    dhcpd: fix doc

commit 26724df27e92d457c39c8bf0fb78179a874e3fb2
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Fri Jul 30 14:52:58 2021 +0300

    all: imp code & docs

commit 9a9574a885d3d2129ef54fefb9a56857ce060cff
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Thu Jul 29 15:51:07 2021 +0300

    all: fix broadcasting, sup freebsd dhcp, fix http response
2021-07-30 15:27:24 +03:00
Ainar Garipov
63ee95dfbe Pull request: all: replace aghstrings with stringutil
Merge in DNS/adguard-home from add-stringutil to master

Squashed commit of the following:

commit 4ca9b29356de7d0a162b1e5a6496c691e9751f15
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Jul 29 17:29:25 2021 +0300

    all: replace aghstrings with stringutil
2021-07-29 17:40:31 +03:00
Ainar Garipov
0030e31e33 Pull request: all: add links to new guidelines
Merge in DNS/adguard-home from mv-hacking to master

Squashed commit of the following:

commit b4782bc2482c33dbf749f2249295fb0cb05f82e6
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Wed Jul 28 13:40:27 2021 +0300

    all: add links to new guidelines
2021-07-28 14:17:11 +03:00
Eugene Burkov
fc063f580f Pull request: 3372 dnscrypt querylog
Merge in DNS/adguard-home from 3372-dnscrypt-logs to master

Updates #3372.

Squashed commit of the following:

commit 603383227540e1e62911c66d3c0440187d6a313c
Merge: c0379e2b f2046a5f
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Jul 27 19:05:18 2021 +0300

    Merge branch 'master' into 3372-dnscrypt-logs

commit c0379e2bb53376efaf0a222e5be9a232821059c6
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Jul 27 18:58:07 2021 +0300

    all: fix log of changes

commit 7ba9dba530684f00f17e8cafbd6a7f5ccde8579c
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Jul 27 18:54:05 2021 +0300

    all: log changes

commit dbf107642bb39df63b45bd2844e10e3d682e3455
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Jul 27 18:09:51 2021 +0300

    all: upd dnscrypt
2021-07-27 19:22:25 +03:00
Ainar Garipov
f2046a5f06 Pull request: scripts: imp docs and ports
Merge in DNS/adguard-home from dockerfile-ports to master

Squashed commit of the following:

commit ece0295105ee4429be68a72724da457dd1e87f7f
Merge: 3c5ae853 2f661df8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Jul 27 12:31:04 2021 +0300

    Merge branch 'master' into dockerfile-ports

commit 3c5ae8538b1463c21e91289adc27ceac9012e04e
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Jul 26 20:56:45 2021 +0300

    scripts: imp docs and ports
2021-07-27 13:12:26 +03:00
Eugene Burkov
2f661df88c Pull request: 2799 trusted proxy
Merge in DNS/adguard-home from 2799-trusted-proxy to master

Updates #2799.

Squashed commit of the following:

commit 708a06b30116126a575767ea70865a6de90de774
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Fri Jul 23 18:56:16 2021 +0300

    all: add trusted proxy mechanism
2021-07-26 19:30:35 +03:00
56 changed files with 551 additions and 1095 deletions

View File

@@ -15,6 +15,7 @@ and this project adheres to
### Added
- Static IP address detection on FreeBSD ([#3289]).
- Optimistic cache ([#2145]).
- New possible value of `6h` for `querylog_interval` setting ([#2504]).
- Blocking access using client IDs ([#2624], [#3162]).
@@ -42,6 +43,9 @@ and this project adheres to
### Changed
- DNS-over-HTTPS queries that come from HTTP proxies in the `trusted_proxies`
list now use the real IP address of the client instead of the address of the
proxy ([#2799]).
- Clients who are blocked by access settings now receive a `REFUSED` response
when a protocol other than DNS-over-UDP and DNSCrypt is used.
- `querylog_interval` setting is now formatted in hours.
@@ -60,6 +64,11 @@ and this project adheres to
### Fixed
- Switching listening address to unspecified one when bound to a single
specified IPv4 address on Darwin (macOS) ([#2807]).
- Incomplete HTTP response for static IP address.
- DNSCrypt queries weren't appearing in query log ([#3372]).
- Wrong IP address for proxied DNS-over-HTTPS queries ([#2799]).
- Domain name letter case mismatches in DNS rewrites ([#3351]).
- Conflicts between IPv4 and IPv6 DNS rewrites ([#3343]).
- Letter case mismatches in `CNAME` filtering ([#3335]).
@@ -89,6 +98,8 @@ and this project adheres to
[#2504]: https://github.com/AdguardTeam/AdGuardHome/issues/2504
[#2624]: https://github.com/AdguardTeam/AdGuardHome/issues/2624
[#2763]: https://github.com/AdguardTeam/AdGuardHome/issues/2763
[#2799]: https://github.com/AdguardTeam/AdGuardHome/issues/2799
[#2807]: https://github.com/AdguardTeam/AdGuardHome/issues/2807
[#3012]: https://github.com/AdguardTeam/AdGuardHome/issues/3012
[#3013]: https://github.com/AdguardTeam/AdGuardHome/issues/3013
[#3136]: https://github.com/AdguardTeam/AdGuardHome/issues/3136
@@ -103,9 +114,11 @@ and this project adheres to
[#3217]: https://github.com/AdguardTeam/AdGuardHome/issues/3217
[#3256]: https://github.com/AdguardTeam/AdGuardHome/issues/3256
[#3257]: https://github.com/AdguardTeam/AdGuardHome/issues/3257
[#3289]: https://github.com/AdguardTeam/AdGuardHome/issues/3289
[#3335]: https://github.com/AdguardTeam/AdGuardHome/issues/3335
[#3343]: https://github.com/AdguardTeam/AdGuardHome/issues/3343
[#3351]: https://github.com/AdguardTeam/AdGuardHome/issues/3351
[#3372]: https://github.com/AdguardTeam/AdGuardHome/issues/3372

View File

@@ -1,524 +1,79 @@
# AdGuard Home Developer Guidelines
Following this document is obligatory for all new code. Some of the rules
aren't enforced as thoroughly or remain broken in old code, but this is still
the place to find out about what we **want** our code to look like and how to
improve it.
The rules are mostly sorted in the alphabetical order.
## Contents
* [Git](#git)
* [Go](#go)
* [Code](#code)
* [Commenting](#commenting)
* [Formatting](#formatting)
* [Naming](#naming)
* [Testing](#testing)
* [Recommended Reading](#recommended-reading)
* [Markdown](#markdown)
* [Shell Scripting](#shell-scripting)
* [Shell Conditionals](#shell-conditionals)
* [Text, Including Comments](#text-including-comments)
* [YAML](#yaml)
<!-- NOTE: Use the IDs that GitHub would generate in order for this to work both
on GitHub and most other Markdown renderers. Use both "id" and "name"
attributes to make it work in Markdown renderers that strip "id". -->
This document was moved to the [AdGuard Code Guidelines repository][repo]. All
sections with IDs now only have links to the corresponding files and sections in
that repository.
## <a href="#git" id="git" name="git">Git</a>
* Call your branches either `NNNN-fix-foo` (where `NNNN` is the ID of the
GitHub issue you worked on in this branch) or just `fix-foo` if there was no
GitHub issue.
* Follow the commit message header format:
```none
pkg: fix the network error logging issue
```
Where `pkg` is the directory or Go package (without the `internal/` part)
where most changes took place. If there are several such packages, or the
change is top-level only, write `all`.
* Keep your commit messages, including headers, to eighty (**80**) columns.
* Only use lowercase letters in your commit message headers. The rest of the
message should follow the plain text conventions below.
The only exceptions are direct mentions of identifiers from the source code
and filenames like `HACKING.md`.
This section was moved to [its own document][git].
## <a href="#go" id="go" name="go">Go</a>
> Not Golang, not GO, not GOLANG, not GoLang. It is Go in natural language,
> golang for others.
This section was moved to [its own document][go].
— [@rakyll](https://twitter.com/rakyll/status/1229850223184269312)
### <a href="#code" id="code" name="code">Code</a>
### <a href="#code" id="code" name="code">Code</a>
This subsection was moved to the [corresponding section][code] of the Go
guidelines document.
* Always `recover` from panics in new goroutines. Preferably in the very
first statement. If all you want there is a log message, use `log.OnPanic`.
### <a href="#commenting" id="commenting" name="commenting">Commenting</a>
* Avoid `fallthrough`. It makes it harder to rearrange `case`s, to reason
about the code, and also to switch the code to a handler approach, if that
becomes necessary later.
This subsection was moved to the [corresponding section][cmnt] of the Go
guidelines document.
* Avoid `goto`.
### <a href="#formatting" id="formatting" name="formatting">Formatting</a>
* Avoid `init` and use explicit initialization functions instead.
This subsection was moved to the [corresponding section][fmt] of the Go
guidelines document.
* Avoid `new`, especially with structs, unless a temporary value is needed,
for example when checking the type of an error using `errors.As`.
### <a href="#naming" id="naming" name="naming">Naming</a>
* Check against empty strings like this:
This subsection was moved to the [corresponding section][name] of the Go
guidelines document.
```go
if s == "" {
// …
}
```
### <a href="#testing" id="testing" name="testing">Testing</a>
Except when the check is done to then use the first character:
```go
if len(s) > 0 {
c := s[0]
}
```
* Constructors should validate their arguments and return meaningful errors.
As a corollary, avoid lazy initialization.
* Prefer to define methods on pointer receievers, unless the type is small or
a non-pointer receiever is required, for example `MarshalFoo` methods (see
[staticcheck-911]).
* Don't mix horizontal and vertical placement of arguments in function and
method calls. That is, either this:
```go
err := f(a, b, c)
```
Or, when the arguments are too long, this:
```go
err := functionWithALongName(
firstArgumentWithALongName,
secondArgumentWithALongName,
thirdArgumentWithALongName,
)
```
Or, with a struct literal:
```go
err := functionWithALongName(arg, structType{
field1: val1,
field2: val2,
})
```
But **never** this:
```go
err := functionWithALongName(firstArgumentWithALongName,
secondArgumentWithALongName,
thirdArgumentWithALongName,
)
```
* Don't rely only on file names for build tags to work. Always add build tags
as well.
* Don't use `fmt.Sprintf` where a more structured approach to string
conversion could be used. For example, `aghnet.JoinHostPort`,
`net.JoinHostPort` or `url.(*URL).String`.
* Don't use naked `return`s.
* Don't write non-test code with more than four (**4**) levels of indentation.
Just like [Linus said], plus an additional level for an occasional error
check or struct initialization.
The exception proving the rule is the table-driven test code, where an
additional level of indentation is allowed.
* Eschew external dependencies, including transitive, unless absolutely
necessary.
* Minimize scope of variables as much as possible.
* No name shadowing, including of predeclared identifiers, since it can often
lead to subtle bugs, especially with errors. This rule does not apply to
struct fields, since they are always used together with the name of the
struct value, so there isn't any confusion.
* Prefer constants to variables where possible. Avoid global variables. Use
[constant errors] instead of `errors.New`.
* Prefer defining `Foo.String` and `ParseFoo` in terms of `Foo.MarshalText`
and `Foo.UnmarshalText` correspondingly and not the other way around.
* Prefer to use named functions for goroutines.
* Program code lines should not be longer than one hundred (**100**) columns.
For comments, see the text section below.
* Use linters. `make go-lint`.
* Write logs and error messages in lowercase only to make it easier to `grep`
logs and error messages without using the `-i` flag.
### <a href="#commenting" id="commenting" name="commenting">Commenting</a>
* See also the “[Text, Including Comments]” section below.
* Document everything, including unexported top-level identifiers, to build
a habit of writing documentation.
* Don't put identifiers into any kind of quotes.
* Put comments above the documented entity, **not** to the side, to improve
readability.
* When a method implements an interface, start the doc comment with the
standard template:
```go
// Foo implements the Fooer interface for *foo.
func (f *foo) Foo() {
// …
}
```
When the implemented interface is unexported:
```go
// Unwrap implements the hidden wrapper interface for *fooError.
func (err *fooError) Unwrap() (unwrapped error) {
// …
}
```
### <a href="#formatting" id="formatting" name="formatting">Formatting</a>
* Decorate `break`, `continue`, `return`, and other terminating statements
with empty lines unless it's the only statement in that block.
* Don't group type declarations together. Unlike with blocks of `const`s,
where a `iota` may be used or where all constants belong to a certain type,
there is no reason to group `type`s.
* Group `require.*` blocks together with the presceding related statements,
but separate from the following `assert.*` and unrelated requirements.
```go
val, ok := valMap[key]
require.True(t, ok)
require.NotNil(t, val)
assert.Equal(t, expected, val)
```
* Use `gofumpt --extra -s`.
* Write slices of struct like this:
```go
ts := []T{{
Field: Value0,
// …
}, {
Field: Value1,
// …
}, {
Field: Value2,
// …
}}
```
### <a href="#naming" id="naming" name="naming">Naming</a>
* Don't use underscores in file and package names, unless they're build tags
or for tests. This is to prevent accidental build errors with weird tags.
* Name benchmarks and tests using the same convention as examples. For
example:
```go
func TestFunction(t *testing.T) { /* … */ }
func TestFunction_suffix(t *testing.T) { /* … */ }
func TestType_Method(t *testing.T) { /* … */ }
func TestType_Method_suffix(t *testing.T) { /* … */ }
```
* Name parameters in interface definitions:
```go
type Frobulator interface {
Frobulate(f Foo, b Bar) (r Result, err error)
}
```
* Name the deferred errors (e.g. when closing something) `derr`.
* Unused arguments in anonymous functions must be called `_`:
```go
v.onSuccess = func(_ int, msg string) {
// …
}
```
* Use named returns to improve readability of function signatures.
* When naming a file which defines an entity, use singular nouns, unless the
entity is some form of a container for other entities:
```go
// File: client.go
package foo
type Client struct {
// …
}
```
```go
// File: clients.go
package foo
type Clients []*Client
// …
type ClientsWithCache struct {
// …
}
```
### <a href="#testing" id="testing" name="testing">Testing</a>
* Use `assert.NoError` and `require.NoError` instead of `assert.Nil` and
`require.Nil` on errors.
* Use formatted helpers, like `assert.Nilf` or `require.Nilf`, instead of
simple helpers when a formatted message is required.
* Use functions like `require.Foo` instead of `assert.Foo` when the test
cannot continue if the condition is false.
### <a href="#recommended-reading" id="recommended-reading" name="recommended-reading">Recommended Reading</a>
* <https://github.com/golang/go/wiki/CodeReviewComments>.
* <https://github.com/golang/go/wiki/TestComments>.
* <https://go-proverbs.github.io/>
[Linus said]: https://www.kernel.org/doc/html/v4.17/process/coding-style.html#indentation
[Text, Including Comments]: #text-including-comments
[constant errors]: https://dave.cheney.net/2016/04/07/constant-errors
[staticcheck-911]: https://github.com/dominikh/go-tools/issues/911
This subsection was moved to the [corresponding section][test] of the Go
guidelines document.
### <a href="#recommended-reading" id="recommended-reading" name="recommended-reading">Recommended Reading</a>
This subsection was moved to the [corresponding section][read] of the Go
guidelines document.
## <a href="#markdown" id="markdown" name="markdown">Markdown</a>
* **TODO(a.garipov):** Define more Markdown conventions.
* Prefer triple-backtick preformatted code blocks to indented code blocks.
* Use asterisks and not underscores for bold and italic.
* Use either link references or link destinations only. Put all link
reference definitions at the end of the second-level block.
This section was moved to [its own document][md].
## <a href="#shell-scripting" id="shell-scripting" name="shell-scripting">Shell Scripting</a>
* Avoid bashisms and GNUisms, prefer POSIX features only.
* Avoid spaces between patterns of the same `case` condition.
* Don't use the option `-q` of the command `ls`. Some systems that use the
Busybox version of `ash` don't support it.
* `export` and `readonly` should be used separately from variable assignment,
because otherwise failures in command substitutions won't stop the script.
That is, do this:
```sh
X="$( echo 42 )"
export X
```
And **not** this:
```sh
# Bad!
export X="$( echo 42 )"
```
* If a binary value is needed, use `0` for `false`, and `1` for `true`.
* Mark every variable that shouldn't change later as `readonly`.
* Prefer `'raw strings'` to `"double quoted strings"` whenever possible.
* Put spaces within `$( cmd )`, `$(( expr ))`, and `{ cmd; }`. Avoid spaces
within `${var}`.
* Put utility flags in the ASCII order and **don't** group them together. For
example, `ls -1 -A -l`.
* Script code lines should not be longer than one hundred (**100**) columns.
For comments, see the text section below.
* `snake_case`, not `camelCase` for variables. `kebab-case` for filenames.
* Start scripts with the following sections in the following order:
1. Shebang.
1. Some initial documentation (optional).
1. Verbosity level parsing (optional).
1. `set` options.
* UPPERCASE names for external exported variables, lowercase for local,
unexported ones.
* Use `set -e -f -u` and also `set -x` in verbose mode.
* Use the `"$var"` form instead of the `$var` form, unless word splitting is
required.
* When concatenating, always use the form with curly braces to prevent
accidental bad variable names. That is, `"${var}_tmp.txt"` and **not**
`"$var_tmp.txt"`. The latter will try to lookup variable `var_tmp`.
* When concatenating, surround the whole string with quotes. That is, use
this:
```sh
dir="${TOP_DIR}/sub"
```
And **not** this:
```sh
# Bad!
dir="${TOP_DIR}"/sub
```
### <a href="#shell-conditionals" id="shell-conditionals" name="shell-conditionals">Shell Conditionals</a>
Guidelines and agreements for using command `test`, also known as `[`:
* For conditionals that check for equality against multiple values, prefer
`case` instead of `test`.
* Prefer the `!= ''` form instead of using `-n` to check if string is empty.
* Spell compound conditions with `&&`, `||`, and `!` **outside** of `test`
instead of `-a`, `-o`, and `!` **inside** of `test` correspondingly. The
latter ones are pretty much deprecated in POSIX.
See also: “[Problems With the `test` Builtin: What Does `-a` Mean?][test]”.
* Use `=` for strings and `-eq` for numbers to catch typing errors.
[test]: https://www.oilshell.org/blog/2017/08/31.html
This section was moved to [its own document][sh].
### <a href="#shell-conditionals" id="shell-conditionals" name="shell-conditionals">Shell Conditionals</a>
This subsection was moved to the [corresponding section][cond] of the Shell
guidelines document.
## <a href="#text-including-comments" id="text-including-comments" name="text-including-comments">Text, Including Comments</a>
* End sentences with appropriate punctuation.
* Headers should be written with all initial letters capitalized, except for
references to variable names that start with a lowercase letter.
* Mark temporary todos—that is, todos that must be resolved or removed before
publishing a change—with two exclamation signs:
```go
// TODO(usr1): !! Remove this debug before pushing!
```
This makes it easier to find them both during development and during code
review.
* Start sentences with a capital letter, unless the first word is a reference
to a variable name that starts with a lowercase letter.
* Text should wrap at eighty (**80**) columns to be more readable, to use
a common standard, and to allow editing or diffing side-by-side without
wrapping.
The only exception are long hyperlinks.
* Use U.S. English, as it is the most widely used variety of English in the
code right now as well as generally.
* Use double spacing between sentences to make sentence borders more clear.
* Use the serial comma (a.k.a. Oxford comma) to improve comprehension,
decrease ambiguity, and use a common standard.
* Write todos like this:
```go
// TODO(usr1): Fix the frobulation issue.
```
Or, if several people need to look at the code:
```go
// TODO(usr1, usr2): Fix the frobulation issue.
```
This section was moved to [its own document][txt].
## <a href="#yaml" id="yaml" name="yaml">YAML</a>
* **TODO(a.garipov):** Define naming conventions for schema names in our
OpenAPI YAML file. And just generally OpenAPI conventions.
This section was moved to [its own document][yaml].
* **TODO(a.garipov):** Find a YAML formatter or write our own.
* All strings, including keys, must be quoted. Reason: the “[NO-rway Law]”.
* Indent with two (**2**) spaces. YAML documents can get pretty
deeply-nested.
* No extra indentation in multiline arrays:
```yaml
'values':
- 'value-1'
- 'value-2'
- 'value-3'
```
* Prefer single quotes for strings to prevent accidental escaping, unless
escaping is required or there are single quotes inside the string (e.g. for
GitHub Actions).
* Use `>` for multiline strings, unless you need to keep the line breaks. Use
`|` for multiline strings when you do.
[NO-rway Law]: https://news.ycombinator.com/item?id=17359376
[cmnt]: https://github.com/AdguardTeam/CodeGuidelines/blob/master/Go/Go.md#commenting
[code]: https://github.com/AdguardTeam/CodeGuidelines/blob/master/Go/Go.md#code
[cond]: https://github.com/AdguardTeam/CodeGuidelines/blob/master/Go/Shell.md#shell-conditionals
[fmt]: https://github.com/AdguardTeam/CodeGuidelines/blob/master/Go/Go.md#formatting
[git]: https://github.com/AdguardTeam/CodeGuidelines/blob/master/Go/Git.md
[go]: https://github.com/AdguardTeam/CodeGuidelines/blob/master/Go/Go.md
[md]: https://github.com/AdguardTeam/CodeGuidelines/blob/master/Go/Markdown.md
[name]: https://github.com/AdguardTeam/CodeGuidelines/blob/master/Go/Go.md#naming
[read]: https://github.com/AdguardTeam/CodeGuidelines/blob/master/Go/Go.md#recommended-reading
[repo]: https://github.com/AdguardTeam/CodeGuidelines
[sh]: https://github.com/AdguardTeam/CodeGuidelines/blob/master/Go/Shell.md
[test]: https://github.com/AdguardTeam/CodeGuidelines/blob/master/Go/Go.md#testing
[txt]: https://github.com/AdguardTeam/CodeGuidelines/blob/master/Go/Text.md
[yaml]: https://github.com/AdguardTeam/CodeGuidelines/blob/master/Go/YAML.md

View File

@@ -326,10 +326,10 @@
"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.",
"install_devices_windows_list_1": "Otevřete ovládací panel prostřednictvím nabídky Start nebo vyhledání v systému Windows.",
"install_devices_windows_list_2": "Přejděte na kategorii Síť a Internet a poté na Centrum sítí a sdílení.",
"install_devices_windows_list_3": "Na levé straně obrazovky najděte možnost Změnit nastavení adaptéru a klepněte na něj.",
"install_devices_windows_list_3": "Na levé straně obrazovky najděte možnost \"Změnit nastavení adaptéru\" a klepněte na něj.",
"install_devices_windows_list_4": "Vyberte své aktivní spojení, klikněte na něj pravým tlačítkem myši a zvolte Vlastnosti.",
"install_devices_windows_list_5": "V seznamu najděte Internet Protocol Version 4 (TCP/IP), vyberte jej a znovu klikněte na Vlastnosti.",
"install_devices_windows_list_6": "Zvolte Použít následující adresy serveru DNS a zadejte adresy AdGuard Home..",
"install_devices_windows_list_5": "V seznamu najděte \"Internet Protocol Version 4 (TCP/IP)\", (nebo IPv6, \"Internet Protocol Version 6 (TCP/IPv6)\"), vyberte jej a znovu klikněte na Vlastnosti.",
"install_devices_windows_list_6": "Zvolte \"Použít následující adresy serveru DNS\" a zadejte adresy serveru AdGuard Home.",
"install_devices_macos_list_1": "Klikněte na ikonu Apple a přejděte na položku Systémové předvolby.",
"install_devices_macos_list_2": "Klikněte na Síť.",
"install_devices_macos_list_3": "Vyberte první připojení v seznamu a klepněte na tlačítko Pokročilé.",

View File

@@ -328,7 +328,7 @@
"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.",
"install_devices_windows_list_4": "Wählen Sie Ihre aktive Verbindung aus, klicken Sie mit der rechten Maustaste darauf und wählen Sie „Eigenschaften”.",
"install_devices_windows_list_5": "Suchen Sie in der Liste nach „Internet Protokoll Version 4 (TCP/IP)”, markieren Sie diese und klicken Sie dann erneut auf „Eigenschaften”.",
"install_devices_windows_list_5": "Suchen Sie in der Liste nach „Internet Protokoll Version 4 (TCP/IP)” (oder, für IPv6, „Internet Protocol Version 6 (TCP/IPv6)“), markieren Sie diese und klicken Sie dann erneut auf „Eigenschaften”.",
"install_devices_windows_list_6": "Wählen Sie „Folgende DNS-Serveradressen verwenden” und geben Sie Ihre AdGuard Home-Serveradressen ein.",
"install_devices_macos_list_1": "Klicken Sie auf das Apple-Symbol (oben links in der Menüzeile) und wählen den Eintrag „Systemeinstellungen”.",
"install_devices_macos_list_2": "Klicken Sie dort auf „Netzwerk”",

View File

@@ -326,10 +326,10 @@
"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.",
"install_devices_windows_list_1": "Open Control Panel through Start menu or Windows search.",
"install_devices_windows_list_2": "Go to Network and Internet category and then to Network and Sharing Center.",
"install_devices_windows_list_3": "On the left side of the screen find Change adapter settings and click on it.",
"install_devices_windows_list_3": "On the left side of the screen find \"Change adapter settings\" and click on it.",
"install_devices_windows_list_4": "Select your active connection, right-click on it and choose Properties.",
"install_devices_windows_list_5": "Find Internet Protocol Version 4 (TCP/IP) in the list, select it and then click on Properties again.",
"install_devices_windows_list_6": "Choose Use the following DNS server addresses and enter your AdGuard Home server addresses.",
"install_devices_windows_list_5": "Find \"Internet Protocol Version 4 (TCP/IPv4)\" (or, for IPv6, \"Internet Protocol Version 6 (TCP/IPv6)\") in the list, select it and then click on Properties again.",
"install_devices_windows_list_6": "Choose \"Use the following DNS server addresses\" and enter your AdGuard Home server addresses.",
"install_devices_macos_list_1": "Click on Apple icon and go to System Preferences.",
"install_devices_macos_list_2": "Click on Network.",
"install_devices_macos_list_3": "Select the first connection in your list and click Advanced.",

View File

@@ -113,7 +113,7 @@
"for_last_days": "durante los últimos {{count}} días",
"for_last_days_plural": "durante los últimos {{count}} días",
"stats_disabled": "Las estadísticas se han deshabilitado. Puedes habilitarlas desde la <0>página de configuración</0>.",
"stats_disabled_short": "Las estadísticas han sido deshabilitadas",
"stats_disabled_short": "Las estadísticas se han deshabilitado",
"no_domains_found": "No se han encontrado dominios",
"requests_count": "Número de peticiones",
"top_blocked_domains": "Dominios más bloqueados",
@@ -326,10 +326,10 @@
"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.",
"install_devices_windows_list_1": "Abre el Panel de control a través del menú Inicio o en el buscador de Windows.",
"install_devices_windows_list_2": "Ve a la categoría Redes e Internet, luego a Centro de redes y recursos compartidos.",
"install_devices_windows_list_3": "En el lado izquierdo de la pantalla, busca Cambiar configuración del adaptador y luego haz clic en él.",
"install_devices_windows_list_3": "En el lado izquierdo de la pantalla, busca \"Cambiar configuración del adaptador\" y luego haz clic en él.",
"install_devices_windows_list_4": "Selecciona tu conexión activa, haz clic derecho sobre ella y elige Propiedades.",
"install_devices_windows_list_5": "Busca en la lista el Protocolo de Internet versión 4 (TCP/IP), selecciónalo y vuelve a hacer clic en Propiedades.",
"install_devices_windows_list_6": "Elige Usar las siguientes direcciones de servidor DNS e ingresa las direcciones de tu servidor AdGuard Home.",
"install_devices_windows_list_5": "Busca en la lista el \"Protocolo de Internet versión 4 (TCP/IPv4)\" (o \"Protocolo de Internet versión 6 (TCP/IPv6)\"), selecciónalo y vuelve a hacer clic en Propiedades.",
"install_devices_windows_list_6": "Elige \"Usar las siguientes direcciones de servidor DNS\" e ingresa las direcciones de tu servidor AdGuard Home.",
"install_devices_macos_list_1": "Haz clic en el icono de Apple y ve a Preferencias del sistema.",
"install_devices_macos_list_2": "Haz clic en Red.",
"install_devices_macos_list_3": "Selecciona la primera conexión de la lista y haz clic en Avanzado.",

View File

@@ -9,7 +9,7 @@
"bootstrap_dns": "Serveurs DNS d'amorçage",
"bootstrap_dns_desc": "Les serveurs DNS d'amorçage sont utilisés pour résoudre les adresses IP des résolveurs DoH/DoT que vous spécifiez comme upstream.",
"local_ptr_title": "Serveurs DNS privés inverses",
"local_ptr_desc": "Les serveurs DNS que AdGuard Home utilise pour les requêtes PTR locales. Ces serveurs sont utilisés pour résoudre les noms d'hôte des clients avec des adresses IP privées, par exemple \"192.168.12.34\", en utilisant le DNS inversé. Si ce paramètre n'est pas défini, AdGuard Home utilise les adresses des résolveurs DNS par défaut de votre système d'exploitation, à l'exception des adresses d'AdGuard Home lui-même.",
"local_ptr_desc": "Les serveurs DNS que AdGuard Home utilise pour les requêtes PTR locales. Ces serveurs sont utilisés pour résoudre les noms d'hôte des clients avec des adresses IP privées, par exemple « 192.168.12.34 », en utilisant le DNS inversé. Si ce paramètre n'est pas défini, AdGuard Home utilise les adresses des résolveurs DNS par défaut de votre système d'exploitation, à l'exception des adresses d'AdGuard Home lui-même.",
"local_ptr_default_resolver": "Par défaut, AdGuard Home utilise les résolveurs DNS inversés suivants : {{ip}}.",
"local_ptr_no_default_resolver": "AdGuard Home n'a pas pu déterminer de résolveurs DNS inversés privés appropriés pour ce système.",
"local_ptr_placeholder": "Saisissez une adresse de serveur par ligne",
@@ -326,10 +326,10 @@
"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.",
"install_devices_windows_list_1": "Ouvrez votre Panneau de configuration depuis le menu Démarrer ou la recherche Windows.",
"install_devices_windows_list_2": "Allez dans la catégorie Réseau et Internet et ensuite dans le Centre Réseau et Partage.",
"install_devices_windows_list_3": "Sur la partie gauche de l'écran, recherchez Modifier les paramètres de la carte et cliquez dessus.",
"install_devices_windows_list_3": "Sur la partie gauche de l'écran, recherchez « Modifier les paramètres de l'adaptateur » et cliquez dessus.",
"install_devices_windows_list_4": "Sélectionnez votre connexion active, clic droit dessus et sélectionnez Propriétés.",
"install_devices_windows_list_5": "Recherchez la version du protocole Internet 4 (TCP/IP) dans la liste, sélectionnez-la puis cliquez à nouveau sur Propriétés.",
"install_devices_windows_list_6": "Sélectionnez Utiliser ladresse de serveur DNS suivante et saisissez votre adresse de seveur AdGuard Home.",
"install_devices_windows_list_5": "Recherchez « Protocole Internet Version 4 (TCP/IPv4) » (soit, pour IPv6, « Protocole Internet Version 6 (TCP/IPv6) ») dans la liste, sélectionnez-la puis cliquez à nouveau sur Propriétés.",
"install_devices_windows_list_6": "Sélectionnez « Utiliser ladresse de serveur DNS suivante » et saisissez votre adresse de serveur AdGuard Home.",
"install_devices_macos_list_1": "Cliquez sur l'icône Apple et allez dans les Préférences Système.",
"install_devices_macos_list_2": "Cliquez sur Réseau.",
"install_devices_macos_list_3": "Sélectionnez la première connexion dans votre liste et cliquez sur Avancés.",
@@ -432,7 +432,7 @@
"access_disallowed_title": "Clients non autorisés",
"access_disallowed_desc": "Une liste d'adresses IP ou CIDR. Si configuré, AdGuard Home bloquera les requêtes provenant de ces adresses IP. Si des clients sont configurés, ce champ sera ignoré.",
"access_blocked_title": "Domaines interdits",
"access_blocked_desc": "A ne pas confondre avec les filtres. AdGuard Home rejette les requêtes DNS correspondant à ces domaines, et ces requêtes n'apparaissent même pas dans le journal des requêtes. Vous pouvez spécifier des noms de domaine exacts, des caractères génériques ou des règles de filtrage d'URL, par exemple \"exemple.org\", \"*.exemple.org\" ou \"||example.org^\" de manière correspondante.",
"access_blocked_desc": "A ne pas confondre avec les filtres. AdGuard Home rejette les requêtes DNS correspondant à ces domaines, et ces requêtes n'apparaissent même pas dans le journal des requêtes. Vous pouvez spécifier des noms de domaine exacts, des caractères génériques ou des règles de filtrage d'URL, par exemple « exemple.org », « *.exemple.org » ou « ||example.org^ » de manière correspondante.",
"access_settings_saved": "Paramètres d'accès enregistrés avec succès",
"updates_checked": "Mises à jour vérifiées",
"updates_version_equal": "AdGuard Home est à jour",

View File

@@ -5,9 +5,18 @@
"upstream_parallel": "Koristi paralelne upite kako bi ubrzali rješavanje istovremenim ispitavanjem svih upstream poslužitelja.",
"parallel_requests": "Paralelni zahtjevi",
"load_balancing": "Load-balancing",
"load_balancing_desc": "Šaljite upite po jednom poslužitelju u isto vrijeme. AdGuard Home će koristiti ponderirani slučajni algoritam za odabir poslužitelja, tako da će se najbrži poslužitelj češće koristiti.",
"load_balancing_desc": "Pitajte jedan po jedan uzvodni poslužitelj. AdGuard Home koristi svoj ponderirani slučajni algoritam za odabir poslužitelja tako da se najbrži poslužitelj koristi češće.",
"bootstrap_dns": "Bootstrap DNS poslužitelji",
"bootstrap_dns_desc": "Bootstrap DNS poslužitelji koriste se za rezolvanje IP adresa DoH/DoT rezolvera koje navedete kao upstreams.",
"local_ptr_title": "Privatni obrnuti DNS poslužitelji",
"local_ptr_desc": "DNS poslužitelji koje AdGuard Home koristi za lokalne PTR upite. Ti se poslužitelji koriste za razrješavanje naziva glavnog računala klijenata s privatnim IP adresama, na primjer \"192.168.12.34\", koristeći obrnuti DNS. Ako nije postavljeno, AdGuard Home koristi adrese zadanih DNS razrješivača vašeg OS-a, osim za adrese samog AdGuard Homea.",
"local_ptr_default_resolver": "Prema zadanim postavkama AdGuard Home koristi sljedeće obrnute DNS razrješivače: {{ip}}.",
"local_ptr_no_default_resolver": "AdGuard Home nije mogao odrediti prikladne privatne obrnute DNS razrješivače za ovaj sustav.",
"local_ptr_placeholder": "Unesite jednu adresu poslužitelja po retku",
"resolve_clients_title": "Omogući obrnuto rješavanje IP adresa klijenata",
"resolve_clients_desc": "Obrnuto razriješite IP adrese klijenata u nazive glavnih računala slanjem PTR upita odgovarajućim razrješivačima (privatni DNS poslužitelji za lokalne klijente, uzvodni poslužitelji za klijente s javnim IP adresama).",
"use_private_ptr_resolvers_title": "Koristi privatne reverzne DNS razrješivače",
"use_private_ptr_resolvers_desc": "Izvršite obrnuta DNS traženja za lokalno poslužene adrese pomoću ovih uzlaznih poslužitelja. Ako je onemogućen, AdGuard Home odgovara S NXDOMAIN-om na sve takve PTR zahtjeve osim za klijente poznate iz DHCP-a, /etc/hosts i tako dalje.",
"check_dhcp_servers": "Provjera DHCP poslužitelja",
"save_config": "Spremi konfiguraciju",
"enabled_dhcp": "DHCP poslužitelj je omogućen",
@@ -33,6 +42,7 @@
"form_error_mac_format": "Nevažeći MAC format",
"form_error_client_id_format": "Nevažeći format ID-a klijenta",
"form_error_server_name": "Nevažeće ime poslužitelja",
"form_error_subnet": "Podmrežu \"{{cidr}}\" ne sadrži IP adresu \"{{ip}}\"",
"form_error_positive": "Mora biti veće od 0",
"form_error_negative": "Mora biti jednako ili veće od 0",
"range_end_error": "Mora biti veće od početne vrijednosti raspona",
@@ -58,6 +68,9 @@
"dhcp_new_static_lease": "Novi static lease",
"dhcp_static_leases_not_found": "Nisu pronađeni statični DHCP leases",
"dhcp_add_static_lease": "Dodaj static lease",
"dhcp_reset_leases": "Ponovno postavljanje svih najmova",
"dhcp_reset_leases_confirm": "Jeste li sigurni da želite resetirati sve najmove?",
"dhcp_reset_leases_success": "DHCP najmovi uspješno se resetiraju",
"dhcp_reset": "Jeste li sigurni da želite poništiti DHCP postavke?",
"country": "Država",
"city": "Grad",
@@ -99,6 +112,8 @@
"for_last_24_hours": "u zadnja 24 sata",
"for_last_days": "zadnjih {{count}} dana",
"for_last_days_plural": "zadnjih {{count}} dana",
"stats_disabled": "Statistika je onemogućena. Možete ga uključiti sa <0>stranice s postavkama</0>.",
"stats_disabled_short": "Statistika je onemogućena",
"no_domains_found": "Nije pronađena domena",
"requests_count": "Broj zahtjeva",
"top_blocked_domains": "Top blokirane domene",
@@ -118,11 +133,11 @@
"block_domain_use_filters_and_hosts": "Blokiraj domene koristeći filtre ili hosts datoteke",
"filters_block_toggle_hint": "Pravila blokiranja možete postaviti u postavkama <a>filtara</a>.",
"use_adguard_browsing_sec": "Koristi AdGuard uslugu zaštite pregledavanja",
"use_adguard_browsing_sec_hint": "AdGuard Home će provjeriti nalazi li se domena na popisu nedopuštenih domena od usluge zaštite pregledavanja. Za provjeru će se koristiti API za provjeru koji poštuje vašu privatnost. Samo mali dio SHA256 hash-a od naziva domene se šalje poslužitelju.",
"use_adguard_browsing_sec_hint": "AdGuard Home provjerit će je li domena blokirana sigurnosnim web servisom za pregledavanje. Za izvođenje provjere koristit će API za pretraživanje prilagođen privatnosti: poslužitelju se šalje samo kratki prefiks naziva domene SHA256 hash.",
"use_adguard_parental": "Koristi web uslugu AdGuard roditeljske zaštite",
"use_adguard_parental_hint": "AdGuard Home provjeriti će sadrži li domena sadržaj za odrasle. Koristi isti API za zaštitu privatnosti kao i naša usluga zaštite pregledavanja.",
"enforce_safe_search": "Omogući sigurno pretraživanje",
"enforce_save_search_hint": "AdGuard Home može nametnuti sigurno pretraživanje na sljedećim tražilicama: Google, Youtube, Bing, DuckDuckGo, Yandex i Pixabay.",
"enforce_safe_search": "Koristi sigurno pretraživanje",
"enforce_save_search_hint": "AdGuard Home provodit će sigurno pretraživanje u sljedećim tražilicama: Google, YouTube, Bing, DuckDuckGo, Yandex, Pixabay.",
"no_servers_specified": "Nije odabran nijedan poslužitelj",
"general_settings": "Opće postavke",
"dns_settings": "DNS postavke",
@@ -261,8 +276,8 @@
"plain_dns": "Obični DNS",
"form_enter_rate_limit": "Unesite ograničenje",
"rate_limit": "Ograničenje",
"edns_enable": "Omogući EDNS Client Subnet",
"edns_cs_desc": "Ako je omogućeno, AdGuard Home će slati podmreže klijenata na DNS poslužitelje.",
"edns_enable": "Omogući podmrežu klijenta EDNS-a",
"edns_cs_desc": "Pošaljite podmreže klijenata DNS poslužiteljima.",
"rate_limit_desc": "Broj zahtjeva u sekundi koji su dopušteni po jednom klijentu. Postavljanje na 0 znači neograničeno.",
"blocking_ipv4_desc": "Povratna IP adresa za blokirane A zahtjeve",
"blocking_ipv6_desc": "Povratna IP adresa za blokirane AAAA zahtjeve",
@@ -301,9 +316,9 @@
"install_devices_title": "Postavite vaše uređaje",
"install_devices_desc": "Da biste započeli koristiti AdGuard Home, morate postaviti uređaje da ga koriste.",
"install_submit_title": "Čestitamo!",
"install_submit_desc": "Postavljanje je dovršeno i spremni ste koristiti AdGuard Home.",
"install_submit_desc": "Postupak postavljanja je dovršen i sada ste spremni početi koristiti AdGuard Home.",
"install_devices_router": "Usmjerivač (Router)",
"install_devices_router_desc": "Ovo postavljanje će automatski pokriti sve uređaje povezane na vaš kućni router i nećete trebati ručno postavljati svaki od njih.",
"install_devices_router_desc": "Ova postavka automatski pokriva sve uređaje povezane s kućnim usmjerivačem, nema potrebe za ručnom konfiguracijom svakog od njih.",
"install_devices_address": "AdGuard Home DNS poslužitelj osluškuje sljedeće adrese",
"install_devices_router_list_1": "Otvorite postavke za router. Obično mu možete pristupiti iz preglednika putem URL-a, kao što je http://192.168.0.1/ ili http://192.168.1.1/. Od vas će se možda tražiti da unesete lozinku. Ako je se ne sjećate, lozinku možete često poništiti pritiskom na dumge na samom routeru. Neki routeri trebaju određenu aplikaciju, koja bi u tom slučaju trebala biti već instalirana na vašem računalu/telefonu.",
"install_devices_router_list_2": "Pronađite DHCP/DNS postavke. Potražite DNS slova pored polja koje dopušta dva ili tri skupa brojeva, svaki razdvojen u četiri skupine od jedne do tri znamenke.",
@@ -311,10 +326,10 @@
"install_devices_router_list_4": "Na nekim se vrstama usmjerivača ne može postaviti prilagođeni DNS poslužitelj. U ovom slučaju, može vam pomoći ako postavite AdGuard Home kao <0>DHCP poslužitelj</0>. U suprotnom, trebali biste potražiti priručnik o tome kako prilagoditi DNS poslužitelje za vaš određeni model routera.",
"install_devices_windows_list_1": "Otvorite Upravljačku ploču putem Start izbornika ili Windows pretrage.",
"install_devices_windows_list_2": "Idite na kategoriju Mreža i Internet i odaberite Centar za mreže i zajedničko korištenje.",
"install_devices_windows_list_3": "Na lijevoj strani zaslona pronađite Promjeni postavke adaptera i pritisnite na to.",
"install_devices_windows_list_3": "Na lijevoj strani zaslona pronađite \"Promjena postavki prilagodnika\" i kliknite na nju.",
"install_devices_windows_list_4": "Odaberite aktivnu vezu, pritisnite desni klik na nju i odaberite Svojstva.",
"install_devices_windows_list_5": "Pronađite Internet Protocol Version 4 (TCP/IP) na listi, odaberite ga i zatim pritisnite opet Postavke.",
"install_devices_windows_list_6": "Odaberite Koristi sljedeće DNS adrese poslužitelja i unesite vaše adrese od AdGuard Home poslužitelja.",
"install_devices_windows_list_5": "Na popisu pronađite \"Internet Protocol Version 4 (TCP/IPv4)\" (ili, za IPv6, \"Internet Protocol Version 6 (TCP/IPv6)\"), odaberite ga i zatim ponovno kliknite svojstva.",
"install_devices_windows_list_6": "Odaberite \"Koristi sljedeće adrese DNS poslužitelja\" i unesite adrese AdGuard Home poslužitelja.",
"install_devices_macos_list_1": "Pritisnite na Apple ikonu i idite u Postavke sustava.",
"install_devices_macos_list_2": "Pritisnite na Mreža.",
"install_devices_macos_list_3": "Odaberite prvu vezu s vašeg popisa i pritisnite Napredno.",
@@ -323,7 +338,7 @@
"install_devices_android_list_2": "Pritisnite Wi-Fi u izborniku. Prikazat će se zaslon s popisom svih dostupnih mreža (nemoguće je postaviti prilagođeni DNS za mobilnu vezu).",
"install_devices_android_list_3": "Dugo pritisnite na mrežu na koju ste povezani i odaberite Uredi mrežu.",
"install_devices_android_list_4": "Na nekim će uređajima možda trebati označiti Napredno za prikaz dodatnih postavki. Da biste prilagodili postavke Android DNS-a, morati će te prebaciti IP postavke s DHCP-a na Statičke.",
"install_devices_android_list_5": "Promijenite DNS 1 i DNS 2 vrijednosti u one adrese AdGuard Home poslužitelja.",
"install_devices_android_list_5": "Promijenite vrijednosti DNS-a 1 i DNS-a 2 u adrese AdGuard Home poslužitelja.",
"install_devices_ios_list_1": "Na početnom zaslonu odaberite Postavke.",
"install_devices_ios_list_2": "Odaberite Wi-Fi u lijevom izborniku (ne moguće je postaviti DNS za mobilne mreže).",
"install_devices_ios_list_3": "Pritisnite na naziv vaše trenutne mreže.",
@@ -393,8 +408,9 @@
"client_edit": "Uredi klijenta",
"client_identifier": "Identifikator",
"ip_address": "IP adresa",
"client_identifier_desc": "Klijenti se mogu identificirati prema IP adresi, CIDR-u, MAC adresi ili posebnom ID-u klijenta (može se koristiti za DoT/DoH/DoQ). <0>Ovdje</0> možete saznati više o tome kako prepoznati klijente.",
"client_identifier_desc": "Klijenti se mogu identificirati putem IP adrese, CIDR-a, MAC adrese ili posebnog ID-a klijenta (može se koristiti za DoT/DoH/DoQ). <0>Ovdje</0> možete saznati više o tome kako prepoznati klijente.",
"form_enter_ip": "Unesite IP adresu",
"form_enter_subnet_ip": "Unesite IP adresu u podmrežu \"{{cidr}}\"",
"form_enter_mac": "Unesite MAC adresu",
"form_enter_id": "Unesi identifikator",
"form_add_id": "Dodaj identifikator",
@@ -412,11 +428,11 @@
"access_title": "Postavke pristupa",
"access_desc": "Postavite pravila pristupa za AdGuard Home DNS poslužitelj.",
"access_allowed_title": "Dopušteni klijenti",
"access_allowed_desc": "Popis CIDR-a ili IP adresa. Ukoliko je postavljeno, AdGuard Home će prihvatiti samo zahtjeve s ovih IP adresa.",
"access_allowed_desc": "Popis CIDR-ova, IP adresa ili ID-ova klijenata. Ako je konfiguriran, AdGuard Home prihvatit će zahtjeve samo tih klijenata.",
"access_disallowed_title": "Nedopušteni klijenti",
"access_disallowed_desc": "Popis CIDR-a ili IP adresa. Ukoliko je postavljeno, AdGuard Home će zaustaviti zahtjeve s ovih IP adresa.",
"access_disallowed_desc": "Popis CIDR-ova, IP adresa ili ID-ova klijenata. Ako je konfiguriran, AdGuard Home će odbaciti zahtjeve tih klijenata. Ako su konfigurirani dopušteni klijenti, ovo se polje zanemaruje.",
"access_blocked_title": "Nedopuštene domene",
"access_blocked_desc": "Ne miješajte ovo s filtrima. AdGuard Home će zaustaviti DNS upite s tim ovim domenama u podnesenim upitima. Ovdje možete definirati točne nazive domena, zamjenske znakove ili pravila URL filtriranja, npr. 'example.org', '*.example.org' or '||example.org^'.",
"access_blocked_desc": "Ne smije se miješati s filterima. AdGuard Home ispušta DNS upite koji odgovaraju tim domenama, a ti se upiti čak i ne pojavljuju u zapisniku upita. Možete navesti točne nazive domena, zamjenske znakove ili pravila filtriranja URL-a, npr || example.org example.org. example.org^\" u skladu s tim.",
"access_settings_saved": "Postavke pristupa su uspješno spremljene",
"updates_checked": "Uspješna provjera ažuriranja",
"updates_version_equal": "AdGuard Home je ažuriran",
@@ -470,6 +486,7 @@
"encryption_key_source_content": "Zalijepi sadržaj privatnog ključa",
"stats_params": "Postavke statistike",
"config_successfully_saved": "Postavke su uspješno spremljene",
"interval_6_hour": "6 sati",
"interval_24_hour": "24 sata",
"interval_days": "{{count}} dan",
"interval_days_plural": "{{count}} dana",
@@ -516,8 +533,8 @@
"rewrite_domain_name": "Naziv domene: Dodajte CNAME zapis",
"rewrite_A": "<0>A</0>: posebna vrijednost, ukloni <0>A</0> zapis od upstreama",
"rewrite_AAAA": "<0>AAAA</0>: posebna vrijednost, ukloni <0>AAAA</0> zapis od upstreama",
"disable_ipv6": "Onemogući IPv6",
"disable_ipv6_desc": "Ukoliko je ova značajka omogućena, svi DNS upiti za IPv6 adrese (AAAA tip) će biti odbačeni.",
"disable_ipv6": "Onemogući razrješavanje IPv6 adresa",
"disable_ipv6_desc": "Ispustite sve DNS upite za IPv6 adrese (upišite AAAA).",
"fastest_addr": "Najbrža IP adresa",
"fastest_addr_desc": "Ispitajte sve DNS poslužitelje i vratite najbržu IP adresu među svim odgovorima. To usporava DNS upite jer AdGuard Home mora čekati odgovore svih DNS poslužitelja, ali poboljšava ukupnu povezanost.",
"autofix_warning_text": "Ako pritisnete \"Popravi\", AdGuard Home će postaviti vaš sustav da koristi AdGuardHome DNS poslužitelj.",
@@ -554,7 +571,7 @@
"list_updated": "{{count}} popis ažuriran",
"list_updated_plural": "{{count}} popisa ažurirana",
"dnssec_enable": "Omogući DNSSEC",
"dnssec_enable_desc": "Omogućite DNSSEC u izlaznim DNS upitima i provjerite rezultat (potreban je resolver s omogućenim DNSSEC-om)",
"dnssec_enable_desc": "Postavite ZASTAVICU DNSSEC-a u ulaznim DNS upitima i provjerite rezultat (potreban je DNSSEC-omogućen razrješivač).",
"validated_with_dnssec": "Potvrđeno s DNSSEC-om",
"all_queries": "Svi upiti",
"show_blocked_responses": "Blokirano",
@@ -579,12 +596,14 @@
"cache_ttl_min_override_desc": "Povećajte kratke vrijednosti TTL-a (u sekundama) primljene od upstream poslužitelja prilikom predmemoriranja DNS odgovora",
"cache_ttl_max_override_desc": "Postavite maksimalnu vrijednost TTL-a (u sekundama) za zapise u DNS predmemoriju",
"ttl_cache_validation": "Minimalna vrijednost TTL predmemorije mora biti manja ili jednaka maksimalnoj vrijednosti",
"cache_optimistic": "optimistički",
"cache_optimistic_desc": "Učinite da AdGuard Home reagira iz predmemorije čak i kada su unosi istekli i pokušajte ih osvježiti.",
"filter_category_general": "Općenito",
"filter_category_security": "Sigurnost",
"filter_category_regional": "Regionalno",
"filter_category_other": "Ostalo",
"filter_category_general_desc": "Popisi koji blokiraju pratitelje i oglase na većini uređaja",
"filter_category_security_desc": "Popisi koju su specijalizirani za blokiranje zlonamjernih programa, krađe identiteta ili domena za obmanu",
"filter_category_security_desc": "Popisi posebno dizajnirani za blokiranje zlonamjernih domena, domena za krađu identiteta i prijevare",
"filter_category_regional_desc": "Popisi koji se fokusiraju na regionalne oglase i poslužitelje za praćenje",
"filter_category_other_desc": "Ostali popisi nedopuštenih",
"setup_config_to_enable_dhcp_server": "Postavite konfiguraciju za omogućavanje DHCP poslužitelja",

View File

@@ -326,10 +326,10 @@
"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.",
"install_devices_windows_list_1": "Apri il Pannello di controllo tramite il menu Start o la ricerca di Windows.",
"install_devices_windows_list_2": "Vai a Rete e categoria Internet e poi a Centro connessioni di rete e condivisione.",
"install_devices_windows_list_3": "Sul lato sinistro dello schermo, trova le impostazioni della scheda Cambia e fai clic su di esso.",
"install_devices_windows_list_3": "Sul lato sinistro dello schermo, trova \"Cambia impostazioni adattatore\" e clicca su di esso.",
"install_devices_windows_list_4": "Seleziona la tua connessione attiva, fai clic destro su di essa e scegli Proprietà.",
"install_devices_windows_list_5": "Trova Protocollo Internet versione 4 (TCP / IP) nell'elenco, selezionalo e quindi fai nuovamente clic su Proprietà.",
"install_devices_windows_list_6": "Scegli \"Utilizza i seguenti indirizzi del server DNS\" ed inserisci gli indirizzi del tuo server AdGuard Home.",
"install_devices_windows_list_5": "Trova \"Protocollo Internet versione 4 (TCP/IPv4)\" (o, per IPv6, \"Protocollo Internet versione 6 (TCP/IPv6)\" nella lista, selezionalo e quindi clicca nuovamente su Proprietà.",
"install_devices_windows_list_6": "Scegli \"Utilizza i seguenti indirizzi server DNS\" ed inserisci i tuoi indirizzi server AdGuard Home.",
"install_devices_macos_list_1": "Fai clic sull'icona Apple e vai su Preferenze di Sistema.",
"install_devices_macos_list_2": "Clicca sulla rete.",
"install_devices_macos_list_3": "Seleziona la prima connessione nel tuo elenco e fai clic su Avanzate.",

View File

@@ -326,10 +326,10 @@
"install_devices_router_list_4": "一部のルーターでは、カスタムDNSサーバーを設定できません。この場合、AdGuard Homeを<0>DHCPサーバ</0>として設定してみることがおすすめです。それ以外の場合は、特定のルータモデルにおいて、DNSサーバーをカスタマイズする方法に関するマニュアル等をご確認ください。",
"install_devices_windows_list_1": "「スタート」メニューまたはWindowsの検索から「設定」を開きます。",
"install_devices_windows_list_2": "「ネットワークとインターネット」カテゴリに移動し、さらに「ネットワークと共有センター」へ移動します。",
"install_devices_windows_list_3": "画面の左側にある「アダプターの設定変更」を見つけてクリックします。",
"install_devices_windows_list_3": "画面の左側にある「アダプターの設定変更」を見つけてクリックします。",
"install_devices_windows_list_4": "動作中の接続を選択して右クリックし、「プロパティ」を選択します。",
"install_devices_windows_list_5": "一覧から「インターネット プロトコル バージョン4TCP/IPv4」を見つけ、それを選択してから、もう一度プロパティをクリックします。",
"install_devices_windows_list_6": "「次のDNSサーバアドレスを使う」を選択して、AdGuard Homeサーバアドレスを入力します。",
"install_devices_windows_list_5": "一覧から「インターネット プロトコル バージョン4TCP/IPv4もしくはIPv6の場合「インターネット プロトコル バージョン6TCP/IPv6を見つけ、それを選択してから、もう一度プロパティをクリックします。",
"install_devices_windows_list_6": "「次のDNSサーバアドレスを使う」を選択して、お使いのAdGuard Homeサーバアドレスを入力します。",
"install_devices_macos_list_1": "Apple アイコンをクリックして「システム環境設定」へ行きます。",
"install_devices_macos_list_2": "「ネットワーク」をクリックします。",
"install_devices_macos_list_3": "一覧の最初の接続を選択して「詳細...」をクリックします。",

View File

@@ -324,12 +324,12 @@
"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": "화면 왼쪽에서 어댑터 설정 변경을 찾아 클릭하세요.",
"install_devices_windows_list_4": "활성 연결을 선택한 후 우클릭으로 속성을 선택하세요.",
"install_devices_windows_list_5": "목록에서 인터넷 프로토콜 버전 4 (TCP/IP) 를 찾아 선택하고 속성을 다시 클릭하세요.",
"install_devices_windows_list_6": "다음 DNS 서버 주소 사용을 선택하고 AdGuard Home 서버 주소 입력하세요.",
"install_devices_windows_list_1": "시작 메뉴 또는 윈도우 검색을 통해 제어판을 엽니다.",
"install_devices_windows_list_2": "네트워크 및 인터넷 카테고리로 이동한 다음 네트워크 및 공유 센터로 이동합니다.",
"install_devices_windows_list_3": "화면 왼쪽에서 '어댑터 설정 변경'을 찾아 클릭합니다.",
"install_devices_windows_list_4": "활성 연결을 선택한 후 우클릭으로 속성을 선택합니다.",
"install_devices_windows_list_5": "목록에서 '인터넷 프로토콜 버전 4(TCP/IP)' (또는 IPv6의 경우 '인터넷 프로토콜 버전 6(TCP/IPv6)')를 찾아 선택하고 속성을 클릭합니다.",
"install_devices_windows_list_6": "'DNS 서버 주소 사용'을 선택하고 AdGuard Home 서버 주소 입력합니다.",
"install_devices_macos_list_1": "Apple 아이콘을 클릭하고 시스템 기본 설정으로 이동하세요.",
"install_devices_macos_list_2": "네트워크를 클릭하세요.",
"install_devices_macos_list_3": "목록에서 첫 번째 연결을 선택하고 고급을 클릭해주세요.",

View File

@@ -326,10 +326,10 @@
"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.",
"install_devices_windows_list_1": "Open het Configuratiescherm via het menu Start of Windows zoeken.",
"install_devices_windows_list_2": "Ga naar de categorie Netwerk en Internet en vervolgens naar Netwerkcentrum.",
"install_devices_windows_list_3": "Zoek aan de linkerkant van het scherm Adapter-instellingen wijzigen en klik erop.",
"install_devices_windows_list_3": "Zoek aan de linkerkant van het scherm \"Adapter-instellingen wijzigen\" en klik erop.",
"install_devices_windows_list_4": "Selecteer jouw actieve verbinding, klik er met de rechtermuisknop op en kies Eigenschappen.",
"install_devices_windows_list_5": "Zoek Internet Protocol versie 4 (TCP / IP) in de lijst, selecteer het en klik vervolgens opnieuw op Eigenschappen.",
"install_devices_windows_list_6": "Kies Gebruik de volgende DNS-server adressen en voer jouw AdGuard Home server adressen in.",
"install_devices_windows_list_5": "Zoek \"Internet Protocol versie 4 (TCP/IPv4)\" (of, voor IPv6, \"Internet Protocol versie 6 (TCP/IPv6)\") in de lijst, selecteer het en klik vervolgens opnieuw op Eigenschappen.",
"install_devices_windows_list_6": "Kies \"Gebruik de volgende DNS-serveradressen\" en voer jouw AdGuard Home serveradressen in.",
"install_devices_macos_list_1": "Klik op het Apple-pictogram en ga naar Systeemvoorkeuren.",
"install_devices_macos_list_2": "Klik op Netwerk.",
"install_devices_macos_list_3": "Selecteer de eerste verbinding in jouw lijst en klik op Geavanceerd.",

View File

@@ -233,6 +233,7 @@
"dns_over_tls": "DNS-over-TLS",
"dns_over_quic": "DNS-over-QUIC",
"client_id": "Klient-ID",
"client_id_placeholder": "Skriv inn klient-ID",
"download_mobileconfig_doh": "Last ned .mobileconfig for DNS-over-HTTPS",
"download_mobileconfig_dot": "Last ned .mobileconfig for DNS-over-TLS",
"plain_dns": "Ordinær DNS",

View File

@@ -326,10 +326,10 @@
"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.",
"install_devices_windows_list_1": "Otwórz panel Ustawienia w menu Start lub w Windows.",
"install_devices_windows_list_2": "Przejdź do kategorii Sieć i Internet, a następnie do Centrum sieci i udostępniania.",
"install_devices_windows_list_3": "Po lewej stronie ekranu znajdź Zmień ustawienia adaptera i kliknij na niego.",
"install_devices_windows_list_3": "Po lewej stronie ekranu znajdź \"Zmień ustawienia adaptera\" i kliknij na niego.",
"install_devices_windows_list_4": "Wybierz aktywne połączenie, kliknij je prawym przyciskiem myszy i wybierz Właściwości.",
"install_devices_windows_list_5": "Znajdź na liście protokół internetowy w wersji 4 (TCP/IP), zaznacz go, a następnie ponownie kliknij Właściwości.",
"install_devices_windows_list_6": "Wybierz Użyj następujących adresów serwerów DNS i wpisz adresy serwerów AdGuard Home.",
"install_devices_windows_list_5": "Znajdź na liście \"Protokół internetowy w wersji 4 (TCP/IPv4)\" (lub w przypadku IPv6 \"Protokół internetowy w wersji 6 (TCP/IPv6)\"), zaznacz go i ponownie kliknij na Właściwości.",
"install_devices_windows_list_6": "Wybierz opcję \"Użyj następujących adresów serwerów DNS\" i wprowadź adresy serwerów AdGuard Home.",
"install_devices_macos_list_1": "Kliknij ikonę Apple i przejdź do Preferencje systemowe.",
"install_devices_macos_list_2": "Kliknij Sieć.",
"install_devices_macos_list_3": "Wybierz pierwsze połączenie z listy i kliknij Zaawansowane.",

View File

@@ -326,10 +326,10 @@
"install_devices_router_list_4": "Em alguns tipos de roteador, um servidor DNS personalizado não pode ser configurado. Nesse caso, configurar o AdGuard Home como um <0>Servidor DHCP</0> pode ajudar. Caso contrário, você deve verificar o manual do roteador sobre como personalizar os servidores DNS em seu modelo de roteador específico.",
"install_devices_windows_list_1": "Abra o Painel de Controle pelo Menu Iniciar ou pela Pesquisa do Windows.",
"install_devices_windows_list_2": "Entre na categoria Rede e Internet e depois clique em Central de Rede e Compartilhamento.",
"install_devices_windows_list_3": "No lado esquerdo da janela clique em Alterar as configurações do adaptador.",
"install_devices_windows_list_3": "No lado esquerdo da janela clique em \"Alterar as configurações do adaptador\".",
"install_devices_windows_list_4": "Selecione sua atual conexão, clique nela com o botão direito do mouse e depois clique em Propriedades.",
"install_devices_windows_list_5": "Procure na lista por Internet Protocol Version 4 (TCP/IP), selecione e clique em Propriedades novamente.",
"install_devices_windows_list_6": "Marque usar os seguintes endereços de servidor DNS e digite os endereços do servidores do AdGuard Home.",
"install_devices_windows_list_5": "Procure na lista por \"Internet Protocol Version 4 (TCP/IP)\" (ou por IPv6, \"Internet Protocol Version 6 (TCP/IPv6)\"), selecione e clique em Propriedades novamente.",
"install_devices_windows_list_6": "Marque \"usar os seguintes endereços de servidor DNS\" e digite os endereços do servidores do AdGuard Home.",
"install_devices_macos_list_1": "Clique na ícone da Apple e depois em Preferências do Sistema.",
"install_devices_macos_list_2": "Clique em Rede.",
"install_devices_macos_list_3": "Selecione a primeira conexão da lista e clique em Avançado.",

View File

@@ -107,7 +107,7 @@
"dns_query": "Consultas de DNS",
"blocked_by": "<0>Bloqueado por filtros</0>",
"stats_malware_phishing": "Malware/phishing bloqueados",
"stats_adult": "Sites adultos bloqueados",
"stats_adult": "Sítios adultos bloqueados",
"stats_query_domain": "Principais domínios consultados",
"for_last_24_hours": "nas últimas 24 horas",
"for_last_days": "nos últimos {{count}} dias",
@@ -326,10 +326,10 @@
"install_devices_router_list_4": "Em alguns tipos de roteador, um servidor DNS personalizado não pode ser configurado. Nesse caso, configurar o AdGuard Home como um <0>Servidor DHCP</0> pode ajudar. Caso contrário, tu deve verificar o manual do router sobre como personalizar os servidores DNS em seu modelo de router específico.",
"install_devices_windows_list_1": "Abra o Painel de Controlo através do Menu Iniciar ou pela Pesquisa do Windows.",
"install_devices_windows_list_2": "Entre na categoria Rede e Internet e depois clique em Central de Rede e Partilha.",
"install_devices_windows_list_3": "No lado esquerdo da janela clique em Alterar as definições do adaptador.",
"install_devices_windows_list_3": "No lado esquerdo da janela clique em \"Alterar as definições do adaptador\".",
"install_devices_windows_list_4": "Selecione sua atual ligação, clique nela com o botão direito do rato e depois clique em Propriedades.",
"install_devices_windows_list_5": "Procure na lista por Internet Protocol Version 4 (TCP/IP), selecione e clique novamente em Propriedades.",
"install_devices_windows_list_6": "Marque Usar os seguintes endereços de servidor DNS e insira os endereços do servidores do AdGuard Home.",
"install_devices_windows_list_5": "Procure na lista por \"Internet Protocol Version 4 (TCP/IP)\" (ou por IPv6, \"Internet Protocol Version 6 (TCP/IPv6)\"), selecione e clique em Propriedades novamente.",
"install_devices_windows_list_6": "Marque \"Usar os seguintes endereços de servidor DNS\" e insira os endereços do servidores do AdGuard Home.",
"install_devices_macos_list_1": "Clique na ícone da Apple e depois em Preferências do Sistema.",
"install_devices_macos_list_2": "Clique em Rede.",
"install_devices_macos_list_3": "Selecione a primeira ligação da lista e clique em Avançado.",
@@ -472,7 +472,7 @@
"main_settings": "Definições principais",
"block_services": "Bloquear serviços específicos",
"blocked_services": "Serviços bloqueados",
"blocked_services_desc": "Permite o bloqueio rápido de sites e serviços populares.",
"blocked_services_desc": "Permite o bloqueio rápido de sítios e serviços populares.",
"blocked_services_saved": "Serviços bloqueados guardados com sucesso",
"blocked_services_global": "Usar serviços bloqueados globais",
"blocked_service": "Serviço bloqueado",

View File

@@ -253,8 +253,8 @@
"anonymize_client_ip": "Анонимизировать IP-адрес клиента",
"anonymize_client_ip_desc": "Не сохранять полный IP-адрес клиента в журналах и статистике",
"dns_config": "Настройки DNS-сервера",
"dns_cache_config": "Настройка кэша DNS",
"dns_cache_config_desc": "Здесь можно настроить кэш DNS",
"dns_cache_config": "Настройка кеша DNS",
"dns_cache_config_desc": "Здесь можно настроить кеш DNS",
"blocking_mode": "Режим блокировки",
"default": "Стандартный",
"nxdomain": "NXDOMAIN",
@@ -328,8 +328,8 @@
"install_devices_windows_list_2": "Перейдите в «Сеть и интернет», а затем в «Центр управления сетями и общим доступом»",
"install_devices_windows_list_3": "В левой стороне экрана найдите «Изменение параметров адаптера» и кликните по нему.",
"install_devices_windows_list_4": "Выделите ваше активное подключение, затем кликните по нему правой клавишей мыши и выберите «Свойства».",
"install_devices_windows_list_5": "Найдите в списке пункт «IP версии 4 (TCP/IP)», выделите его и затем снова нажмите «Свойства».",
"install_devices_windows_list_6": "Выберите «Использовать следующие адреса DNS-серверов» и введите адрес AdGuard Home.",
"install_devices_windows_list_5": "Найдите в списке пункт «IP версии 4 (TCP/IPv4)» (или «IP версии 6 (TCP/IPv6)» для IPv6), выделите его и затем снова нажмите «Свойства».",
"install_devices_windows_list_6": "Выберите «Использовать следующие адреса DNS-серверов» и введите адреса серверов AdGuard Home.",
"install_devices_macos_list_1": "Кликните по иконке Apple и перейдите в «Системные настройки».",
"install_devices_macos_list_2": "Кликните по иконке «Сеть».",
"install_devices_macos_list_3": "Выберите первое подключение в списке и нажмите кнопку «Дополнительно».",
@@ -596,9 +596,9 @@
"enter_cache_ttl_max_override": "Введите максимальный TTL (в секундах)",
"cache_ttl_min_override_desc": "Расширить короткие TTL-значения (в секундах), полученные с upstream-сервера при кешировании DNS-ответов",
"cache_ttl_max_override_desc": "Установить максимальное TTL-значение (в секундах) для записей в DNS-кэше",
"ttl_cache_validation": "Минимальное значение TTL кеша должно быть меньше или равно максимальному значению",
"ttl_cache_validation": "Минимальное значение TTL-кеша должно быть меньше или равно максимальному значению",
"cache_optimistic": "Оптимистичный",
"cache_optimistic_desc": "AdGuard Home будет отвечать из кэша, даже если ответы в нём неактуальны, и попытается обновить их.",
"cache_optimistic_desc": "AdGuard Home будет отвечать из кеша, даже если ответы в нём неактуальны, и попытается обновить их.",
"filter_category_general": "Общие",
"filter_category_security": "Безопасность",
"filter_category_regional": "Региональные",

View File

@@ -3,7 +3,7 @@
"example_upstream_comment": "ඔබට අදහසක් සඳහන් කළ හැකිය",
"parallel_requests": "සමාන්තර ඉල්ලීම්",
"load_balancing": "ධාරිතාව තුලනය",
"local_ptr_title": "පෞද්ගලික ව.නා.ප. සේවාදායකයන්",
"local_ptr_title": "පෞද්ගලික ප්‍රතිවර්ත ව.නා.ප. සේවාදායකයන්",
"local_ptr_placeholder": "පේළියකට එක් සේවාදායක ලිපිනය බැගින් යොදන්න",
"resolve_clients_title": "අනුග්‍රාහකවල අ.ජා. කෙ. ලිපින ප්‍රතිවර්ත විසඳීම සබල කරන්න",
"check_dhcp_servers": "ග.ධා.වි.කෙ. සේවාදායකයන් සඳහා පරීක්ෂා කරන්න",
@@ -102,8 +102,8 @@
"use_adguard_browsing_sec": "ඇඩ්ගාර්ඩ් පිරික්සුම් ආරක්ෂණ වියමන සේවාව භාවිතා කරන්න",
"use_adguard_parental": "ඇඩ්ගාර්ඩ් දෙමාපිය පාලන වියමන සේවාව භාවිතා කරන්න",
"use_adguard_parental_hint": "වසමේ වැඩිහිටියන්ට අදාල කරුණු අඩංගු දැයි ඇඩ්ගාර්ඩ් හෝම් විසින් පරීක්ෂා කරනු ඇත. එය පිරික්සුම් ආරක්ෂණ වියමන සේවාව මෙන් රහස්‍යතා හිතකාමී යෙ.ක්‍ර. අ.මු. (API) භාවිතා කරයි.",
"enforce_safe_search": "ආරක්ෂිත සෙවීම බලාත්මක කරන්න",
"enforce_save_search_hint": "ඇඩ්ගාර්ඩ් හෝම් හට පහත සෙවුම් යන්ත්‍ර තුළ ආරක්ෂිත සෙවීම බලාත්මක කළ හැකිය: ගූගල්, යූටියුබ්, බින්ග්, ඩක්ඩක්ගෝ, යාන්ඩෙක්ස් සහ පික්සාබේ.",
"enforce_safe_search": "ආරක්ෂිත සෙවීම භාවිතා කරන්න",
"enforce_save_search_hint": "ඇඩ්ගාර්ඩ් හෝම් පහත සෙවුම් යන්ත්‍ර තුළ ආරක්ෂිත සෙවීම බලාත්මක කරනු ඇත: ගූගල්, යූටියුබ්, බින්ග්, ඩක්ඩක්ගෝ, යාන්ඩෙක්ස් සහ පික්සාබේ.",
"no_servers_specified": "සේවාදායක කිසිවක් නිශ්චිතව දක්වා නැත",
"general_settings": "පොදු සැකසුම්",
"dns_settings": "ව.නා.ප. සැකසුම්",
@@ -267,9 +267,9 @@
"install_devices_title": "ඔබගේ උපාංග වින්‍යාසගත කරන්න",
"install_devices_desc": "ඇඩ්ගාර්ඩ් හෝම් භාවිතා කිරීම ආරම්භයට, ඔබගේ උපාංග එය පරිශ්‍රීලනයට වින්‍යාසගත කිරීම අවශ්‍ය වේ.",
"install_submit_title": "සුභ පැතුම්!",
"install_submit_desc": "පිහිටුවීමේ ක්‍රියා පටිපාටිය අවසන් වී ඇති අතර ඔබ ඇඩ්ගාර්ඩ් හෝම් භාවිතය ආරම්භ කිරීමට සූදානම්ය.",
"install_submit_desc": "පිහිටුවීමේ ක්‍රියා පටිපාටිය අවසන් වී ඇති අතර ඔබ දැන් ඇඩ්ගාර්ඩ් හෝම් භාවිතය ආරම්භ කිරීමට සූදානම්ය.",
"install_devices_router": "මාර්ගකාරකය",
"install_devices_router_desc": "මෙම පිහිටුම ඔබගේ නිවසේ මාර්ගකාරකයට සම්බන්ධ සියලුම උපාංග ස්වයංක්‍රීයව ආවරණය කරන අතර ඔබට ඒවා අතින් වින්‍යාසගත කිරීමට අවශ්‍ය නොවනු ඇත.",
"install_devices_router_desc": "මෙම පිහිටුම ඔබගේ නිවසේ මාර්ගකාරකයට සම්බන්ධ සියලුම උපාංග ස්වයංක්‍රීයව ආවරණය කරන අතර ඔබට ඒ සෑම එකක්ම අතින් වින්‍යාසගත කිරීමට අවශ්‍ය නොව.",
"install_devices_address": "ඇඩ්ගාර්ඩ් හෝම් ව.නා.ප. සේවාදායකය පහත ලිපිනයන්ට සවන් දෙමින් පවතී",
"install_devices_router_list_2": "ග.ධා.වි.කෙ. (DHCP)/ ව.නා.ප. (DNS) සැකසුම් සොයා ගන්න. ඉලක්කම් කට්ටල දෙකකට හෝ තුනකට ඉඩ දෙන ක්ෂේත්‍රයක් අසල ඇති ව.නා.ප. අක්ෂර සොයන්න, සෑම එකක්ම ඉලක්කම් එකේ සිට තුන දක්වා කාණ්ඩ හතරකට බෙදා ඇත.",
"install_devices_router_list_3": "ඔබගේ ඇඩ්ගාර්ඩ් හෝම් සේවාදායක ලිපින එහි ඇතුළත් කරන්න.",
@@ -420,6 +420,7 @@
"encryption_key_source_content": "පුද්ගලික යතු‌රෙහි අන්තර්ගත අලවන්න",
"stats_params": "සංඛ්‍යාලේඛන වින්‍යාසය",
"config_successfully_saved": "වින්‍යාසය සාර්ථකව සුරකින ලදි",
"interval_6_hour": "පැය 6",
"interval_24_hour": "පැය 24",
"interval_days": "{{count}} දිනය",
"interval_days_plural": "දින {{count}}",

View File

@@ -328,7 +328,7 @@
"install_devices_windows_list_2": "Pojdite v 'Omrežje' in 'Kategorija interneta' in nato v 'Omrežje' in 'Središče za skupno rabo'.",
"install_devices_windows_list_3": "Na levi strani zaslona poiščite 'Spremeni nastavitve kartice' in kliknite nanjo.",
"install_devices_windows_list_4": "Izberite aktivno povezavo, kliknite na njo z desno miškino tipko in izberite 'Lastnosti'.",
"install_devices_windows_list_5": "Na seznamu poiščite različico 4 (TCP/IP) internetnega protokola, jo izberite in znova kliknite na 'Lastnosti'.",
"install_devices_windows_list_5": "Na seznamu poiščite 'Internet protokol različica 4 (TCP/IPv4)' (ali, za IPv6, 'Internet protokol različica 6 (TCP/IPv6)'), jo izberite in nato še enkrat kliknite 'Lastnosti'.",
"install_devices_windows_list_6": "Izberite 'Uporabi naslednje naslove DNS strežnikov' in vnesite vaše naslove strežnika AdGuard Home.",
"install_devices_macos_list_1": "Kliknite ikono Apple in pojdite na 'Nastavitve sistema'.",
"install_devices_macos_list_2": "Kliknite na 'Omrežje'",

View File

@@ -326,10 +326,10 @@
"install_devices_router_list_4": "Bazı yönlendirici türlerinde özel bir DNS sunucusu ayarlanamaz. Bu durumda, AdGuard Home'u <0>DHCP sunucusu</0> olarak ayarlamak yardımcı olabilir. Aksi takdirde, yönlendirici modeliniz için DNS sunucularını nasıl ayarlayacağınız konusunda yönlendirici kılavuzuna bakmalısınız.",
"install_devices_windows_list_1": "Başlat menüsünden veya Windows araması aracılığıyla Denetim Masası'nıın.",
"install_devices_windows_list_2": "Ağ ve İnternet kategorisine girin ve ardından Ağ ve Paylaşım Merkezi'ne girin.",
"install_devices_windows_list_3": "Pencerenin sol tarafında bulunan \"Bağdaştırıcı ayarlarını değiştirin\" öğesine tıklayın.",
"install_devices_windows_list_3": "Ekranın sol tarafında bulunan \"Adaptör ayarlarını değiştir\" öğesini bulun ve tıklayın.",
"install_devices_windows_list_4": "Kullandığınız aktif bağlantının üzerine sağ tıklayın ve Özellikler öğesine tıklayın.",
"install_devices_windows_list_5": "Listeden, İnternet Protokolü Sürüm 4 (TCP/IPv4) seçeneğini seçin ve ardından tekrar Özellikler öğesine tıklayın.",
"install_devices_windows_list_6": "\"Aşağıdaki DNS sunucu adreslerini kullan\" seçeneğini seçin ve ardından AdGuard Home sunucunuzun adreslerini girin.",
"install_devices_windows_list_5": "Listede \"İnternet Protokolü Sürüm 4 (TCP/IPv4)\" (veya IPv6 için \"İnternet Protokolü Sürüm 6 (TCP/IPv6)\") öğesini bulun, seçin ve ardından tekrar Özellikler'e tıklayın.",
"install_devices_windows_list_6": "\"Aşağıdaki DNS sunucu adreslerini kullan\"ı seçin ve AdGuard Home sunucu adreslerinizi girin.",
"install_devices_macos_list_1": "Apple simgesinde bulunan Sistem Tercihleri'ne tıklayın.",
"install_devices_macos_list_2": "Ağ seçeneğine tıklayın.",
"install_devices_macos_list_3": "Listedeki ilk bağlantıyı seçin ve Gelişmiş öğesine tıklayın.",

View File

@@ -329,7 +329,7 @@
"install_devices_windows_list_3": "在窗口的左侧找到 ”更改适配器设置“ 并点击进入。",
"install_devices_windows_list_4": "选择您正在连接的网络设备,右击它并选择 ”属性“ 。",
"install_devices_windows_list_5": "在列表中找到 ”Internet 协议版本 4 (TCP/IPv4)“ ,选择并再次点击 ”属性“ 。",
"install_devices_windows_list_6": "选择使用下面的 DNS 服务器地址,并输入您的 AdGuard Home 服务器地址。",
"install_devices_windows_list_6": "选择使用下面的 DNS 服务器地址,并输入您的 AdGuard Home 服务器地址。",
"install_devices_macos_list_1": "点击苹果图标,进入 ”系统首选项“。",
"install_devices_macos_list_2": "点击 ”网络“ 。",
"install_devices_macos_list_3": "选择在列表中的第一个连接,并点击 ”高级“ 。",

View File

@@ -326,10 +326,10 @@
"install_devices_router_list_4": "於某些路由器機型上,自訂的 DNS 伺服器無法被設置。在這種情況下,設置 AdGuard Home 作為 <0>DHCP</0> 伺服器可能有所幫助。否則,您應查明有關如何對您的特定路由器型號自訂 DNS 伺服器之路由器用法說明。",
"install_devices_windows_list_1": "通過開始功能表或 Windows 搜尋,開啟控制台。",
"install_devices_windows_list_2": "去網路和網際網路類別,然後去網路和共用中心。",
"install_devices_windows_list_3": "於畫面之左側上找到變更介面卡設定並向它點擊。",
"install_devices_windows_list_3": "於畫面之左側上找到\"變更介面卡設定\"並向它點擊。",
"install_devices_windows_list_4": "選擇您現行的連線,向它點擊滑鼠右鍵,然後選擇內容。",
"install_devices_windows_list_5": "在清單中找到網際網路通訊協定第 4 版TCP/IPv4選擇它然後再次向內容點擊。",
"install_devices_windows_list_6": "選擇使用下列的 DNS 伺服器位址,然後輸入您的 AdGuard Home 伺服器位址。",
"install_devices_windows_list_5": "在清單中找到\"網際網路通訊協定第 4 版TCP/IPv4\"[或用於 IPv6\"網際網路通訊協定第 6 版TCP/IPv6\"],選擇它,然後再次向內容點擊。",
"install_devices_windows_list_6": "選擇\"使用下列的 DNS 伺服器位址\",然後輸入您的 AdGuard Home 伺服器位址。",
"install_devices_macos_list_1": "向 Apple 圖像點擊,然後去系統偏好設定。",
"install_devices_macos_list_2": "向網路點擊。",
"install_devices_macos_list_3": "選擇在您的清單中之首要的連線,然後點擊進階的。",
@@ -604,7 +604,7 @@
"filter_category_regional": "區域性的",
"filter_category_other": "其它的",
"filter_category_general_desc": "封鎖大多數朝向裝置的追蹤和廣告之清單",
"filter_category_security_desc": "特別地封鎖惡意、網路釣魚和詐騙的網域之清單",
"filter_category_security_desc": "專門地封鎖惡意、網路釣魚和詐騙的網域之清單",
"filter_category_regional_desc": "專注於區域性的廣告和追蹤伺服器之清單",
"filter_category_other_desc": "其它的封鎖清單",
"setup_config_to_enable_dhcp_server": "設置配置以啟用 DHCP 伺服器",

8
go.mod
View File

@@ -3,15 +3,15 @@ module github.com/AdguardTeam/AdGuardHome
go 1.16
require (
github.com/AdguardTeam/dnsproxy v0.38.3
github.com/AdguardTeam/golibs v0.8.0
github.com/AdguardTeam/dnsproxy v0.39.2
github.com/AdguardTeam/golibs v0.8.4
github.com/AdguardTeam/urlfilter v0.14.6
github.com/NYTimes/gziphandler v1.1.1
github.com/ameshkov/dnscrypt/v2 v2.1.3
github.com/ameshkov/dnscrypt/v2 v2.2.1
github.com/digineo/go-ipset/v2 v2.2.1
github.com/fsnotify/fsnotify v1.4.9
github.com/go-ping/ping v0.0.0-20210506233800-ff8be3320020
github.com/google/go-cmp v0.5.5 // indirect
github.com/google/go-cmp v0.5.5
github.com/google/renameio v1.0.1
github.com/insomniacslk/dhcp v0.0.0-20210310193751-cfd4d47082c2
github.com/kardianos/service v1.2.0

10
go.sum
View File

@@ -9,12 +9,13 @@ dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D
git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg=
github.com/AdguardTeam/dhcp v0.0.0-20210519141215-51808c73c0bf h1:gc042VRSIRSUzZ+Px6xQCRWNJZTaPkomisDfUZmoFNk=
github.com/AdguardTeam/dhcp v0.0.0-20210519141215-51808c73c0bf/go.mod h1:TKl4jN3Voofo4UJIicyNhWGp/nlQqQkFxmwIFTvBkKI=
github.com/AdguardTeam/dnsproxy v0.38.3 h1:DvycTEOn2wuHmY+HE5XL4EnCV2EVbpREpbgZB06IJ0I=
github.com/AdguardTeam/dnsproxy v0.38.3/go.mod h1:aNXKNdTyKfgAG2OS712SYSaGIM9AasZsZxfiY4YiR/0=
github.com/AdguardTeam/dnsproxy v0.39.2 h1:GqsR1S4fFfVsVCSrdrfa0RfsQ2u+MeNUMqDkxdTD3gU=
github.com/AdguardTeam/dnsproxy v0.39.2/go.mod h1:aNXKNdTyKfgAG2OS712SYSaGIM9AasZsZxfiY4YiR/0=
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.8.0 h1:rHo+yIgT2fivFG0yW2Cwk/DPc2+t/Aw6QvzPpiIFre0=
github.com/AdguardTeam/golibs v0.8.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
github.com/AdguardTeam/golibs v0.8.4 h1:jd6GwvQQtfSLOKn30qisDVujvas3q7Agjm3BOEqRWpQ=
github.com/AdguardTeam/golibs v0.8.4/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
github.com/AdguardTeam/gomitmproxy v0.2.0/go.mod h1:Qdv0Mktnzer5zpdpi5rAwixNJzW2FN91LjKJCkVbYGU=
github.com/AdguardTeam/urlfilter v0.14.6 h1:emqoKZElooHACYehRBYENeKVN1a/rspxiqTIMYLuoIo=
github.com/AdguardTeam/urlfilter v0.14.6/go.mod h1:klx4JbOfc4EaNb5lWLqOwfg+pVcyRukmoJRvO55lL5U=
@@ -28,8 +29,9 @@ github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da h1:KjTM2ks9d14ZYCvmH
github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da/go.mod h1:eHEWzANqSiWQsof+nXEI9bUVUyV6F53Fp89EuCh2EAA=
github.com/aead/poly1305 v0.0.0-20180717145839-3fee0db0b635 h1:52m0LGchQBBVqJRyYYufQuIbVqRawmubW3OFGqK1ekw=
github.com/aead/poly1305 v0.0.0-20180717145839-3fee0db0b635/go.mod h1:lmLxL+FV291OopO93Bwf9fQLQeLyt33VJRUg5VJ30us=
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/dnscrypt/v2 v2.2.1 h1:+cApRxzeBZqjUNsN26TTz7r5A8U+buON3kJgIYE3QWQ=
github.com/ameshkov/dnscrypt/v2 v2.2.1/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=

View File

@@ -13,9 +13,9 @@ import (
"syscall"
"time"
"github.com/AdguardTeam/AdGuardHome/internal/aghstrings"
"github.com/AdguardTeam/golibs/errors"
"github.com/AdguardTeam/golibs/log"
"github.com/AdguardTeam/golibs/stringutil"
)
// ErrNoStaticIPInfo is returned by IfaceHasStaticIP when no information about
@@ -371,14 +371,14 @@ func ReverseAddr(ip net.IP) (arpa string) {
strLen, suffix = arpaV4MaxLen, arpaV4Suffix[1:]
ip = ip4
writeByte = func(val byte) {
aghstrings.WriteToBuilder(b, strconv.Itoa(int(val)), dot)
stringutil.WriteToBuilder(b, strconv.Itoa(int(val)), dot)
}
} else if ip6 := ip.To16(); ip6 != nil {
strLen, suffix = arpaV6MaxLen, arpaV6Suffix[1:]
ip = ip6
writeByte = func(val byte) {
aghstrings.WriteToBuilder(
stringutil.WriteToBuilder(
b,
strconv.FormatUint(uint64(val&0xF), 16),
dot,
@@ -395,7 +395,7 @@ func ReverseAddr(ip net.IP) (arpa string) {
for i := len(ip) - 1; i >= 0; i-- {
writeByte(ip[i])
}
aghstrings.WriteToBuilder(b, suffix)
stringutil.WriteToBuilder(b, suffix)
return b.String()
}

View File

@@ -0,0 +1,78 @@
//go:build freebsd
// +build freebsd
package aghnet
import (
"bufio"
"fmt"
"io"
"net"
"os"
"strings"
"github.com/AdguardTeam/AdGuardHome/internal/aghio"
"github.com/AdguardTeam/AdGuardHome/internal/aghos"
"github.com/AdguardTeam/golibs/errors"
)
func canBindPrivilegedPorts() (can bool, err error) {
return aghos.HaveAdminRights()
}
// maxCheckedFileSize is the maximum acceptable length of the /etc/rc.conf file.
const maxCheckedFileSize = 1024 * 1024
func ifaceHasStaticIP(ifaceName string) (ok bool, err error) {
const filename = "/etc/rc.conf"
var f *os.File
f, err = os.Open(filename)
if err != nil {
return false, err
}
defer func() { err = errors.WithDeferred(err, f.Close()) }()
var r io.Reader
r, err = aghio.LimitReader(f, maxCheckedFileSize)
if err != nil {
return false, err
}
return rcConfStaticConfig(r, ifaceName)
}
// rcConfStaticConfig checks if the interface is configured by /etc/rc.conf to
// have a static IP.
func rcConfStaticConfig(r io.Reader, ifaceName string) (has bool, err error) {
s := bufio.NewScanner(r)
for ifaceLinePref := fmt.Sprintf("ifconfig_%s", ifaceName); s.Scan(); {
line := strings.TrimSpace(s.Text())
if !strings.HasPrefix(line, ifaceLinePref) {
continue
}
eqIdx := len(ifaceLinePref)
if line[eqIdx] != '=' {
continue
}
fieldsStart, fieldsEnd := eqIdx+2, len(line)-1
if fieldsStart >= fieldsEnd {
continue
}
fields := strings.Fields(line[fieldsStart:fieldsEnd])
if len(fields) >= 2 &&
strings.ToLower(fields[0]) == "inet" &&
net.ParseIP(fields[1]) != nil {
return true, s.Err()
}
}
return false, s.Err()
}
func ifaceSetStaticIP(string) (err error) {
return aghos.Unsupported("setting static ip")
}

View File

@@ -0,0 +1,60 @@
//go:build freebsd
// +build freebsd
package aghnet
import (
"strings"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestRcConfStaticConfig(t *testing.T) {
const ifaceName = `em0`
const nl = "\n"
testCases := []struct {
name string
rcconfData string
wantHas bool
}{{
name: "simple",
rcconfData: `ifconfig_em0="inet 127.0.0.253 netmask 0xffffffff"` + nl,
wantHas: true,
}, {
name: "case_insensitiveness",
rcconfData: `ifconfig_em0="InEt 127.0.0.253 NeTmAsK 0xffffffff"` + nl,
wantHas: true,
}, {
name: "comments_and_trash",
rcconfData: `# comment 1` + nl +
`` + nl +
`# comment 2` + nl +
`ifconfig_em0="inet 127.0.0.253 netmask 0xffffffff"` + nl,
wantHas: true,
}, {
name: "aliases",
rcconfData: `ifconfig_em0_alias="inet 127.0.0.1/24"` + nl +
`ifconfig_em0="inet 127.0.0.253 netmask 0xffffffff"` + nl,
wantHas: true,
}, {
name: "incorrect_config",
rcconfData: `ifconfig_em0="inet6 127.0.0.253 netmask 0xffffffff"` + nl +
`ifconfig_em0="inet 127.0.0.253 net-mask 0xffffffff"` + nl +
`ifconfig_em0="inet 256.256.256.256 netmask 0xffffffff"` + nl +
`ifconfig_em0=""` + nl,
wantHas: false,
}}
for _, tc := range testCases {
r := strings.NewReader(tc.rcconfData)
t.Run(tc.name, func(t *testing.T) {
has, err := rcConfStaticConfig(r, ifaceName)
require.NoError(t, err)
assert.Equal(t, tc.wantHas, has)
})
}
}

View File

@@ -14,8 +14,8 @@ import (
"github.com/AdguardTeam/AdGuardHome/internal/aghio"
"github.com/AdguardTeam/AdGuardHome/internal/aghos"
"github.com/AdguardTeam/AdGuardHome/internal/aghstrings"
"github.com/AdguardTeam/golibs/errors"
"github.com/AdguardTeam/golibs/stringutil"
"github.com/google/renameio/maybe"
"golang.org/x/sys/unix"
)
@@ -70,7 +70,7 @@ func (rc *recurrentChecker) checkFile(sourcePath, desired string) (
}
// handlePatterns parses the patterns and takes care of duplicates.
func (rc *recurrentChecker) handlePatterns(sourcesSet *aghstrings.Set, patterns []string) (
func (rc *recurrentChecker) handlePatterns(sourcesSet *stringutil.Set, patterns []string) (
subsources []string,
err error,
) {
@@ -111,7 +111,7 @@ func (rc *recurrentChecker) check(desired string) (has bool, err error) {
var patterns, subsources []string
// The slice of sources is separate from the set of sources to keep the
// order in which the files are walked.
for sourcesSet := aghstrings.NewSet(rc.initPath); i < len(sources); i++ {
for sourcesSet := stringutil.NewSet(rc.initPath); i < len(sources); i++ {
patterns, has, err = rc.checkFile(sources[i], desired)
if err != nil {
if errors.Is(err, os.ErrNotExist) {
@@ -217,7 +217,7 @@ func ifacesStaticConfig(r io.Reader, ifaceName string) (subsources []string, has
s := bufio.NewScanner(r)
for s.Scan() {
line := strings.TrimSpace(s.Text())
if aghstrings.IsCommentOrEmpty(line) {
if len(line) == 0 || line[0] == '#' {
continue
}

View File

@@ -1,12 +1,9 @@
//go:build !(linux || darwin)
// +build !linux,!darwin
//go:build !(linux || darwin || freebsd)
// +build !linux,!darwin,!freebsd
package aghnet
import (
"fmt"
"runtime"
"github.com/AdguardTeam/AdGuardHome/internal/aghos"
)
@@ -14,10 +11,10 @@ func canBindPrivilegedPorts() (can bool, err error) {
return aghos.HaveAdminRights()
}
func ifaceHasStaticIP(string) (bool, error) {
return false, fmt.Errorf("cannot check if IP is static: not supported on %s", runtime.GOOS)
func ifaceHasStaticIP(string) (ok bool, err error) {
return false, aghos.Unsupported("checking static ip")
}
func ifaceSetStaticIP(string) error {
return fmt.Errorf("cannot set static IP on %s", runtime.GOOS)
func ifaceSetStaticIP(string) (err error) {
return aghos.Unsupported("setting static ip")
}

View File

@@ -11,8 +11,8 @@ import (
"sync"
"time"
"github.com/AdguardTeam/AdGuardHome/internal/aghstrings"
"github.com/AdguardTeam/golibs/errors"
"github.com/AdguardTeam/golibs/stringutil"
)
// defaultHostGen is the default method of generating host for Refresh.
@@ -27,7 +27,7 @@ type systemResolvers struct {
hostGenFunc HostGenFunc
// addrs is the set that contains cached local resolvers' addresses.
addrs *aghstrings.Set
addrs *stringutil.Set
addrsLock sync.RWMutex
}
@@ -64,7 +64,7 @@ func newSystemResolvers(refreshIvl time.Duration, hostGenFunc HostGenFunc) (sr S
PreferGo: true,
},
hostGenFunc: hostGenFunc,
addrs: aghstrings.NewSet(),
addrs: stringutil.NewSet(),
}
s.resolver.Dial = s.dialFunc

View File

@@ -1,71 +0,0 @@
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

@@ -1,56 +0,0 @@
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

@@ -1,103 +0,0 @@
// Package aghstrings contains utilities dealing with strings.
package aghstrings
import (
"strings"
)
// CloneSliceOrEmpty returns the copy of a or empty strings slice if a is nil.
func CloneSliceOrEmpty(a []string) (b []string) {
return append([]string{}, a...)
}
// CloneSlice returns the exact copy of a.
func CloneSlice(a []string) (b []string) {
if a == nil {
return nil
}
return CloneSliceOrEmpty(a)
}
// Coalesce returns the first non-empty string. It is named after the function
// COALESCE in SQL except that since strings in Go are non-nullable, it uses an
// empty string as a NULL value. If strs or all it's elements are empty, it
// returns an empty string.
func Coalesce(strs ...string) (res string) {
for _, s := range strs {
if s != "" {
return s
}
}
return ""
}
// FilterOut returns a copy of strs with all strings for which f returned true
// removed.
func FilterOut(strs []string, f func(s string) (ok bool)) (filtered []string) {
for _, s := range strs {
if !f(s) {
filtered = append(filtered, s)
}
}
return filtered
}
// InSlice checks if string is in the slice of strings.
func InSlice(strs []string, str string) (ok bool) {
for _, s := range strs {
if s == str {
return true
}
}
return false
}
// IsCommentOrEmpty returns true of the string starts with a "#" character or is
// an empty string.
func IsCommentOrEmpty(s string) (ok bool) {
return len(s) == 0 || s[0] == '#'
}
// SplitNext splits string by a byte and returns the first chunk skipping empty
// ones. Whitespaces are trimmed.
func SplitNext(s *string, sep rune) (chunk string) {
if s == nil {
return chunk
}
i := strings.IndexByte(*s, byte(sep))
if i == -1 {
chunk = *s
*s = ""
return strings.TrimSpace(chunk)
}
chunk = (*s)[:i]
*s = (*s)[i+1:]
var j int
var r rune
for j, r = range *s {
if r != sep {
break
}
}
*s = (*s)[j:]
return strings.TrimSpace(chunk)
}
// WriteToBuilder is a convenient wrapper for strings.(*Builder).WriteString
// that deals with multiple strings and ignores errors that are guaranteed to be
// nil.
func WriteToBuilder(b *strings.Builder, strs ...string) {
// TODO(e.burkov): Recover from panic?
for _, s := range strs {
_, _ = b.WriteString(s)
}
}

View File

@@ -1,137 +0,0 @@
package aghstrings
import (
"strings"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestCloneSlice_family(t *testing.T) {
a := []string{"1", "2", "3"}
t.Run("cloneslice_simple", func(t *testing.T) {
assert.Equal(t, a, CloneSlice(a))
})
t.Run("cloneslice_nil", func(t *testing.T) {
assert.Nil(t, CloneSlice(nil))
})
t.Run("cloneslice_empty", func(t *testing.T) {
assert.Equal(t, []string{}, CloneSlice([]string{}))
})
t.Run("clonesliceorempty_nil", func(t *testing.T) {
assert.Equal(t, []string{}, CloneSliceOrEmpty(nil))
})
t.Run("clonesliceorempty_empty", func(t *testing.T) {
assert.Equal(t, []string{}, CloneSliceOrEmpty([]string{}))
})
t.Run("clonesliceorempty_sameness", func(t *testing.T) {
assert.Equal(t, CloneSlice(a), CloneSliceOrEmpty(a))
})
}
func TestCoalesce(t *testing.T) {
assert.Equal(t, "", Coalesce())
assert.Equal(t, "a", Coalesce("a"))
assert.Equal(t, "a", Coalesce("", "a"))
assert.Equal(t, "a", Coalesce("a", ""))
assert.Equal(t, "a", Coalesce("a", "b"))
}
func TestFilterOut(t *testing.T) {
strs := []string{
"1.2.3.4",
"",
"# 5.6.7.8",
}
want := []string{
"1.2.3.4",
}
got := FilterOut(strs, IsCommentOrEmpty)
assert.Equal(t, want, got)
}
func TestInSlice(t *testing.T) {
simpleStrs := []string{"1", "2", "3"}
testCases := []struct {
name string
str string
strs []string
want bool
}{{
name: "yes",
str: "2",
strs: simpleStrs,
want: true,
}, {
name: "no",
str: "4",
strs: simpleStrs,
want: false,
}, {
name: "nil",
str: "any",
strs: nil,
want: false,
}}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
assert.Equal(t, tc.want, InSlice(tc.strs, tc.str))
})
}
}
func TestSplitNext(t *testing.T) {
t.Run("ordinary", func(t *testing.T) {
s := " a,b , c "
require.Equal(t, "a", SplitNext(&s, ','))
require.Equal(t, "b", SplitNext(&s, ','))
require.Equal(t, "c", SplitNext(&s, ','))
assert.Empty(t, s)
})
t.Run("nil_source", func(t *testing.T) {
assert.Equal(t, "", SplitNext(nil, 's'))
})
}
func TestWriteToBuilder(t *testing.T) {
b := &strings.Builder{}
t.Run("single", func(t *testing.T) {
assert.NotPanics(t, func() { WriteToBuilder(b, t.Name()) })
assert.Equal(t, t.Name(), b.String())
})
b.Reset()
t.Run("several", func(t *testing.T) {
const (
_1 = "one"
_2 = "two"
_123 = _1 + _2
)
assert.NotPanics(t, func() { WriteToBuilder(b, _1, _2) })
assert.Equal(t, _123, b.String())
})
b.Reset()
t.Run("nothing", func(t *testing.T) {
assert.NotPanics(t, func() { WriteToBuilder(b) })
assert.Equal(t, "", b.String())
})
t.Run("nil_builder", func(t *testing.T) {
assert.Panics(t, func() { WriteToBuilder(nil, "a") })
})
}

View File

@@ -412,7 +412,9 @@ func (s *Server) handleDHCPFindActiveServer(w http.ResponseWriter, r *http.Reque
result := dhcpSearchResult{
V4: dhcpSearchV4Result{
OtherServer: dhcpSearchOtherResult{},
StaticIP: dhcpStaticIPStatus{},
StaticIP: dhcpStaticIPStatus{
Static: "yes",
},
},
V6: dhcpSearchV6Result{
OtherServer: dhcpSearchOtherResult{},

View File

@@ -38,6 +38,9 @@ type V4ServerConf struct {
GatewayIP net.IP `yaml:"gateway_ip" json:"gateway_ip"`
SubnetMask net.IP `yaml:"subnet_mask" json:"subnet_mask"`
// broadcastIP is the broadcasting address pre-calculated from the
// configured gateway IP and subnet mask.
broadcastIP net.IP
// The first & the last IP address for dynamic leases
// Bytes [0..2] of the last allowed IP address must match the first IP

View File

@@ -12,9 +12,9 @@ import (
"time"
"github.com/AdguardTeam/AdGuardHome/internal/aghnet"
"github.com/AdguardTeam/AdGuardHome/internal/aghstrings"
"github.com/AdguardTeam/golibs/errors"
"github.com/AdguardTeam/golibs/log"
"github.com/AdguardTeam/golibs/stringutil"
"github.com/go-ping/ping"
"github.com/insomniacslk/dhcp/dhcpv4"
"github.com/insomniacslk/dhcp/dhcpv4/server4"
@@ -32,7 +32,7 @@ type v4Server struct {
leasedOffsets *bitSet
// leaseHosts is the set of all hostnames of all known DHCP clients.
leaseHosts *aghstrings.Set
leaseHosts *stringutil.Set
// leases contains all dynamic and static leases.
leases []*Lease
@@ -105,7 +105,7 @@ func (s *v4Server) ResetLeases(leases []*Lease) (err error) {
}
s.leasedOffsets = newBitSet()
s.leaseHosts = aghstrings.NewSet()
s.leaseHosts = stringutil.NewSet()
s.leases = nil
for _, l := range leases {
@@ -927,12 +927,30 @@ func (s *v4Server) packetHandler(conn net.PacketConn, peer net.Addr, req *dhcpv4
resp.Options.Update(dhcpv4.OptMessageType(dhcpv4.MessageTypeNak))
}
// peer is expected to be of type *net.UDPConn as the server4.NewServer
// initializes it.
udpPeer, ok := peer.(*net.UDPAddr)
if !ok {
log.Error("dhcpv4: peer is of unexpected type %T", peer)
return
}
// Despite the fact that server4.NewIPv4UDPConn explicitly sets socket
// options to allow broadcasting, it also binds the connection to a
// specific interface. On FreeBSD conn.WriteTo causes errors while
// writing to the addresses that belong to another interface. So, use
// the broadcast address specific for the binded interface in case
// server4.Server.Serve sets it to net.IPv4Bcast.
if udpPeer.IP.Equal(net.IPv4bcast) {
udpPeer.IP = s.conf.broadcastIP
}
log.Debug("dhcpv4: sending: %s", resp.Summary())
_, err = conn.WriteTo(resp.ToBytes(), peer)
if err != nil {
log.Error("dhcpv4: conn.Write to %s failed: %s", peer, err)
return
}
}
@@ -1017,7 +1035,7 @@ func (s *v4Server) Stop() (err error) {
func v4Create(conf V4ServerConf) (srv DHCPServer, err error) {
s := &v4Server{}
s.conf = conf
s.leaseHosts = aghstrings.NewSet()
s.leaseHosts = stringutil.NewSet()
// TODO(a.garipov): Don't use a disabled server in other places or just
// use an interface.
@@ -1043,6 +1061,12 @@ func v4Create(conf V4ServerConf) (srv DHCPServer, err error) {
Mask: subnetMask,
}
bcastIP := aghnet.CloneIP(routerIP)
for i, b := range subnetMask {
bcastIP[i] |= ^b
}
s.conf.broadcastIP = bcastIP
s.conf.ipRange, err = newIPRange(conf.RangeStart, conf.RangeEnd)
if err != nil {
return s, fmt.Errorf("dhcpv4: %w", err)

View File

@@ -8,8 +8,8 @@ import (
"strings"
"github.com/AdguardTeam/AdGuardHome/internal/aghnet"
"github.com/AdguardTeam/AdGuardHome/internal/aghstrings"
"github.com/AdguardTeam/golibs/log"
"github.com/AdguardTeam/golibs/stringutil"
"github.com/AdguardTeam/urlfilter"
"github.com/AdguardTeam/urlfilter/filterlist"
)
@@ -20,8 +20,8 @@ type accessCtx struct {
allowedIPs *aghnet.IPMap
blockedIPs *aghnet.IPMap
allowedClientIDs *aghstrings.Set
blockedClientIDs *aghstrings.Set
allowedClientIDs *stringutil.Set
blockedClientIDs *stringutil.Set
blockedHostsEng *urlfilter.DNSEngine
@@ -40,7 +40,7 @@ func processAccessClients(
clientStrs []string,
ips *aghnet.IPMap,
nets *[]*net.IPNet,
clientIDs *aghstrings.Set,
clientIDs *stringutil.Set,
) (err error) {
for i, s := range clientStrs {
if ip := net.ParseIP(s); ip != nil {
@@ -71,8 +71,8 @@ func newAccessCtx(allowed, blocked, blockedHosts []string) (a *accessCtx, err er
allowedIPs: aghnet.NewIPMap(0),
blockedIPs: aghnet.NewIPMap(0),
allowedClientIDs: aghstrings.NewSet(),
blockedClientIDs: aghstrings.NewSet(),
allowedClientIDs: stringutil.NewSet(),
blockedClientIDs: stringutil.NewSet(),
}
err = processAccessClients(allowed, a.allowedIPs, &a.allowedNets, a.allowedClientIDs)
@@ -87,7 +87,7 @@ func newAccessCtx(allowed, blocked, blockedHosts []string) (a *accessCtx, err er
b := &strings.Builder{}
for _, h := range blockedHosts {
aghstrings.WriteToBuilder(b, strings.ToLower(h), "\n")
stringutil.WriteToBuilder(b, strings.ToLower(h), "\n")
}
lists := []filterlist.RuleList{
@@ -174,9 +174,9 @@ func (s *Server) accessListJSON() (j accessListJSON) {
defer s.serverLock.RUnlock()
return accessListJSON{
AllowedClients: aghstrings.CloneSlice(s.conf.AllowedClients),
DisallowedClients: aghstrings.CloneSlice(s.conf.DisallowedClients),
BlockedHosts: aghstrings.CloneSlice(s.conf.BlockedHosts),
AllowedClients: stringutil.CloneSlice(s.conf.AllowedClients),
DisallowedClients: stringutil.CloneSlice(s.conf.DisallowedClients),
BlockedHosts: stringutil.CloneSlice(s.conf.BlockedHosts),
}
}

View File

@@ -12,12 +12,12 @@ import (
"time"
"github.com/AdguardTeam/AdGuardHome/internal/aghnet"
"github.com/AdguardTeam/AdGuardHome/internal/aghstrings"
"github.com/AdguardTeam/AdGuardHome/internal/filtering"
"github.com/AdguardTeam/dnsproxy/proxy"
"github.com/AdguardTeam/dnsproxy/upstream"
"github.com/AdguardTeam/golibs/errors"
"github.com/AdguardTeam/golibs/log"
"github.com/AdguardTeam/golibs/stringutil"
"github.com/ameshkov/dnscrypt/v2"
)
@@ -94,6 +94,11 @@ type FilteringConfig struct {
AllowedClients []string `yaml:"allowed_clients"` // IP addresses of whitelist clients
DisallowedClients []string `yaml:"disallowed_clients"` // IP addresses of clients that should be blocked
BlockedHosts []string `yaml:"blocked_hosts"` // hosts that should be blocked
// TrustedProxies is the list of IP addresses and CIDR networks to
// detect proxy servers addresses the DoH requests from which should be
// handled. The value of nil or an empty slice for this field makes
// Proxy not trust any address.
TrustedProxies []string `yaml:"trusted_proxies"`
// DNS cache settings
// --
@@ -210,6 +215,7 @@ func (s *Server) createProxyConfig() (proxy.Config, error) {
Ratelimit: int(s.conf.Ratelimit),
RatelimitWhitelist: s.conf.RatelimitWhitelist,
RefuseAny: s.conf.RefuseAny,
TrustedProxies: s.conf.TrustedProxies,
CacheMinTTL: s.conf.CacheMinTTL,
CacheMaxTTL: s.conf.CacheMaxTTL,
CacheOptimistic: s.conf.CacheOptimistic,
@@ -321,17 +327,15 @@ func (s *Server) prepareUpstreamSettings() error {
if err != nil {
return err
}
d := string(data)
for len(d) != 0 {
s := aghstrings.SplitNext(&d, '\n')
upstreams = append(upstreams, s)
}
upstreams = stringutil.SplitTrimmed(string(data), "\n")
log.Debug("dns: using %d upstream servers from file %s", len(upstreams), s.conf.UpstreamDNSFileName)
} else {
upstreams = s.conf.UpstreamDNS
}
upstreams = aghstrings.FilterOut(upstreams, aghstrings.IsCommentOrEmpty)
upstreams = stringutil.FilterOut(upstreams, IsCommentOrEmpty)
upstreamConfig, err := proxy.ParseUpstreamsConfig(
upstreams,
&upstream.Options{

View File

@@ -6,11 +6,11 @@ import (
"time"
"github.com/AdguardTeam/AdGuardHome/internal/aghnet"
"github.com/AdguardTeam/AdGuardHome/internal/aghstrings"
"github.com/AdguardTeam/AdGuardHome/internal/dhcpd"
"github.com/AdguardTeam/AdGuardHome/internal/filtering"
"github.com/AdguardTeam/dnsproxy/proxy"
"github.com/AdguardTeam/golibs/log"
"github.com/AdguardTeam/golibs/stringutil"
"github.com/miekg/dns"
)
@@ -518,7 +518,7 @@ func (s *Server) processUpstream(ctx *dnsContext) (rc resultCode) {
if d.Addr != nil && s.conf.GetCustomUpstreamByClient != nil {
// Use the clientID first, since it has a higher priority.
id := aghstrings.Coalesce(ctx.clientID, ipStringFromAddr(d.Addr))
id := stringutil.Coalesce(ctx.clientID, ipStringFromAddr(d.Addr))
upsConf, err := s.conf.GetCustomUpstreamByClient(id)
if err != nil {
log.Error("dns: getting custom upstreams for client %s: %s", id, err)

View File

@@ -11,7 +11,6 @@ import (
"time"
"github.com/AdguardTeam/AdGuardHome/internal/aghnet"
"github.com/AdguardTeam/AdGuardHome/internal/aghstrings"
"github.com/AdguardTeam/AdGuardHome/internal/dhcpd"
"github.com/AdguardTeam/AdGuardHome/internal/filtering"
"github.com/AdguardTeam/AdGuardHome/internal/querylog"
@@ -21,6 +20,7 @@ import (
"github.com/AdguardTeam/golibs/cache"
"github.com/AdguardTeam/golibs/errors"
"github.com/AdguardTeam/golibs/log"
"github.com/AdguardTeam/golibs/stringutil"
"github.com/miekg/dns"
)
@@ -222,12 +222,13 @@ func (s *Server) WriteDiskConfig(c *FilteringConfig) {
sc := s.conf.FilteringConfig
*c = sc
c.RatelimitWhitelist = aghstrings.CloneSlice(sc.RatelimitWhitelist)
c.BootstrapDNS = aghstrings.CloneSlice(sc.BootstrapDNS)
c.AllowedClients = aghstrings.CloneSlice(sc.AllowedClients)
c.DisallowedClients = aghstrings.CloneSlice(sc.DisallowedClients)
c.BlockedHosts = aghstrings.CloneSlice(sc.BlockedHosts)
c.UpstreamDNS = aghstrings.CloneSlice(sc.UpstreamDNS)
c.RatelimitWhitelist = stringutil.CloneSlice(sc.RatelimitWhitelist)
c.BootstrapDNS = stringutil.CloneSlice(sc.BootstrapDNS)
c.AllowedClients = stringutil.CloneSlice(sc.AllowedClients)
c.DisallowedClients = stringutil.CloneSlice(sc.DisallowedClients)
c.BlockedHosts = stringutil.CloneSlice(sc.BlockedHosts)
c.TrustedProxies = stringutil.CloneSlice(sc.TrustedProxies)
c.UpstreamDNS = stringutil.CloneSlice(sc.UpstreamDNS)
}
// RDNSSettings returns the copy of actual RDNS configuration.
@@ -235,7 +236,7 @@ func (s *Server) RDNSSettings() (localPTRResolvers []string, resolveClients, res
s.serverLock.RLock()
defer s.serverLock.RUnlock()
return aghstrings.CloneSlice(s.conf.LocalPTRResolvers),
return stringutil.CloneSlice(s.conf.LocalPTRResolvers),
s.conf.ResolveClients,
s.conf.UsePrivateRDNS
}
@@ -397,13 +398,13 @@ func (s *Server) filterOurDNSAddrs(addrs []string) (filtered []string, err error
return nil, err
}
ourAddrsSet := aghstrings.NewSet(ourAddrs...)
ourAddrsSet := stringutil.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.
return aghstrings.FilterOut(addrs, ourAddrsSet.Has), nil
return stringutil.FilterOut(addrs, ourAddrsSet.Has), nil
}
// setupResolvers initializes the resolvers for local addresses. For internal

View File

@@ -10,11 +10,11 @@ import (
"time"
"github.com/AdguardTeam/AdGuardHome/internal/aghnet"
"github.com/AdguardTeam/AdGuardHome/internal/aghstrings"
"github.com/AdguardTeam/dnsproxy/proxy"
"github.com/AdguardTeam/dnsproxy/upstream"
"github.com/AdguardTeam/golibs/errors"
"github.com/AdguardTeam/golibs/log"
"github.com/AdguardTeam/golibs/stringutil"
"github.com/miekg/dns"
)
@@ -51,9 +51,9 @@ func (s *Server) getDNSConfig() dnsConfig {
s.serverLock.RLock()
defer s.serverLock.RUnlock()
upstreams := aghstrings.CloneSliceOrEmpty(s.conf.UpstreamDNS)
upstreams := stringutil.CloneSliceOrEmpty(s.conf.UpstreamDNS)
upstreamFile := s.conf.UpstreamDNSFileName
bootstraps := aghstrings.CloneSliceOrEmpty(s.conf.BootstrapDNS)
bootstraps := stringutil.CloneSliceOrEmpty(s.conf.BootstrapDNS)
protectionEnabled := s.conf.ProtectionEnabled
blockingMode := s.conf.BlockingMode
blockingIPv4 := s.conf.BlockingIPv4
@@ -68,7 +68,7 @@ func (s *Server) getDNSConfig() dnsConfig {
cacheOptimistic := s.conf.CacheOptimistic
resolveClients := s.conf.ResolveClients
usePrivateRDNS := s.conf.UsePrivateRDNS
localPTRUpstreams := aghstrings.CloneSliceOrEmpty(s.conf.LocalPTRResolvers)
localPTRUpstreams := stringutil.CloneSliceOrEmpty(s.conf.LocalPTRResolvers)
var upstreamMode string
if s.conf.FastestAddr {
upstreamMode = "fastest_addr"
@@ -341,13 +341,20 @@ type upstreamJSON struct {
PrivateUpstreams []string `json:"private_upstream"`
}
// IsCommentOrEmpty returns true of the string starts with a "#" character or is
// an empty string. This function is useful for filtering out non-upstream
// lines from upstream configs.
func IsCommentOrEmpty(s string) (ok bool) {
return len(s) == 0 || s[0] == '#'
}
// ValidateUpstreams validates each upstream and returns an error if any
// upstream is invalid or if there are no default upstreams specified.
//
// TODO(e.burkov): Move into aghnet or even into dnsproxy.
func ValidateUpstreams(upstreams []string) (err error) {
// No need to validate comments
upstreams = aghstrings.FilterOut(upstreams, aghstrings.IsCommentOrEmpty)
upstreams = stringutil.FilterOut(upstreams, IsCommentOrEmpty)
// Consider this case valid because defaultDNS will be used
if len(upstreams) == 0 {
@@ -529,7 +536,7 @@ func checkPrivateUpstreamExc(u upstream.Upstream) (err error) {
}
func checkDNS(input string, bootstrap []string, timeout time.Duration, ef excFunc) (err error) {
if aghstrings.IsCommentOrEmpty(input) {
if IsCommentOrEmpty(input) {
return nil
}

View File

@@ -241,6 +241,12 @@ func TestDNSForwardHTTP_handleSetConfig(t *testing.T) {
}
}
func TestIsCommentOrEmpty(t *testing.T) {
assert.True(t, IsCommentOrEmpty(""))
assert.True(t, IsCommentOrEmpty("# comment"))
assert.False(t, IsCommentOrEmpty("1.2.3.4"))
}
// TODO(a.garipov): Rewrite to check the actual error messages.
func TestValidateUpstream(t *testing.T) {
testCases := []struct {

View File

@@ -14,10 +14,10 @@ import (
"sync/atomic"
"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"
"github.com/AdguardTeam/golibs/stringutil"
"github.com/AdguardTeam/urlfilter"
"github.com/AdguardTeam/urlfilter/filterlist"
"github.com/AdguardTeam/urlfilter/rules"
@@ -497,7 +497,7 @@ func (d *DNSFilter) processRewrites(host string, qtype uint16) (res Result) {
res.Reason = Rewritten
}
cnames := aghstrings.NewSet()
cnames := stringutil.NewSet()
origHost := host
for len(rr) != 0 && rr[0].Type == dns.TypeCNAME {
log.Debug("rewrite: CNAME for %s is %s", host, rr[0].Answer)

View File

@@ -13,10 +13,10 @@ import (
"strings"
"time"
"github.com/AdguardTeam/AdGuardHome/internal/aghstrings"
"github.com/AdguardTeam/dnsproxy/upstream"
"github.com/AdguardTeam/golibs/cache"
"github.com/AdguardTeam/golibs/log"
"github.com/AdguardTeam/golibs/stringutil"
"github.com/miekg/dns"
"golang.org/x/net/publicsuffix"
)
@@ -186,16 +186,16 @@ func (c *sbCtx) getQuestion() string {
for hash := range c.hashToHost {
// TODO(e.burkov, a.garipov): Find out and document why exactly
// this slice.
aghstrings.WriteToBuilder(b, hex.EncodeToString(hash[0:2]), ".")
stringutil.WriteToBuilder(b, hex.EncodeToString(hash[0:2]), ".")
}
if c.svc == "SafeBrowsing" {
aghstrings.WriteToBuilder(b, sbTXTSuffix)
stringutil.WriteToBuilder(b, sbTXTSuffix)
return b.String()
}
aghstrings.WriteToBuilder(b, pcTXTSuffix)
stringutil.WriteToBuilder(b, pcTXTSuffix)
return b.String()
}

View File

@@ -12,7 +12,6 @@ import (
"time"
"github.com/AdguardTeam/AdGuardHome/internal/aghnet"
"github.com/AdguardTeam/AdGuardHome/internal/aghstrings"
"github.com/AdguardTeam/AdGuardHome/internal/dhcpd"
"github.com/AdguardTeam/AdGuardHome/internal/dnsforward"
"github.com/AdguardTeam/AdGuardHome/internal/filtering"
@@ -21,6 +20,7 @@ import (
"github.com/AdguardTeam/dnsproxy/upstream"
"github.com/AdguardTeam/golibs/errors"
"github.com/AdguardTeam/golibs/log"
"github.com/AdguardTeam/golibs/stringutil"
)
const clientsUpdatePeriod = 10 * time.Minute
@@ -86,7 +86,7 @@ type clientsContainer struct {
lock sync.Mutex
allTags *aghstrings.Set
allTags *stringutil.Set
// dhcpServer is used for looking up clients IP addresses by MAC addresses
dhcpServer *dhcpd.Server
@@ -114,7 +114,7 @@ func (clients *clientsContainer) Init(
clients.idIndex = make(map[string]*Client)
clients.ipToRC = aghnet.NewIPMap(0)
clients.allTags = aghstrings.NewSet(clientTags...)
clients.allTags = stringutil.NewSet(clientTags...)
clients.dhcpServer = dhcpServer
clients.etcHosts = etcHosts
@@ -221,10 +221,10 @@ func (clients *clientsContainer) WriteDiskConfig(objects *[]clientObject) {
UseGlobalBlockedServices: !cli.UseOwnBlockedServices,
}
cy.Tags = aghstrings.CloneSlice(cli.Tags)
cy.IDs = aghstrings.CloneSlice(cli.IDs)
cy.BlockedServices = aghstrings.CloneSlice(cli.BlockedServices)
cy.Upstreams = aghstrings.CloneSlice(cli.Upstreams)
cy.Tags = stringutil.CloneSlice(cli.Tags)
cy.IDs = stringutil.CloneSlice(cli.IDs)
cy.BlockedServices = stringutil.CloneSlice(cli.BlockedServices)
cy.Upstreams = stringutil.CloneSlice(cli.Upstreams)
*objects = append(*objects, cy)
}
@@ -328,10 +328,10 @@ func (clients *clientsContainer) Find(id string) (c *Client, ok bool) {
return nil, false
}
c.IDs = aghstrings.CloneSlice(c.IDs)
c.Tags = aghstrings.CloneSlice(c.Tags)
c.BlockedServices = aghstrings.CloneSlice(c.BlockedServices)
c.Upstreams = aghstrings.CloneSlice(c.Upstreams)
c.IDs = stringutil.CloneSlice(c.IDs)
c.Tags = stringutil.CloneSlice(c.Tags)
c.BlockedServices = stringutil.CloneSlice(c.BlockedServices)
c.Upstreams = stringutil.CloneSlice(c.Upstreams)
return c, true
}
@@ -349,7 +349,7 @@ func (clients *clientsContainer) findUpstreams(
return nil, nil
}
upstreams := aghstrings.FilterOut(c.Upstreams, aghstrings.IsCommentOrEmpty)
upstreams := stringutil.FilterOut(c.Upstreams, dnsforward.IsCommentOrEmpty)
if len(upstreams) == 0 {
return nil, nil
}

View File

@@ -179,6 +179,8 @@ var config = configuration{
RefuseAny: true,
AllServers: false,
TrustedProxies: []string{"127.0.0.0/8", "::1/128"},
// set default maximum concurrent queries to 300
// we introduced a default limit due to this:
// https://github.com/AdguardTeam/AdGuardHome/issues/2015#issuecomment-674041912

View File

@@ -6,12 +6,12 @@ import (
"net/http"
"strings"
"github.com/AdguardTeam/AdGuardHome/internal/aghstrings"
"github.com/AdguardTeam/golibs/log"
"github.com/AdguardTeam/golibs/stringutil"
)
// TODO(a.garipov): Get rid of a global variable?
var allowedLanguages = aghstrings.NewSet(
var allowedLanguages = stringutil.NewSet(
"be",
"bg",
"cs",

View File

@@ -9,12 +9,12 @@ import (
"time"
"github.com/AdguardTeam/AdGuardHome/internal/aghnet"
"github.com/AdguardTeam/AdGuardHome/internal/aghstrings"
"github.com/AdguardTeam/AdGuardHome/internal/aghtest"
"github.com/AdguardTeam/dnsproxy/upstream"
"github.com/AdguardTeam/golibs/cache"
"github.com/AdguardTeam/golibs/errors"
"github.com/AdguardTeam/golibs/log"
"github.com/AdguardTeam/golibs/stringutil"
"github.com/miekg/dns"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -86,7 +86,7 @@ func TestRDNS_Begin(t *testing.T) {
list: map[string]*Client{},
idIndex: tc.cliIDIndex,
ipToRC: aghnet.NewIPMap(0),
allTags: aghstrings.NewSet(),
allTags: stringutil.NewSet(),
},
}
ipCache.Clear()
@@ -206,7 +206,7 @@ func TestRDNS_WorkerLoop(t *testing.T) {
list: map[string]*Client{},
idIndex: map[string]*Client{},
ipToRC: aghnet.NewIPMap(0),
allTags: aghstrings.NewSet(),
allTags: stringutil.NewSet(),
}
ch := make(chan net.IP)
rdns := &RDNS{

View File

@@ -14,14 +14,15 @@ import (
"net/http"
"os"
"path/filepath"
"reflect"
"runtime"
"strings"
"sync"
"time"
"github.com/AdguardTeam/AdGuardHome/internal/dnsforward"
"github.com/AdguardTeam/golibs/errors"
"github.com/AdguardTeam/golibs/log"
"github.com/google/go-cmp/cmp"
"golang.org/x/sys/cpu"
)
@@ -30,9 +31,9 @@ var tlsWebHandlersRegistered = false
// TLSMod - TLS module object
type TLSMod struct {
certLastMod time.Time // last modification time of the certificate file
conf tlsConfigSettings
confLock sync.Mutex
status tlsConfigStatus
confLock sync.Mutex
conf tlsConfigSettings
}
// Create TLS module
@@ -209,8 +210,8 @@ type tlsConfigStatus struct {
// field ordering is important -- yaml fields will mirror ordering from here
type tlsConfig struct {
tlsConfigSettings `json:",inline"`
tlsConfigStatus `json:",inline"`
tlsConfigSettings `json:",inline"`
}
func (t *TLSMod) handleTLSStatus(w http.ResponseWriter, _ *http.Request) {
@@ -247,6 +248,41 @@ func (t *TLSMod) handleTLSValidate(w http.ResponseWriter, r *http.Request) {
marshalTLS(w, data)
}
func (t *TLSMod) setConfig(newConf tlsConfigSettings, status tlsConfigStatus) (restartHTTPS bool) {
t.confLock.Lock()
defer t.confLock.Unlock()
// Reset the DNSCrypt data before comparing, since we currently do not
// accept these from the frontend.
//
// TODO(a.garipov): Define a custom comparer for dnsforward.TLSConfig.
newConf.DNSCryptConfigFile = t.conf.DNSCryptConfigFile
newConf.PortDNSCrypt = t.conf.PortDNSCrypt
if !cmp.Equal(t.conf, newConf, cmp.AllowUnexported(dnsforward.TLSConfig{})) {
log.Info("tls config has changed, restarting https server")
restartHTTPS = true
} else {
log.Info("tls config has not changed")
}
// Note: don't do just `t.conf = data` because we must preserve all other members of t.conf
t.conf.Enabled = newConf.Enabled
t.conf.ServerName = newConf.ServerName
t.conf.ForceHTTPS = newConf.ForceHTTPS
t.conf.PortHTTPS = newConf.PortHTTPS
t.conf.PortDNSOverTLS = newConf.PortDNSOverTLS
t.conf.PortDNSOverQUIC = newConf.PortDNSOverQUIC
t.conf.CertificateChain = newConf.CertificateChain
t.conf.CertificatePath = newConf.CertificatePath
t.conf.CertificateChainData = newConf.CertificateChainData
t.conf.PrivateKey = newConf.PrivateKey
t.conf.PrivateKeyPath = newConf.PrivateKeyPath
t.conf.PrivateKeyData = newConf.PrivateKeyData
t.status = status
return restartHTTPS
}
func (t *TLSMod) handleTLSConfigure(w http.ResponseWriter, r *http.Request) {
data, err := unmarshalTLS(r)
if err != nil {
@@ -266,41 +302,28 @@ func (t *TLSMod) handleTLSConfigure(w http.ResponseWriter, r *http.Request) {
tlsConfigStatus: t.status,
}
marshalTLS(w, data2)
return
}
status = validateCertificates(string(data.CertificateChainData), string(data.PrivateKeyData), data.ServerName)
restartHTTPS := false
t.confLock.Lock()
if !reflect.DeepEqual(t.conf, data) {
log.Printf("tls config settings have changed, will restart HTTPS server")
restartHTTPS = true
}
// Note: don't do just `t.conf = data` because we must preserve all other members of t.conf
t.conf.Enabled = data.Enabled
t.conf.ServerName = data.ServerName
t.conf.ForceHTTPS = data.ForceHTTPS
t.conf.PortHTTPS = data.PortHTTPS
t.conf.PortDNSOverTLS = data.PortDNSOverTLS
t.conf.PortDNSOverQUIC = data.PortDNSOverQUIC
t.conf.CertificateChain = data.CertificateChain
t.conf.CertificatePath = data.CertificatePath
t.conf.CertificateChainData = data.CertificateChainData
t.conf.PrivateKey = data.PrivateKey
t.conf.PrivateKeyPath = data.PrivateKeyPath
t.conf.PrivateKeyData = data.PrivateKeyData
t.status = status
t.confLock.Unlock()
restartHTTPS := t.setConfig(data, status)
t.setCertFileTime()
onConfigModified()
err = reconfigureDNSServer()
if err != nil {
httpError(w, http.StatusInternalServerError, "%s", err)
return
}
data2 := tlsConfig{
tlsConfigSettings: data,
tlsConfigStatus: t.status,
}
marshalTLS(w, data2)
if f, ok := w.(http.Flusher); ok {
f.Flush()

View File

@@ -10,10 +10,10 @@ import (
"time"
"github.com/AdguardTeam/AdGuardHome/internal/aghio"
"github.com/AdguardTeam/AdGuardHome/internal/aghstrings"
"github.com/AdguardTeam/golibs/cache"
"github.com/AdguardTeam/golibs/errors"
"github.com/AdguardTeam/golibs/log"
"github.com/AdguardTeam/golibs/stringutil"
)
const (
@@ -107,7 +107,7 @@ func whoisParse(data string) (m strmap) {
v = trimValue(v)
case "descr", "netname":
k = "orgname"
v = aghstrings.Coalesce(orgname, v)
v = stringutil.Coalesce(orgname, v)
orgname = v
case "whois":
k = "whois"

View File

@@ -9,9 +9,9 @@ import (
"strings"
"time"
"github.com/AdguardTeam/AdGuardHome/internal/aghstrings"
"github.com/AdguardTeam/golibs/jsonutil"
"github.com/AdguardTeam/golibs/log"
"github.com/AdguardTeam/golibs/stringutil"
"golang.org/x/net/idna"
)
@@ -160,7 +160,7 @@ func (l *queryLog) parseSearchCriterion(q url.Values, name string, ct criterionT
asciiVal = ""
}
case ctFilteringStatus:
if !aghstrings.InSlice(filteringStatusValues, val) {
if !stringutil.InSlice(filteringStatusValues, val) {
return false, sc, fmt.Errorf("invalid value %s", val)
}
default:

View File

@@ -8,7 +8,7 @@ import (
"strconv"
"strings"
"github.com/AdguardTeam/AdGuardHome/internal/aghstrings"
"github.com/AdguardTeam/golibs/stringutil"
)
// Channel constants.
@@ -93,16 +93,16 @@ func fmtModule(m *debug.Module) (formatted string) {
b := &strings.Builder{}
aghstrings.WriteToBuilder(b, m.Path)
stringutil.WriteToBuilder(b, m.Path)
if ver := m.Version; ver != "" {
sep := modInfoAtSep
if ver == "(devel)" {
sep = modInfoDevSep
}
aghstrings.WriteToBuilder(b, sep, ver)
stringutil.WriteToBuilder(b, sep, ver)
}
if sum := m.Sum; sum != "" {
aghstrings.WriteToBuilder(b, modInfoSumLeft, sum, modInfoSumRight)
stringutil.WriteToBuilder(b, modInfoSumLeft, sum, modInfoSumRight)
}
return b.String()
@@ -142,7 +142,7 @@ const (
func Verbose() (v string) {
b := &strings.Builder{}
aghstrings.WriteToBuilder(
stringutil.WriteToBuilder(
b,
vFmtAGHHdr,
nl,
@@ -156,15 +156,15 @@ func Verbose() (v string) {
runtime.Version(),
)
if buildtime != "" {
aghstrings.WriteToBuilder(b, nl, vFmtTimeHdr, buildtime)
stringutil.WriteToBuilder(b, nl, vFmtTimeHdr, buildtime)
}
aghstrings.WriteToBuilder(b, nl, vFmtGOOSHdr, nl, vFmtGOARCHHdr)
stringutil.WriteToBuilder(b, nl, vFmtGOOSHdr, nl, vFmtGOARCHHdr)
if goarm != "" {
aghstrings.WriteToBuilder(b, nl, vFmtGOARMHdr, "v", goarm)
stringutil.WriteToBuilder(b, nl, vFmtGOARMHdr, "v", goarm)
} else if gomips != "" {
aghstrings.WriteToBuilder(b, nl, vFmtGOMIPSHdr, gomips)
stringutil.WriteToBuilder(b, nl, vFmtGOMIPSHdr, gomips)
}
aghstrings.WriteToBuilder(b, nl, vFmtRaceHdr, strconv.FormatBool(isRace))
stringutil.WriteToBuilder(b, nl, vFmtRaceHdr, strconv.FormatBool(isRace))
info, ok := debug.ReadBuildInfo()
if !ok {
@@ -175,10 +175,10 @@ func Verbose() (v string) {
return b.String()
}
aghstrings.WriteToBuilder(b, nl, vFmtDepsHdr)
stringutil.WriteToBuilder(b, nl, vFmtDepsHdr)
for _, dep := range info.Deps {
if depStr := fmtModule(dep); depStr != "" {
aghstrings.WriteToBuilder(b, nltb, depStr)
stringutil.WriteToBuilder(b, nltb, depStr)
}
}

View File

@@ -4,29 +4,32 @@ set -e -f -u
# Show all temporary todos to the programmer but don't fail the commit
# if there are any, because the commit could be in a temporary branch.
git grep -e 'TODO.*!!' -- ':!HACKING.md' ':!scripts/hooks/pre-commit' | cat || :
git grep -e 'TODO.*!!' -- ':!scripts/hooks/pre-commit' | cat || :
verbose="${VERBOSE:-0}"
readonly verbose
if [ "$( git diff --cached --name-only -- 'client/*.js' )" ]
then
make js-lint js-test
make VERBOSE="$verbose" js-lint js-test
fi
if [ "$( git diff --cached --name-only -- 'client2/*.js' 'client2/*.ts' 'client2/*.tsx' )" ]
then
make js-beta-lint js-beta-test
make VERBOSE="$verbose" js-beta-lint js-beta-test
fi
if [ "$( git diff --cached --name-only -- '*.go' '*.mod' '*.sh' 'Makefile' )" ]
then
make go-os-check go-lint go-test
make VERBOSE="$verbose" go-os-check go-lint go-test
fi
if [ "$( git diff --cached --name-only -- '*.md' '*.yaml' '*.yml' )" ]
then
make txt-lint
make VERBOSE="$verbose" txt-lint
fi
if [ "$( git diff --cached --name-only -- './openapi/openapi.yaml' )" ]
then
make openapi-lint
make VERBOSE="$verbose" openapi-lint
fi

View File

@@ -33,18 +33,21 @@ COPY --chown=nobody:nogroup\
RUN setcap 'cap_net_bind_service=+eip' /opt/adguardhome/AdGuardHome
# 53 : DNS
# 67, 68 : DHCP
# 80 : HTTP
# 443 : HTTPS, DNS-over-HTTPS, DNSCrypt
# 853 : DNS-over-TLS
# 3000 : HTTP alt
# 3001 : HTTP beta
# 5443 : DNSCrypt alt
# 6060 : HTTP pprof
# 8853 : DNS-over-QUIC
EXPOSE 53/tcp 53/udp 67/udp 68/udp 80/tcp 443/tcp 443/udp 853/tcp\
3000/tcp 3001/tcp 5443/tcp 5443/udp 6060/tcp 8853/udp
# 53 : TCP, UDP : DNS
# 67 : UDP : DHCP (server)
# 68 : UDP : DHCP (client)
# 80 : TCP : HTTP (main)
# 443 : TCP, UDP : HTTPS, DNS-over-HTTPS (incl. HTTP/3), DNSCrypt (main)
# 784 : UDP : DNS-over-QUIC (experimental)
# 853 : TCP, UDP : DNS-over-TLS, DNS-over-QUIC
# 3000 : TCP, UDP : HTTP(S) (alt, incl. HTTP/3)
# 3001 : TCP, UDP : HTTP(S) (beta, incl. HTTP/3)
# 5443 : TCP, UDP : DNSCrypt (alt)
# 6060 : TCP : HTTP (pprof)
# 8853 : UDP : DNS-over-QUIC (experimental)
EXPOSE 53/tcp 53/udp 67/udp 68/udp 80/tcp 443/tcp 443/udp 784/udp\
853/tcp 853/udp 3000/tcp 3000/udp 3001/tcp 3001/udp 5443/tcp\
5443/udp 6060/tcp 8853/udp
WORKDIR /opt/adguardhome/work

View File

@@ -73,11 +73,31 @@ esac
# Simple Analyzers
# blocklist_imports is a simple check against unwanted packages. Package
# io/ioutil is soft-deprecated. Packages errors and log are replaced by our own
# packages in the github.com/AdguardTeam/golibs module.
# blocklist_imports is a simple check against unwanted packages. The following
# packages are banned:
#
# * Package io/ioutil is soft-deprecated.
#
# * Packages errors and log are replaced by our own packages in the
# github.com/AdguardTeam/golibs module.
#
# * Package reflect is often an overkill, and for deep comparisons there are
# much better functions in module github.com/google/go-cmp. Which is
# already our indirect dependency and which may or may not enter the stdlib
# at some point.
#
# See https://github.com/golang/go/issues/45200.
#
# * Package unsafe is… unsafe.
#
blocklist_imports() {
git grep -F -e '"errors"' -e '"io/ioutil"' -e '"log"' -- '*.go' || exit 0;
git grep\
-e '[[:space:]]"errors"$'\
-e '[[:space:]]"io/ioutil"$'\
-e '[[:space:]]"log"$'\
-e '[[:space:]]"reflect"$'\
-e '[[:space:]]"unsafe"$'\
-- '*.go' || exit 0;
}
# method_const is a simple check against the usage of some raw strings and
@@ -181,8 +201,7 @@ gocyclo --over 17 ./internal/dhcpd/ ./internal/dnsforward/\
# Apply stricter standards to new or vetted code
gocyclo --over 10 ./internal/aghio/ ./internal/aghnet/ ./internal/aghos/\
./internal/aghstrings/ ./internal/aghtest/ ./internal/tools/\
./internal/version/ ./main.go
./internal/aghtest/ ./internal/tools/ ./internal/version/ ./main.go
gosec --quiet $go_files