* feat: Support zonefile configuration for custom dns mapping
* docs: Update configuration.md
* Rename var to ok
* Linter fixes
* Remove hashes in test describe description
* Implement PR comments; zoneFileMapping -> zone, initialize with proper sizes
* Remove custom CNAME parsing
* Utilize TTL defined in zone file
* Link to wikipedia's example file
* Test to confirm that a relative zone entry without an $ORIGIN returns an error
* Write a test covering the $INCLUDE directive
* Write a test confirming that a dns zone can result in more than 1 RR
* Linting
* fix: Use proper matchers in CustomDNS Zone tests; Update configuration.md description
* Pull in config directory to support relative $INCLUDE
* Added tests to ensure the ability to use both bare filenames as well as relative filenames when using the $INCLUDE directive
* Shorten test description (Linting error)
* Move Assignment of z.RRs to the end of the UnmarshallYAML function
* Moved tests for relative $INCLUDE zones to config_test. Added test case when config param passed to blocky is a directory
* Corrected test case to _actually_ test againt bare file names
- `CacheControl.FlushCaches`
- `Querier.Query`
- `Resolver.Resolve`
Besides all the API churn, this leads to `ParallelBestResolver`,
`StrictResolver` and `UpstreamResolver` simplification: timeouts only
need to be setup in one place, `UpstreamResolver`.
We also benefit from using HTTP request contexts, so if the client
closes the connection we stop processing on our side.
* refactor: make `config.Duration` a struct with `time.Duration` embed
Allows directly calling `time.Duration` methods.
* refactor(HostsFileResolver): don't copy individual config items
The idea is to make adding configuration options easier, and searching
for references straight forward.
* refactor: move config printing to struct and use a logger
Using a logger allows using multiple levels so the whole configuration
can be printed in trace/verbose mode, but only important parts are
shown by default.
* squash: rename `Cast` to `ToDuration`
* squash: revert `Duration` to a simple wrapper ("new type" pattern)
* squash: `Duration.IsZero` tests
* squash: refactor resolvers to rely on their config directly if possible
* squash: implement `IsEnabled` and `LogValues` for all resolvers
* refactor: use go-enum `--values` to simplify getting all log fields
* refactor: simplify `QType` unmarshaling
* squash: rename `ValueLogger` to `Configurable`
* squash: rename `UpstreamConfig` to `ParallelBestConfig`
* squash: rename `RewriteConfig` to `RewriterConfig`
* squash: config tests
* squash: resolver tests
* squash: add `ForEach` test and improve `Chain` ones
* squash: simplify implementing `config.Configurable`
* squash: minor changes for better coverage
* squash: more `UnmarshalYAML` -> `UnmarshalText`
* refactor: move `config.Upstream` into own file
* refactor: add `Resolver.Type` method
* squash: add `log` method to `typed` to use `Resolover.Type` as prefix
* squash: tweak startup config logging
* squash: add `LogResolverConfig` tests
* squash: make sure all options of type `Duration` use `%s`
This makes iterating with breaking refactors easier as you can also
break the mocks without breaking normal compilation.
Also unexport code only used in the resolver package.
Only `MockUDPUpstreamServer` is kept as non test and exported as it is
used by the server package.
This commit extracts rewriting logic from `ConditionalUpstreamResolver`
into the new `RewriterResolver`, and uses that to enable rewriting for
the `CustomDNSResolver`.
`RewriterResolver` wraps a resolver and applies the rewrite to the
request that is forwarded to the inner resolver.
It also introduces a new optional interface: `NamedResolver`.
This allows a `Resolver` to choose what its user friendly name is,
instead of always being its type name.