mirror of
https://github.com/DNSCrypt/dnscrypt-proxy.git
synced 2024-12-29 00:30:30 +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:
parent
d418225fdb
commit
a060407db1
@ -22,6 +22,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
MaxTimeout = 3600
|
MaxTimeout = 3600
|
||||||
|
DefaultNetprobeAddress = "9.9.9.9:53"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
@ -112,7 +113,6 @@ func newConfig() Config {
|
|||||||
LogMaxBackups: 1,
|
LogMaxBackups: 1,
|
||||||
TLSDisableSessionTickets: false,
|
TLSDisableSessionTickets: false,
|
||||||
TLSCipherSuite: nil,
|
TLSCipherSuite: nil,
|
||||||
NetprobeAddress: "255.255.255.0:53",
|
|
||||||
NetprobeTimeout: 60,
|
NetprobeTimeout: 60,
|
||||||
OfflineMode: false,
|
OfflineMode: false,
|
||||||
RefusedCodeInResponses: false,
|
RefusedCodeInResponses: false,
|
||||||
@ -425,7 +425,13 @@ func ConfigLoad(proxy *Proxy, svcFlag *string) error {
|
|||||||
netprobeTimeout = *netprobeTimeoutOverride
|
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 !config.OfflineMode {
|
||||||
if err := config.loadSources(proxy); err != nil {
|
if err := config.loadSources(proxy); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -217,7 +217,7 @@ netprobe_timeout = 60
|
|||||||
## On other operating systems, the connection will be initialized
|
## On other operating systems, the connection will be initialized
|
||||||
## but nothing will be sent at all.
|
## 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.
|
## Offline mode - Do not use any remote encrypted servers.
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func NetProbe(address string, timeout int) error {
|
func NetProbe(address string, timeout int) error {
|
||||||
if len(address) <= 0 || timeout <= 0 {
|
if len(address) <= 0 || timeout == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
remoteUDPAddr, err := net.ResolveUDPAddr("udp", address)
|
remoteUDPAddr, err := net.ResolveUDPAddr("udp", address)
|
||||||
|
Loading…
Reference in New Issue
Block a user