Skip to content

feat: allow multiple netprobe addresses - #3356

Closed
BPplays wants to merge 38 commits into
DNSCrypt:masterfrom
BPplays:netprobe_multiple
Closed

BPplays wants to merge 38 commits into
DNSCrypt:masterfrom
BPplays:netprobe_multiple

Conversation

@BPplays

@BPplays BPplays commented Sep 29, 2026 •

Copy link
Copy Markdown

this PR allows multiple netprobe addresses, to better support IPv6-only, and IPv4-only networks with the same config.

all probes are run concurrently. the first one to succeed cancels the others and causes the main function to stop waiting.

  • this PR also changes the netprobe timeout to be context based, given context is used to cancel when a probe succeeds using it for the timeout too makes sense to me
  • uses dialer.DialContext with the input host:port pair directly instead of resolving to *net.UDPAddr, this means it will try to resolve the host each time and try to dial any IPs that instead of resolving to just 1 which should improve compatibility with anything that templates/changes the hosts file or any hosts file entries with multiple IPs (i did test and it will resolve from /etc/hosts)
  • better error message handling, it now checks a message and only sends it once per probe (it mostly works like retried with better support for specific messages like name resolution errors)
  • better handling of netprobe_timeout: it's now tracked with a deadline instead of assuming each iteration is exactly 1s
  • there is now just a run-time check for windows specific behavior

P.S. i also didn't commit any of ./vendor for this PR

IPv4 disabled example:

just [9.9.9.9:53]:

-> go run . -config ../config.toml
[2026-09-20 02:35:51] [NOTICE] dnscrypt-proxy 2.1.18
[2026-09-20 02:35:51] [NOTICE] Using default Weighted Power of Two (WP2) load balancing strategy
[2026-09-20 02:35:51] [NOTICE] (9.9.9.9:53) Network not available yet -- waiting...

with [[2620:fe::fe]:53, 9.9.9.9:53]:

-> go run . -config ../config.toml
[2026-09-20 02:36:07] [NOTICE] dnscrypt-proxy 2.1.18
[2026-09-20 02:36:07] [NOTICE] Using default Weighted Power of Two (WP2) load balancing strategy
[2026-09-20 02:36:07] [NOTICE] (9.9.9.9:53) Network not available yet -- waiting...
[2026-09-20 02:36:07] [NOTICE] Network connectivity detected ([2620:fe::fe]:53)
[2026-09-20 02:36:07] [NOTICE] Now listening to [::1]:58003 [UDP]
[2026-09-20 02:36:07] [NOTICE] Now listening to [::1]:58003 [TCP]

… a function so they can be exported without being changed
…be uneeded and break backwards compatibility
@jedisct1

Copy link
Copy Markdown
Member

Before a PR, especially a complicated one that adds unneeded 3rd party dependencies, let's start with a discussion (in the Discussion section) describing the problem you have.

On some operating system (which one?) with network interfaces configured with IPv6 only, netprobe doesn't detect that the network is up?

@jedisct1 jedisct1 closed this Sep 29, 2026
@BPplays

BPplays commented Sep 29, 2026

Copy link
Copy Markdown
Author

@jedisct1 i made a discussion: #3357

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants