chore(env): DNS_ADDRESS variable
- With retro-compatibility with `DNS_PLAINTEXT_ADDRESS`
This commit is contained in:
@@ -141,7 +141,7 @@ ENV VPNSP=pia \
|
|||||||
BLOCK_ADS=off \
|
BLOCK_ADS=off \
|
||||||
UNBLOCK= \
|
UNBLOCK= \
|
||||||
DNS_UPDATE_PERIOD=24h \
|
DNS_UPDATE_PERIOD=24h \
|
||||||
DNS_PLAINTEXT_ADDRESS=127.0.0.1 \
|
DNS_ADDRESS=127.0.0.1 \
|
||||||
DNS_KEEP_NAMESERVER=off \
|
DNS_KEEP_NAMESERVER=off \
|
||||||
# HTTP proxy
|
# HTTP proxy
|
||||||
HTTPPROXY= \
|
HTTPPROXY= \
|
||||||
|
|||||||
7
internal/configuration/sources/env/dns.go
vendored
7
internal/configuration/sources/env/dns.go
vendored
@@ -3,7 +3,6 @@ package env
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/qdm12/gluetun/internal/configuration/settings"
|
"github.com/qdm12/gluetun/internal/configuration/settings"
|
||||||
)
|
)
|
||||||
@@ -28,19 +27,19 @@ func (r *Reader) readDNS() (dns settings.DNS, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *Reader) readDNSServerAddress() (address net.IP, err error) {
|
func (r *Reader) readDNSServerAddress() (address net.IP, err error) {
|
||||||
s := os.Getenv("DNS_PLAINTEXT_ADDRESS")
|
key, s := r.getEnvWithRetro("DNS_ADDRESS", "DNS_PLAINTEXT_ADDRESS")
|
||||||
if s == "" {
|
if s == "" {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
address = net.ParseIP(s)
|
address = net.ParseIP(s)
|
||||||
if address == nil {
|
if address == nil {
|
||||||
return nil, fmt.Errorf("environment variable DNS_PLAINTEXT_ADDRESS: %w: %s", ErrIPAddressParse, s)
|
return nil, fmt.Errorf("environment variable %s: %w: %s", key, ErrIPAddressParse, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO remove in v4
|
// TODO remove in v4
|
||||||
if !address.Equal(net.IPv4(127, 0, 0, 1)) { //nolint:gomnd
|
if !address.Equal(net.IPv4(127, 0, 0, 1)) { //nolint:gomnd
|
||||||
r.warner.Warn("DNS_PLAINTEXT_ADDRESS is set to " + s +
|
r.warner.Warn(key + " is set to " + s +
|
||||||
" so the DNS over TLS (DoT) server will not be used." +
|
" so the DNS over TLS (DoT) server will not be used." +
|
||||||
" The default value changed to 127.0.0.1 so it uses the internal DoT server." +
|
" The default value changed to 127.0.0.1 so it uses the internal DoT server." +
|
||||||
" If the DoT server fails to start, the IPv4 address of the first plaintext DNS server" +
|
" If the DoT server fails to start, the IPv4 address of the first plaintext DNS server" +
|
||||||
|
|||||||
Reference in New Issue
Block a user