Repository navigation
Conversation
An Endpoint hostname was resolved once at config load, so a peer behind dynamic DNS stayed unreachable after its IP changed until wireproxy was restarted. For peers whose endpoint is a hostname, check the last handshake every EndpointReresolveInterval seconds ([Interface], default 30, 0 disables). When it is older than 135s or has never happened (the threshold used by wireguard-tools' contrib/reresolve-dns), resolve the hostname again and set the new endpoint with update_only if it differs from the current one. A failed lookup is logged and the current endpoint is kept. IP literal endpoints never start the loop. Startup behaviour for an unresolvable hostname is unchanged. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Store the seconds and nanoseconds per peer and build the time after the whole IpcGet response is read. Fixes golangci-lint ineffassign on nsec and no longer depends on last_handshake_time_sec preceding _nsec. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A peer
Endpointgiven as a hostname is resolved once, when the config loads. If the peer's address changes (e.g. a home router behind dynamic DNS), wireproxy keeps sending to the old address until it is restarted.This adds
EndpointReresolveInterval([Interface], seconds, default30,0disables). Every interval, for each peer with a hostname endpoint whose last handshake is more than 135 seconds old (past wireguard's rekey window), the hostname is resolved again. The endpoint is updated withupdate_only=trueif the address changed. A failed lookup is logged and the current endpoint kept. IP endpoints are never touched, and the hostname must still resolve at startup. The handshake time is read fromIpcGetin any key order.This PR may conflict with the health-check PR in
config.goand README (adjacent[Interface]keys). Happy to rebase.Test plan
go test -race ./...,go vet ./...,gofmt -l ., golangci-lint (fork CI green).IpcGeterror, only stale peers updated, peer selection, config parsing, and handshake key order.🤖 Generated with Claude Code