Skip to content

Commit a060407

Browse files
committed
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
1 parent d418225 commit a060407

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

dnscrypt-proxy/config.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ import (
2121
)
2222

2323
const (
24-
MaxTimeout = 3600
24+
MaxTimeout = 3600
25+
DefaultNetprobeAddress = "9.9.9.9:53"
2526
)
2627

2728
type Config struct {
@@ -112,7 +113,6 @@ func newConfig() Config {
112113
LogMaxBackups: 1,
113114
TLSDisableSessionTickets: false,
114115
TLSCipherSuite: nil,
115-
NetprobeAddress: "255.255.255.0:53",
116116
NetprobeTimeout: 60,
117117
OfflineMode: false,
118118
RefusedCodeInResponses: false,
@@ -425,7 +425,13 @@ func ConfigLoad(proxy *Proxy, svcFlag *string) error {
425425
netprobeTimeout = *netprobeTimeoutOverride
426426
}
427427
})
428-
NetProbe(config.NetprobeAddress, netprobeTimeout)
428+
netprobeAddress := DefaultNetprobeAddress
429+
if len(config.NetprobeAddress) > 0 {
430+
netprobeAddress = config.NetprobeAddress
431+
} else if len(config.FallbackResolver) > 0 {
432+
netprobeAddress = config.FallbackResolver
433+
}
434+
NetProbe(netprobeAddress, netprobeTimeout)
429435
if !config.OfflineMode {
430436
if err := config.loadSources(proxy); err != nil {
431437
return err

dnscrypt-proxy/example-dnscrypt-proxy.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ netprobe_timeout = 60
217217
## On other operating systems, the connection will be initialized
218218
## but nothing will be sent at all.
219219

220-
netprobe_address = "255.255.255.0:53"
220+
netprobe_address = "9.9.9.9:53"
221221

222222

223223
## Offline mode - Do not use any remote encrypted servers.

dnscrypt-proxy/netprobe_windows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
)
1010

1111
func NetProbe(address string, timeout int) error {
12-
if len(address) <= 0 || timeout <= 0 {
12+
if len(address) <= 0 || timeout == 0 {
1313
return nil
1414
}
1515
remoteUDPAddr, err := net.ResolveUDPAddr("udp", address)

0 commit comments

Comments
 (0)