chore(env): DNS_ADDRESS variable
- With retro-compatibility with `DNS_PLAINTEXT_ADDRESS`
This commit is contained in:
7
internal/configuration/sources/env/dns.go
vendored
7
internal/configuration/sources/env/dns.go
vendored
@@ -3,7 +3,6 @@ package env
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
|
||||
"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) {
|
||||
s := os.Getenv("DNS_PLAINTEXT_ADDRESS")
|
||||
key, s := r.getEnvWithRetro("DNS_ADDRESS", "DNS_PLAINTEXT_ADDRESS")
|
||||
if s == "" {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
address = net.ParseIP(s)
|
||||
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
|
||||
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." +
|
||||
" 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" +
|
||||
|
||||
Reference in New Issue
Block a user