Repository navigation
fix: enhance DNS bootstrapping by utilizing IPs from DNS stamps - #1995
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1995 +/- ##
==========================================
+ Coverage 90.19% 90.23% +0.03%
==========================================
Files 94 94
Lines 6814 6820 +6
==========================================
+ Hits 6146 6154 +8
+ Misses 512 510 -2
Partials 156 156 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR enhances DNS bootstrapping by utilizing IP addresses embedded in DNS stamps, addressing issue #1979. When a DNS stamp contains an IP address in its ServerAddrStr field, blocky now uses that IP directly for connections without requiring bootstrap DNS resolution or falling back to the system resolver. This improves security by avoiding potential DNS leaks and ensures DNS stamps can function independently when they contain all necessary information.
Changes:
- Added IPs field to Upstream struct to store IP addresses from DNS stamp ServerAddrStr
- Modified bootstrap logic to check for and use IPs from DNS stamps before attempting DNS resolution
- Added comprehensive test coverage including unit tests and e2e tests for various DNS stamp scenarios
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| config/upstream.go | Added IPs field to Upstream struct, extracted IPs from DNS stamp ServerAddrStr during parsing, updated IsDefault() method, and applied parameter style improvements |
| config/upstream_test.go | Added comprehensive tests for DNS stamp IP preservation covering IPv4, IPv6, DoH with embedded IPs, and edge cases. Also updated IsDefault() tests |
| resolver/bootstrap.go | Enhanced UpstreamIPs() to check for IPs from DNS stamps before falling back to bootstrap resolution |
| resolver/bootstrap_test.go | Added unit tests verifying IPs from DNS stamps are used without triggering bootstrap resolution |
| e2e/bootstrap_test.go | Added end-to-end tests validating DNS stamp functionality with embedded IPs across multiple scenarios (IPv4, IPv6, multiple stamps) |
| e2e/helper.go | Added generatePlainDNSStamp() helper function to create DNS stamps for testing |
| resolver/caching_resolver.go | Removed extraneous blank line (whitespace cleanup) |
| server/server.go | Applied compact parameter declaration style for consistency |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This PR contains the following updates: | Package | Update | Change | |---|---|---| | [ghcr.io/0xerr0r/blocky](https://github.com/0xERR0R/blocky) | minor | `v0.29.0` → `v0.30.0` | --- ### Release Notes <details> <summary>0xERR0R/blocky (ghcr.io/0xerr0r/blocky)</summary> ### [`v0.30.0`](https://github.com/0xERR0R/blocky/releases/tag/v0.30.0) [Compare Source](0xERR0R/blocky@v0.29.0...v0.30.0) #### Changelog ##### Features - [`0de3fac`](0xERR0R/blocky@0de3fac): feat(sudn): handle resolver.arpa zone per RFC 9462 (DDR) ([#​2059](0xERR0R/blocky#2059)) ([@​0xERR0R](https://github.com/0xERR0R)) - [`c32863d`](0xERR0R/blocky@c32863d): feat: add DNS-over-QUIC (DoQ) upstream support (RFC 9250) ([#​2013](0xERR0R/blocky#2013)) ([@​elsbrock](https://github.com/elsbrock)) - [`22b0bdd`](0xERR0R/blocky@22b0bdd): feat: add schedule-based blocking for deny/allowlist groups ([#​2037](0xERR0R/blocky#2037)) ([@​alessandrocuzzocrea](https://github.com/alessandrocuzzocrea)) - [`842dda9`](0xERR0R/blocky@842dda9): feat: serve DoH over HTTP/3 (DoH3, RFC 9114) ([#​2060](0xERR0R/blocky#2060)) ([@​0xERR0R](https://github.com/0xERR0R)) - [`c95cfba`](0xERR0R/blocky@c95cfba): feat: validate allow/denylist references in ClientGroupsBlock ([#​2016](0xERR0R/blocky#2016)) ([@​JenswBE](https://github.com/JenswBE)) ##### Bug fixes - [`10d6446`](0xERR0R/blocky@10d6446): fix(api): keep /api/query response unobfuscated when log.privacy is on ([#​2058](0xERR0R/blocky#2058)) ([@​0xERR0R](https://github.com/0xERR0R)) - [`fb28513`](0xERR0R/blocky@fb28513): fix: enhance DNS bootstrapping by utilizing IPs from DNS stamps ([#​1995](0xERR0R/blocky#1995)) ([@​0xERR0R](https://github.com/0xERR0R)) - [`2ffe18a`](0xERR0R/blocky@2ffe18a): fix: use RFC 4034 canonical DNS name ordering for NSEC coverage check ([#​2017](0xERR0R/blocky#2017)) ([@​0xERR0R](https://github.com/0xERR0R)) ##### Build and dependencies - [`a8015c8`](0xERR0R/blocky@a8015c8): build(deps): bump codecov/codecov-action from 5 to 6 ([#​2029](0xERR0R/blocky#2029)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`89aee54`](0xERR0R/blocky@89aee54): build(deps): bump crazy-max/ghaction-docker-meta from 5 to 6 ([#​2005](0xERR0R/blocky#2005)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`98f41c4`](0xERR0R/blocky@98f41c4): build(deps): bump dependabot/fetch-metadata from 2 to 3 ([#​2031](0xERR0R/blocky#2031)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`83434c5`](0xERR0R/blocky@83434c5): build(deps): bump docker/build-push-action from 6 to 7 ([#​2004](0xERR0R/blocky#2004)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`0c9e176`](0xERR0R/blocky@0c9e176): build(deps): bump docker/login-action from 3 to 4 ([#​2003](0xERR0R/blocky#2003)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`67dabab`](0xERR0R/blocky@67dabab): build(deps): bump docker/setup-buildx-action from 3 to 4 ([#​2006](0xERR0R/blocky#2006)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`def8e95`](0xERR0R/blocky@def8e95): build(deps): bump docker/setup-qemu-action from 3 to 4 ([#​2002](0xERR0R/blocky#2002)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`733f21c`](0xERR0R/blocky@733f21c): build(deps): bump github.com/alicebob/miniredis/v2 from 2.37.0 to 2.38.0 ([#​2055](0xERR0R/blocky#2055)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`5130c3e`](0xERR0R/blocky@5130c3e): build(deps): bump github.com/breml/rootcerts from 0.3.4 to 0.3.5 ([#​2040](0xERR0R/blocky#2040)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`08e53d7`](0xERR0R/blocky@08e53d7): build(deps): bump github.com/docker/go-connections from 0.6.0 to 0.7.0 ([#​2038](0xERR0R/blocky#2038)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`95225f8`](0xERR0R/blocky@95225f8): build(deps): bump github.com/jackc/pgx/v5 from 5.7.5 to 5.9.0 ([#​2039](0xERR0R/blocky#2039)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`3274076`](0xERR0R/blocky@3274076): build(deps): bump github.com/jackc/pgx/v5 from 5.9.0 to 5.9.2 ([#​2041](0xERR0R/blocky#2041)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`7a279fc`](0xERR0R/blocky@7a279fc): build(deps): bump github.com/moby/moby/api from 1.54.1 to 1.54.2 ([#​2050](0xERR0R/blocky#2050)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`1a04f45`](0xERR0R/blocky@1a04f45): build(deps): bump github.com/oapi-codegen/runtime from 1.1.2 to 1.2.0 ([#​1999](0xERR0R/blocky#1999)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`076c880`](0xERR0R/blocky@076c880): build(deps): bump github.com/oapi-codegen/runtime from 1.2.0 to 1.3.0 ([#​2021](0xERR0R/blocky#2021)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`b7fddae`](0xERR0R/blocky@b7fddae): build(deps): bump github.com/oapi-codegen/runtime from 1.3.0 to 1.3.1 ([#​2028](0xERR0R/blocky#2028)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`9c8f11c`](0xERR0R/blocky@9c8f11c): build(deps): bump github.com/oapi-codegen/runtime from 1.3.1 to 1.4.0 ([#​2030](0xERR0R/blocky#2030)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`62a7e4c`](0xERR0R/blocky@62a7e4c): build(deps): bump github.com/onsi/ginkgo/v2 from 2.28.1 to 2.28.2 ([#​2042](0xERR0R/blocky#2042)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`56dfb1d`](0xERR0R/blocky@56dfb1d): build(deps): bump github.com/onsi/ginkgo/v2 from 2.28.2 to 2.28.3 ([#​2044](0xERR0R/blocky#2044)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`adb9457`](0xERR0R/blocky@adb9457): build(deps): bump github.com/onsi/ginkgo/v2 from 2.28.3 to 2.29.0 ([#​2057](0xERR0R/blocky#2057)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`5d6da86`](0xERR0R/blocky@5d6da86): build(deps): bump github.com/onsi/gomega from 1.39.1 to 1.40.0 ([#​2043](0xERR0R/blocky#2043)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`6ac0c33`](0xERR0R/blocky@6ac0c33): build(deps): bump github.com/onsi/gomega from 1.40.0 to 1.41.0 ([#​2056](0xERR0R/blocky#2056)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`14047f2`](0xERR0R/blocky@14047f2): build(deps): bump github.com/quic-go/quic-go from 0.59.0 to 0.59.1 ([#​2054](0xERR0R/blocky#2054)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`670daf3`](0xERR0R/blocky@670daf3): build(deps): bump github.com/testcontainers/testcontainers-go/modules/mariadb from 0.40.0 to 0.41.0 ([#​2011](0xERR0R/blocky#2011)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`ecd41d6`](0xERR0R/blocky@ecd41d6): build(deps): bump github.com/testcontainers/testcontainers-go/modules/postgres from 0.40.0 to 0.41.0 ([#​2012](0xERR0R/blocky#2012)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`5c9df81`](0xERR0R/blocky@5c9df81): build(deps): bump github.com/testcontainers/testcontainers-go/modules/redis from 0.40.0 to 0.41.0 ([#​2009](0xERR0R/blocky#2009)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`0f1b3f3`](0xERR0R/blocky@0f1b3f3): build(deps): bump go.opentelemetry.io/otel/sdk from 1.35.0 to 1.40.0 ([#​2001](0xERR0R/blocky#2001)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`6a06aa4`](0xERR0R/blocky@6a06aa4): build(deps): bump go.opentelemetry.io/otel/sdk from 1.39.0 to 1.43.0 ([#​2047](0xERR0R/blocky#2047)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`394a585`](0xERR0R/blocky@394a585): build(deps): bump golang.org/x/net from 0.51.0 to 0.52.0 ([#​2014](0xERR0R/blocky#2014)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`f7718ae`](0xERR0R/blocky@f7718ae): build(deps): bump golang.org/x/net from 0.52.0 to 0.53.0 ([#​2036](0xERR0R/blocky#2036)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`2ea2b65`](0xERR0R/blocky@2ea2b65): build(deps): bump golang.org/x/net from 0.53.0 to 0.54.0 ([#​2053](0xERR0R/blocky#2053)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`2d36b56`](0xERR0R/blocky@2d36b56): build(deps): bump google.golang.org/grpc from 1.73.0 to 1.79.3 ([#​2020](0xERR0R/blocky#2020)) ([@​dependabot](https://github.com/dependabot)\[bot]) - [`bdcd239`](0xERR0R/blocky@bdcd239): build(deps): bump testcontainers-go to v0.42.0 ([#​2046](0xERR0R/blocky#2046)) ([@​0xERR0R](https://github.com/0xERR0R)) - [`cb2ae25`](0xERR0R/blocky@cb2ae25): build: update golangci-lint ([#​2008](0xERR0R/blocky#2008)) ([@​0xERR0R](https://github.com/0xERR0R)) - [`fa8250c`](0xERR0R/blocky@fa8250c): build: update goreleaser action ([#​2024](0xERR0R/blocky#2024)) ([@​0xERR0R](https://github.com/0xERR0R)) ##### Misc - [`1c43054`](0xERR0R/blocky@1c43054): perf(blocking): keep time.Parse off the schedule hot path ([#​2049](0xERR0R/blocky#2049)) ([@​0xERR0R](https://github.com/0xERR0R)) - [`b4a1d54`](0xERR0R/blocky@b4a1d54): refactor(e2e): extend e2e tests ([#​2023](0xERR0R/blocky#2023)) ([@​0xERR0R](https://github.com/0xERR0R)) - [`667044b`](0xERR0R/blocky@667044b): refactor: redis write through cache ([#​2025](0xERR0R/blocky#2025)) ([@​0xERR0R](https://github.com/0xERR0R)) - [`835e018`](0xERR0R/blocky@835e018): refactor: small quick improvements ([#​2019](0xERR0R/blocky#2019)) ([@​0xERR0R](https://github.com/0xERR0R)) - [`94e9212`](0xERR0R/blocky@94e9212): test(e2e): smoke-test schedule-based blocking ([#​2048](0xERR0R/blocky#2048)) ([@​0xERR0R](https://github.com/0xERR0R)) </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xODIuMSIsInVwZGF0ZWRJblZlciI6IjQzLjE4Mi4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
closes #1979