Add probing, announcing and conflict resolution (RFC 6762 §8-9)#271
Open
backkem wants to merge 6 commits into
Open
Add probing, announcing and conflict resolution (RFC 6762 §8-9)#271backkem wants to merge 6 commits into
backkem wants to merge 6 commits into
Conversation
c604b8b to
c1b926f
Compare
Member
Author
|
cc @JoTurk early feedback appreciated. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #271 +/- ##
==========================================
+ Coverage 84.11% 85.54% +1.43%
==========================================
Files 8 9 +1
Lines 1970 2525 +555
==========================================
+ Hits 1657 2160 +503
- Misses 202 241 +39
- Partials 111 124 +13
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
c1b926f to
161bfe1
Compare
5794c46 to
b28f669
Compare
RFC 6762 §8-9 implementation: - probe.go: state machine (delay→probing→announcing→established) - Simultaneous probe tiebreaking with lexicographic compare (§8.2) - Conflict detection in all resource record sections (§9) - Rename strategy: "-N" for hosts, " (N)" for services - Rate limiting: 15 conflicts/10s → 5s backoff, 60s give-up - Cache-flush bit on unique records in announcements (§10.2) - WithProbing, WithConflictHandler options - WaitReady() blocks until initial probing completes - Conn.setConflictHandler/conflictHandler via atomic.Value
- Name inbound channel buffer size as constant - Test onProbeRenamed for host, service instance, escaped dots, case-insensitive match, and no-match no-op - Test WaitReady for nil probes, context cancellation, conn close - Test sequential conflicts (two rename cycles with record header verification) - Test full conflict-rename-announce cycle with wire content verification (renamed name, cache-flush bit, preserved rdata)
- Answer qtype ANY for established names (§6) so probes from other hosts see a conflict; previously we stayed silent and lost the name to the newcomer - Re-probe the same name on post-probing conflicts (§9) instead of renaming immediately; rename only if the re-probe conflicts - Announce the service-type PTR as a shared record (§8.3), without cache-flush and excluded from probe/tiebreak - Derive default renames from the original base name so user names ending in "-2" or " (2)" are not mangled - Iterate RR sections in place in processResponse; appending aliased the message shared with other handlers - Keep ready open on shutdown so WaitReady deterministically returns errConnectionClosed; drop dead probeManager.ttl
Only link-local answers carry a zone. The second QueryAddr assertion required a zone on any non-4in6 address and failed on hosts with a global IPv6 adapter (e.g. Cloudflare WARP). Mirror the link-local guard used by the first assertion.
b28f669 to
dfb946c
Compare
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
probe.go: State machine for name probing (delay→probing→announcing→established), simultaneous probe tiebreaking (§8.2), conflict detection across all RR sections (§9), rename + re-probe with rate limitingconfig.go:WithProbing(),WithConflictHandler()optionsconn.go:WaitReady(), atomic.Value conflict handler (unexported setter, ready to expose asOnConflictlater)server.go:probeManagerintegration,buildProbeSessions,onProbeRenamedcallbackprobe_test.go, deterministic via fake timers +sync.CondOpening as draft for early review feedback.
Open questions
probe.gois ~950 lines. Should we split it further, e.g.:probe.go— state machine + managerprobe_tiebreak.go—lexicographicCompare,sortResources,compareResource,packRDataprobe_rename.go—defaultRename,defaultRenameHost,defaultRenameServiceInstanceOr is one file fine given the tight coupling?
WaitReady(ctx) erroris currently exported onConn. Is this the right API surface, or should readiness be signaled differently (e.g. callback, channel field)?