mirror of
https://github.com/qdm12/gluetun.git
synced 2026-05-09 20:29:23 +02:00
hotfix(dns): DNS_UPSTREAM_RESOLVERS defaults to empty if DNS_UPSTREAM_PLAIN_ADDRESSES is not empty
This commit is contained in:
+2
-1
@@ -224,7 +224,8 @@ ENV VPN_SERVICE_PROVIDER=pia \
|
|||||||
HEALTH_RESTART_VPN=on \
|
HEALTH_RESTART_VPN=on \
|
||||||
# DNS
|
# DNS
|
||||||
DNS_UPSTREAM_RESOLVER_TYPE=DoT \
|
DNS_UPSTREAM_RESOLVER_TYPE=DoT \
|
||||||
DNS_UPSTREAM_RESOLVERS=cloudflare \
|
# Note: DNS_UPSTREAM_RESOLVERS defaults to cloudflare in code if DNS_UPSTREAM_PLAIN_ADDRESSES is empty
|
||||||
|
DNS_UPSTREAM_RESOLVERS= \
|
||||||
DNS_BLOCK_IPS= \
|
DNS_BLOCK_IPS= \
|
||||||
DNS_BLOCK_IP_PREFIXES= \
|
DNS_BLOCK_IP_PREFIXES= \
|
||||||
DNS_CACHING=on \
|
DNS_CACHING=on \
|
||||||
|
|||||||
@@ -44,9 +44,10 @@ type DNS struct {
|
|||||||
Blacklist DNSBlacklist
|
Blacklist DNSBlacklist
|
||||||
// UpstreamPlainAddresses are the upstream plaintext DNS resolver
|
// UpstreamPlainAddresses are the upstream plaintext DNS resolver
|
||||||
// addresses to use by the built-in DNS server forwarder.
|
// addresses to use by the built-in DNS server forwarder.
|
||||||
// Note, if the upstream type is [dnsUpstreamTypePlain] these are merged
|
// Note, if the upstream type is [dnsUpstreamTypePlain] and this field is set,
|
||||||
// together with provider names set in the Providers field.
|
// the Providers field will default to the empty slice. If the Providers field
|
||||||
// If this field is set, the Providers field will default to the empty slice.
|
// is set by the user, then the content of this field will be merged together
|
||||||
|
// with the plain addresses of the providers set in the Providers field.
|
||||||
UpstreamPlainAddresses []netip.AddrPort
|
UpstreamPlainAddresses []netip.AddrPort
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,13 +134,15 @@ func (d *DNS) setDefaults() {
|
|||||||
d.UpstreamType = gosettings.DefaultComparable(d.UpstreamType, DNSUpstreamTypeDot)
|
d.UpstreamType = gosettings.DefaultComparable(d.UpstreamType, DNSUpstreamTypeDot)
|
||||||
const defaultUpdatePeriod = 24 * time.Hour
|
const defaultUpdatePeriod = 24 * time.Hour
|
||||||
d.UpdatePeriod = gosettings.DefaultPointer(d.UpdatePeriod, defaultUpdatePeriod)
|
d.UpdatePeriod = gosettings.DefaultPointer(d.UpdatePeriod, defaultUpdatePeriod)
|
||||||
d.Providers = gosettings.DefaultSlice(d.Providers, []string{
|
d.UpstreamPlainAddresses = gosettings.DefaultSlice(d.UpstreamPlainAddresses, []netip.AddrPort{})
|
||||||
provider.Cloudflare().Name,
|
defaultProviders := defaultDNSProviders()
|
||||||
})
|
if d.UpstreamType == DNSUpstreamTypePlain && len(d.UpstreamPlainAddresses) == 0 {
|
||||||
|
defaultProviders = []string{}
|
||||||
|
}
|
||||||
|
d.Providers = gosettings.DefaultSlice(d.Providers, defaultProviders)
|
||||||
d.Caching = gosettings.DefaultPointer(d.Caching, true)
|
d.Caching = gosettings.DefaultPointer(d.Caching, true)
|
||||||
d.IPv6 = gosettings.DefaultPointer(d.IPv6, false)
|
d.IPv6 = gosettings.DefaultPointer(d.IPv6, false)
|
||||||
d.Blacklist.setDefaults()
|
d.Blacklist.setDefaults()
|
||||||
d.UpstreamPlainAddresses = gosettings.DefaultSlice(d.UpstreamPlainAddresses, []netip.AddrPort{})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func defaultDNSProviders() []string {
|
func defaultDNSProviders() []string {
|
||||||
|
|||||||
Reference in New Issue
Block a user