Pull request 1798: 4262-ipv6-pref
Updates #4262. Squashed commit of the following: commit de64f9c40c00317dbb5dbdda900d9b4c574a0a32 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Apr 3 19:23:15 2023 +0300 all: add ipv6 boostrap pref
This commit is contained in:
@@ -25,6 +25,9 @@ NOTE: Add new changes BELOW THIS COMMENT.
|
|||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
- The ability to make bootstrap DNS lookups prefer IPv6 addresses to IPv4 ones
|
||||||
|
using the new `dns.bootstrap_prefer_ipv6` configuration file property
|
||||||
|
([#4262]).
|
||||||
- Docker container's healthcheck ([#3290]).
|
- Docker container's healthcheck ([#3290]).
|
||||||
- The new HTTP API `POST /control/protection`, that updates protection state
|
- The new HTTP API `POST /control/protection`, that updates protection state
|
||||||
and adds an optional pause duration ([#1333]). The format of request body
|
and adds an optional pause duration ([#1333]). The format of request body
|
||||||
@@ -137,6 +140,7 @@ In this release, the schema version has changed from 17 to 20.
|
|||||||
[#1472]: https://github.com/AdguardTeam/AdGuardHome/issues/1472
|
[#1472]: https://github.com/AdguardTeam/AdGuardHome/issues/1472
|
||||||
[#3290]: https://github.com/AdguardTeam/AdGuardHome/issues/3290
|
[#3290]: https://github.com/AdguardTeam/AdGuardHome/issues/3290
|
||||||
[#3459]: https://github.com/AdguardTeam/AdGuardHome/issues/3459
|
[#3459]: https://github.com/AdguardTeam/AdGuardHome/issues/3459
|
||||||
|
[#4262]: https://github.com/AdguardTeam/AdGuardHome/issues/4262
|
||||||
[#5567]: https://github.com/AdguardTeam/AdGuardHome/issues/5567
|
[#5567]: https://github.com/AdguardTeam/AdGuardHome/issues/5567
|
||||||
[#5584]: https://github.com/AdguardTeam/AdGuardHome/issues/5584
|
[#5584]: https://github.com/AdguardTeam/AdGuardHome/issues/5584
|
||||||
[#5631]: https://github.com/AdguardTeam/AdGuardHome/issues/5631
|
[#5631]: https://github.com/AdguardTeam/AdGuardHome/issues/5631
|
||||||
|
|||||||
3
go.mod
3
go.mod
@@ -3,8 +3,7 @@ module github.com/AdguardTeam/AdGuardHome
|
|||||||
go 1.19
|
go 1.19
|
||||||
|
|
||||||
require (
|
require (
|
||||||
// TODO(a.garipov): Use v0.48.0 when it's released.
|
github.com/AdguardTeam/dnsproxy v0.48.3
|
||||||
github.com/AdguardTeam/dnsproxy v0.48.2
|
|
||||||
github.com/AdguardTeam/golibs v0.13.0
|
github.com/AdguardTeam/golibs v0.13.0
|
||||||
github.com/AdguardTeam/urlfilter v0.16.1
|
github.com/AdguardTeam/urlfilter v0.16.1
|
||||||
github.com/NYTimes/gziphandler v1.1.1
|
github.com/NYTimes/gziphandler v1.1.1
|
||||||
|
|||||||
4
go.sum
4
go.sum
@@ -1,5 +1,5 @@
|
|||||||
github.com/AdguardTeam/dnsproxy v0.48.2 h1:zEWeImyJGPeQAZ7+F/sgOJ2WbCRN1zbINLsDAEnFWjI=
|
github.com/AdguardTeam/dnsproxy v0.48.3 h1:h9xgDSmd1MqsPFNApyaPVXolmSTtzOWOcfWvPeDEP6s=
|
||||||
github.com/AdguardTeam/dnsproxy v0.48.2/go.mod h1:Y7g7jRTd/u7+KJ/QvnGI2PCE8vnisp6EsW47/Sz0DZw=
|
github.com/AdguardTeam/dnsproxy v0.48.3/go.mod h1:Y7g7jRTd/u7+KJ/QvnGI2PCE8vnisp6EsW47/Sz0DZw=
|
||||||
github.com/AdguardTeam/golibs v0.4.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
|
github.com/AdguardTeam/golibs v0.4.0/go.mod h1:skKsDKIBB7kkFflLJBpfGX+G8QFTx0WKUzB6TIgtUj4=
|
||||||
github.com/AdguardTeam/golibs v0.10.4/go.mod h1:rSfQRGHIdgfxriDDNgNJ7HmE5zRoURq8R+VdR81Zuzw=
|
github.com/AdguardTeam/golibs v0.10.4/go.mod h1:rSfQRGHIdgfxriDDNgNJ7HmE5zRoURq8R+VdR81Zuzw=
|
||||||
github.com/AdguardTeam/golibs v0.13.0 h1:hVBeNQXT/BgcjKz/4FMpFGvEYqXiXDJG+b5XpGCUOLk=
|
github.com/AdguardTeam/golibs v0.13.0 h1:hVBeNQXT/BgcjKz/4FMpFGvEYqXiXDJG+b5XpGCUOLk=
|
||||||
|
|||||||
@@ -199,6 +199,10 @@ type FilteringConfig struct {
|
|||||||
// IpsetListFileName, if set, points to the file with ipset configuration.
|
// IpsetListFileName, if set, points to the file with ipset configuration.
|
||||||
// The format is the same as in [IpsetList].
|
// The format is the same as in [IpsetList].
|
||||||
IpsetListFileName string `yaml:"ipset_file"`
|
IpsetListFileName string `yaml:"ipset_file"`
|
||||||
|
|
||||||
|
// BootstrapPreferIPv6, if true, instructs the bootstrapper to prefer IPv6
|
||||||
|
// addresses to IPv4 ones for DoH, DoQ, and DoT.
|
||||||
|
BootstrapPreferIPv6 bool `yaml:"bootstrap_prefer_ipv6"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// EDNSClientSubnet is the settings list for EDNS Client Subnet.
|
// EDNSClientSubnet is the settings list for EDNS Client Subnet.
|
||||||
@@ -479,6 +483,7 @@ func (s *Server) prepareUpstreamSettings() error {
|
|||||||
Bootstrap: s.conf.BootstrapDNS,
|
Bootstrap: s.conf.BootstrapDNS,
|
||||||
Timeout: s.conf.UpstreamTimeout,
|
Timeout: s.conf.UpstreamTimeout,
|
||||||
HTTPVersions: httpVersions,
|
HTTPVersions: httpVersions,
|
||||||
|
PreferIPv6: s.conf.BootstrapPreferIPv6,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -494,6 +499,7 @@ func (s *Server) prepareUpstreamSettings() error {
|
|||||||
Bootstrap: s.conf.BootstrapDNS,
|
Bootstrap: s.conf.BootstrapDNS,
|
||||||
Timeout: s.conf.UpstreamTimeout,
|
Timeout: s.conf.UpstreamTimeout,
|
||||||
HTTPVersions: httpVersions,
|
HTTPVersions: httpVersions,
|
||||||
|
PreferIPv6: s.conf.BootstrapPreferIPv6,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -447,6 +447,8 @@ func (s *Server) setupResolvers(localAddrs []string) (err error) {
|
|||||||
Bootstrap: bootstraps,
|
Bootstrap: bootstraps,
|
||||||
Timeout: defaultLocalTimeout,
|
Timeout: defaultLocalTimeout,
|
||||||
// TODO(e.burkov): Should we verify server's certificates?
|
// TODO(e.burkov): Should we verify server's certificates?
|
||||||
|
|
||||||
|
PreferIPv6: s.conf.BootstrapPreferIPv6,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -645,6 +645,7 @@ func (err domainSpecificTestError) Error() (msg string) {
|
|||||||
func checkDNS(
|
func checkDNS(
|
||||||
upstreamConfigStr string,
|
upstreamConfigStr string,
|
||||||
bootstrap []string,
|
bootstrap []string,
|
||||||
|
bootstrapPrefIPv6 bool,
|
||||||
timeout time.Duration,
|
timeout time.Duration,
|
||||||
healthCheck healthCheckFunc,
|
healthCheck healthCheckFunc,
|
||||||
) (err error) {
|
) (err error) {
|
||||||
@@ -672,8 +673,9 @@ func checkDNS(
|
|||||||
log.Debug("dnsforward: checking if upstream %q works", upstreamAddr)
|
log.Debug("dnsforward: checking if upstream %q works", upstreamAddr)
|
||||||
|
|
||||||
u, err := upstream.AddressToUpstream(upstreamAddr, &upstream.Options{
|
u, err := upstream.AddressToUpstream(upstreamAddr, &upstream.Options{
|
||||||
Bootstrap: bootstrap,
|
Bootstrap: bootstrap,
|
||||||
Timeout: timeout,
|
Timeout: timeout,
|
||||||
|
PreferIPv6: bootstrapPrefIPv6,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to choose upstream for %q: %w", upstreamAddr, err)
|
return fmt.Errorf("failed to choose upstream for %q: %w", upstreamAddr, err)
|
||||||
@@ -705,6 +707,7 @@ func (s *Server) handleTestUpstreamDNS(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
result := map[string]string{}
|
result := map[string]string{}
|
||||||
bootstraps := req.BootstrapDNS
|
bootstraps := req.BootstrapDNS
|
||||||
|
bootstrapPrefIPv6 := s.conf.BootstrapPreferIPv6
|
||||||
timeout := s.conf.UpstreamTimeout
|
timeout := s.conf.UpstreamTimeout
|
||||||
|
|
||||||
type upsCheckResult = struct {
|
type upsCheckResult = struct {
|
||||||
@@ -721,7 +724,7 @@ func (s *Server) handleTestUpstreamDNS(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
defer func() { resCh <- res }()
|
defer func() { resCh <- res }()
|
||||||
|
|
||||||
checkErr := checkDNS(ups, bootstraps, timeout, healthCheck)
|
checkErr := checkDNS(ups, bootstraps, bootstrapPrefIPv6, timeout, healthCheck)
|
||||||
if checkErr != nil {
|
if checkErr != nil {
|
||||||
res.res = checkErr.Error()
|
res.res = checkErr.Error()
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -408,6 +408,7 @@ func (clients *clientsContainer) findUpstreams(
|
|||||||
Bootstrap: config.DNS.BootstrapDNS,
|
Bootstrap: config.DNS.BootstrapDNS,
|
||||||
Timeout: config.DNS.UpstreamTimeout.Duration,
|
Timeout: config.DNS.UpstreamTimeout.Duration,
|
||||||
HTTPVersions: dnsforward.UpstreamHTTPVersions(config.DNS.UseHTTP3Upstreams),
|
HTTPVersions: dnsforward.UpstreamHTTPVersions(config.DNS.UseHTTP3Upstreams),
|
||||||
|
PreferIPv6: config.DNS.BootstrapPreferIPv6,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user