Race only happens in tests: the write removed here can happen at the
same time as `writeLog` is reading the struct field since cancelling
the context doesn't guarantee immediate shutdown.
We can just use the existing channel so the field becomes read-only,
avoiding the race.
Example CI failure:
https://github.com/0xERR0R/blocky/actions/runs/8632315589/job/23662702020
For local repro, adding a 2ms sleep to `writeLog`'s startup was enough
for me.
* 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
Inspired by https://en.wikipedia.org/wiki/Happy_Eyeballs this should
improve latency and fixes the long standing behavior where a single
resolve attempt could take 2x the timeout.
UpstreamResolver.Resolve can still take more than the configured timeout
so maybe that can be improved by splitting the retry algorithm into its
own resolver type.
Replaces `startVerifyUpstream` and behaves just like
`blocking.loading.strategy`.
We use the bootstrap resolver for any requests that arrive before the
upstreams are initialized.
* made Stop context aware
* added error check
* context aware OnRequest
* linter fix
* fixed some flakiness in tests
* made DoGetRequest context aware
* this doesn't belong there and produces flakyness
* RedisConfig -> Redis
* moved redis config to seperate file
* bugfix in config test during parallel processing
* implement config.Configurable in Redis config
* use Context in GetRedisCache
* use Context in New
* caching resolver test fix
* use Context in PublishEnabled
* use Context in getResponse
* remove ctx field
* bugfix in api interface test
* propperly close channels
* set ruler for go files from 80 to 111
* line break because function length is to long
* only execute redis.New if it is enabled in config
* stabilized flaky tests
* Update config/redis.go
Co-authored-by: ThinkChaos <ThinkChaos@users.noreply.github.com>
* Update config/redis_test.go
Co-authored-by: ThinkChaos <ThinkChaos@users.noreply.github.com>
* Update config/redis_test.go
Co-authored-by: ThinkChaos <ThinkChaos@users.noreply.github.com>
* Update config/redis_test.go
Co-authored-by: ThinkChaos <ThinkChaos@users.noreply.github.com>
* Update config/redis.go
Co-authored-by: ThinkChaos <ThinkChaos@users.noreply.github.com>
* Update config/redis_test.go
Co-authored-by: ThinkChaos <ThinkChaos@users.noreply.github.com>
* fix ruler
* redis test refactoring
* vscode setting cleanup
* removed else if chain
* Update redis_test.go
* context race fix
* test fail on missing seintinel servers
* cleanup context usage
* cleanup2
* context fixes
* added context util
* disabled nil context rule for tests
* copy paste error ctxSend -> CtxSend
* use util.CtxSend
* fixed comment
* fixed flaky test
* failsafe and tests
---------
Co-authored-by: ThinkChaos <ThinkChaos@users.noreply.github.com>
Move `startVerifyUpstream` to `upstreams.startVerify` so it's accessible
via `UpstreamGroup` and we don't need to pass `startVerify` to all
resolver constructors that call `NewUpstreamResolver`.
Also has the nice benefit of greatly reducing the usage of `GetConfig`.
- `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.
* added util for handling EDNS0 options
* disable caching if the request contains a netmask size greater than 1
* added config section for ECS handling and validation for it
*added ecs_resolver for enhancing and cleaning subnet and client IP information
* fix(tests): properly silence log output
Using `init` allows it to also work for benchmarks.
And `log.Silence` was sometimes getting overridden by `log.init`.
* squash: fix(server): don't setup the logger again