Skip to content

feat: shared strategy catalog package - #10

Merged
Nemu-x merged 5 commits into
mainfrom
feat/presets-package
Oct 29, 2026
Merged

Nemu-x merged 5 commits into
mainfrom
feat/presets-package

Conversation

@Nemu-x

@Nemu-x Nemu-x commented Oct 29, 2026

Copy link
Copy Markdown
Owner

github.com/Nemu-x/desync/presets: one strategy catalog for apps and desync-probe, so a strategy ID from a tester's report is the same ID an app caches and selects.

  • Preset{Name, Description, Options, Needs, Rank} with ID() and Key(); UDPPreset wraps UDPOptions. IDs: "s" + 10 hex of sha256(Options.Key()) exactly as the probe computed them (the four pinned IDs unchanged), "u" + 10 for UDP.
  • TCP() (23 presets: baseline, record cuts, write splits, random cuts, disorder, oob, disoob, split waits, fake TTL 3/5/8, fake with decoy SNI, fake among split pieces, disorder + fake) and UDP() (9: zero and QUIC templates, TTL and repeat variants; the QUIC ones are QUIC-only).
  • Filter/FilterUDP(ps, caps) decide from capabilities alone (answers for another OS); Available/AvailableUDP(caps) also drop what Validate rejects here and return the skipped ones with reasons from Capabilities.Unsupported.
  • Ranked/RankedUDP: try cheap and robust first — baseline, record splits, write splits, split waits, disorder/OOB, fakes, fake + disorder last (a fake whose TTL reaches the server breaks the handshake). UDP: fewer extra datagrams first. Reasoning, not measurements.
  • ByID, IDs, UDPIDs; type ID (JSON string; malformed rejected, unknown well-formed kept so settings from another version load); CatalogVersion(ids) for controller.Config.PolicyVersion, which the joined IDs would overflow.
  • desync-probe takes its strategies from the package; -list-presets output and the report are byte-identical to before.
  • Fix: UDPOptions.Key() left out Template, SNI and QUICOnly, so a zero burst and a QUIC decoy with the same TTL had one key and one ID. They are appended only when set: existing UDP keys don't change.

Tests: golden names and IDs for every preset, ordering, Filter/Available for simulated windows/linux/darwin/no-methods with exact lists and reasons, simulation matches PlatformCapabilities() on the host, every kept preset validates, ByID/JSON round trips, the controller accepts all IDs with CatalogVersion. gofmt, vet windows/linux/darwin on Go 1.26.10 and 1.20.14; tests on Windows (both) and Linux in Docker (1.26.9 -race, 1.20.14). Not verified: macOS runtime (CI), real networks.

Template, SNI and QUICOnly change the burst but were missing from the key, so a zero-payload burst and a QUIC Initial decoy with the same TTL had the same key and the same derived strategy ID. They are appended only when set, so keys of existing bursts are unchanged.
The presets package holds the TCP catalog of desync-probe and a UDP burst catalog (zero-payload and QUIC Initial decoys at several TTLs and burst sizes) with stable IDs derived from the options' Key: s + 10 hex digits of SHA-256 for TCP, as desync-probe reports them, u + 10 for UDP. Available filters by Capabilities with the reason from Unsupported and drops what Validate rejects here; Filter answers for any platform's capabilities. Rank and Ranked suggest trying cheap, robust strategies first; ByID and the ID text type let applications persist only the ID.
The built-in catalog, the capability filter and the ID derivation moved to the presets package. Names, order, IDs, skip reasons and the report schema are unchanged; -list-presets prints the same output.
CatalogVersion hashes the candidate IDs in order. Joined IDs exceed the 128-byte limit of controller.Config.PolicyVersion; a test checks that the controller accepts every catalog ID with it.
README section on the presets package with every preset, its ID, rank and needed features and the ordering rationale; the controller document uses preset IDs as candidates and CatalogVersion in the policy version; the vNext status lists the catalog.
@Nemu-x
Nemu-x merged commit 8287a53 into main Oct 29, 2026
19 checks passed
@Nemu-x
Nemu-x deleted the feat/presets-package branch October 29, 2026 22:56
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.

1 participant