1
0
mirror of https://github.com/DNSCrypt/dnscrypt-proxy.git synced 2024-12-28 00:20:13 +01:00

Use a different address than 255.255.255.0 for netprobes

Windows doesn't seem to like this address.

Also default to the fallback resolver IP if there is one and
no netprobe_address option in the configuration file.

Fix netprobe_timeout = -1 by the way
This commit is contained in:
Frank Denis 2019-06-04 01:37:59 +02:00
parent d418225fdb
commit a060407db1
3 changed files with 11 additions and 5 deletions

View File

@ -21,7 +21,8 @@ import (
)
const (
MaxTimeout = 3600
MaxTimeout = 3600
DefaultNetprobeAddress = "9.9.9.9:53"
)
type Config struct {
@ -112,7 +113,6 @@ func newConfig() Config {
LogMaxBackups: 1,
TLSDisableSessionTickets: false,
TLSCipherSuite: nil,
NetprobeAddress: "255.255.255.0:53",
NetprobeTimeout: 60,
OfflineMode: false,
RefusedCodeInResponses: false,
@ -425,7 +425,13 @@ func ConfigLoad(proxy *Proxy, svcFlag *string) error {
netprobeTimeout = *netprobeTimeoutOverride
}
})
NetProbe(config.NetprobeAddress, netprobeTimeout)
netprobeAddress := DefaultNetprobeAddress
if len(config.NetprobeAddress) > 0 {
netprobeAddress = config.NetprobeAddress
} else if len(config.FallbackResolver) > 0 {
netprobeAddress = config.FallbackResolver
}
NetProbe(netprobeAddress, netprobeTimeout)
if !config.OfflineMode {
if err := config.loadSources(proxy); err != nil {
return err

View File

@ -217,7 +217,7 @@ netprobe_timeout = 60
## On other operating systems, the connection will be initialized
## but nothing will be sent at all.
netprobe_address = "255.255.255.0:53"
netprobe_address = "9.9.9.9:53"
## Offline mode - Do not use any remote encrypted servers.

View File

@ -9,7 +9,7 @@ import (
)
func NetProbe(address string, timeout int) error {
if len(address) <= 0 || timeout <= 0 {
if len(address) <= 0 || timeout == 0 {
return nil
}
remoteUDPAddr, err := net.ResolveUDPAddr("udp", address)