Repository navigation
feat: bounded reproducible random record and write cuts - #4
Merged
Merged
Conversation
Options.Random adds opt-in RandomCut ranges for TLS record cuts and TCP write cuts, anchored like Pos (absolute or SNI-relative), with a bounded count and minimum piece size. A nonzero seed reproduces the cuts exactly; otherwise one crypto/rand seed per connection drives splitmix64. Deterministic options keep their meaning byte for byte. Options.Key returns a versioned canonical description, including the randomization policy and seed, for use in cached strategy IDs. Adds regression, golden, TLS round-trip and FuzzRandomCuts tests and first-write benchmarks.
Nemu-x
force-pushed
the
feat/split-randomization
branch
from
October 28, 2026 18:06
8029fc8 to
4849150
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.
Milestone 2 of
docs/vnext.md: bounded, reproducible randomization of record and write cuts. Deterministic options keep their exact behaviour; withRandom == nilthe old code path runs unchanged.SplitDelayis set (the random split delay is interruptible by deadlines and Close like the deterministic one).Options.Key()covers every field (fake payload as SHA-256) with adesync/v1prefix pinned by a seed-42 golden test, so a changed draw algorithm forces a version bump.docs/controller.mdnow says to derive candidate IDs /PolicyVersionfrom it.Tests:
random_test.go(bounds over 500 seeds, multi-record and legacy-version input, chunked writes, reproduction, golden output, partial writes at every failure offset, deadline-interrupted delay, validation, copy-on-wrap,Keyuniqueness, 20 loopback TLS 1.3 handshakes) andFuzzRandomCuts(20 s, ~500k execs, no failures). Windows Go 1.26.10 tests and vet for windows/linux/darwin pass; Linux Go 1.20.14 and-raceon Go 1.26.9 in Docker pass.Benchmarks (WrapConn + 517-byte first write + 16-byte write): deterministic 430 ns, 936 B, 9 allocs (main: 407 ns, 928 B, 10 allocs); seeded 525 ns, 1104 B, 9 allocs; unseeded 650 ns.
Not verified: macOS runtime, real-network effectiveness.
desync-sockshas no random flags yet. On Windows with Go 1.20.14, 9 native fake tests fail exactly as on unchangedmain("read fake TTL: not supported by windows"); CI's Go 1.20 job runs on Linux.The README paragraph targets the current README; it will be moved into the rewritten one from #3 after that merges.