boxo
boxo copied to clipboard
refactor(gateway): switch defaults to autoconf.FallbackDNSResolvers
This PR moves hardcoded DNS resolver defaults from gateway.NewDNSResolver to autoconf.FallbackDNSResolvers so we have them in one place, while preserving existing behavior for users.
Changes
- Move hardcoded DNS resolver defaults to
autoconf.FallbackDNSResolvers -
NewDNSResolver(nil)usesautoconf.FallbackDNSResolvers(preserves.ethresolution) -
NewDNSResolver(map[string]string{})explicitly uses system DNS only - Remove
autoconf.Client.ExpandDNSResolvers()method (no use case yet) - Update test to use
.fooinstead of.ethTLD - No network calls at gateway initialization (privacy-preserving)
Migration
No migration needed. For those wanting custom DNS configuration, existing code (Kubo, Rainbow) continues to work.
References
- CC #771
- Closes #772
Codecov Report
:x: Patch coverage is 66.66667% with 6 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 60.76%. Comparing base (4c0aa3a) to head (b3238d9).
| Files with missing lines | Patch % | Lines |
|---|---|---|
| gateway/dns.go | 66.66% | 4 Missing and 2 partials :warning: |
@@ Coverage Diff @@
## main #1044 +/- ##
==========================================
- Coverage 60.76% 60.76% -0.01%
==========================================
Files 268 268
Lines 33593 33595 +2
==========================================
- Hits 20414 20413 -1
+ Misses 11508 11507 -1
- Partials 1671 1675 +4
| Files with missing lines | Coverage Δ | |
|---|---|---|
| gateway/dns.go | 57.44% <66.66%> (-2.56%) |
:arrow_down: |
... and 13 files with indirect coverage changes
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.