Repository navigation
reality: accept a ClientHello once, and learn the target's records ahead of the first client - #7
Merged
Conversation
…ead of the first client Two ways a REALITY server told itself apart from its target. A recorded ClientHello could be sent again for as long as its time stayed valid (MaxTimeDiff, forever with none). The server answered the copy itself: whoever replays cannot finish that handshake, but the server's behaviour towards it is its own and not the target's. The server now remembers the ClientHellos it accepted, by their random, for both sides of the time check (an hour with no check), in two bounded generations shared with clones, and hands a second copy to the target like any stranger's, so the copy gets the target's own answer. The target's post-handshake records were learned by a probe that the first client of each (target, SNI, ALPN, cipher suite) started and did not wait for, so that client got none of the records the target sends, unlike every client after it. Now the patterns of the usual handshakes (each server name, h2, each TLS 1.3 suite) are learned on the first connection of any kind; the probe of another key starts as soon as the target's ServerHello names the suite; a client whose pattern is still being learned waits for it, until two seconds after the probe began, so a probe that hangs holds up only the clients of its first moments; and a probe ends once the target has been quiet for 400 ms, or for as long as its own dial and handshake took, instead of always sitting out the five-second window.
Miroshka000
added a commit
to Miroshka000/mikan
that referenced
this pull request
Nov 12, 2026
…old by a replay More of what set a mikan server apart from an ordinary one: - an inbound no client has reached yet moves off www.microsoft.com, the site every installation started on, to a site next to its server; the node's such inbounds take one site from one search, retried once a day when nothing is found. An inbound with clients keeps its site, as a change would cut them off until their subscription is read again - the REALITY window of a client's clock is 10 minutes, not 2 hours: it is how long a recorded ClientHello stays worth sending again - the core (getmikan/utls#7): an accepted ClientHello is remembered and a copy of it goes to the target, and the first client after a start gets the target's post-handshake records as every later one does - a new remote node's API answers the panel alone from the start - X-Forwarded-For is read from a proxy on the server or its private networks, or one named in MIKAN_TRUSTED_PROXIES, and not from a peer that came straight from the internet The API's reason of an automatic change has default_site.
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.
Two ways a REALITY server told itself apart from its target.
A recorded ClientHello could be replayed
The proof of a REALITY client sits in its ClientHello, so whoever recorded one can send it again for as long as its time stays valid (
MaxTimeDiff, forever with none). The server answered the copy itself. Whoever replays cannot finish that handshake, but the server's behaviour towards it is its own and not the target's.Now the server remembers the ClientHellos it accepted, by their random, and hands a second copy to the target like any stranger's, so the copy gets the target's own answer.
2 * MaxTimeDiff), an hour with no checkThe first client got no post-handshake records
The target's post-handshake records were learned by a probe that the first client of each (target, SNI, ALPN, cipher suite) started and did not wait for. That client got none of the records the target sends, unlike every client after it.
Tests
TestRealityReplayedClientHelloGoesToTheTarget: a ClientHello recorded from a real client and sent again is forwarded, and what comes back has the shape of the target's own flight. With the guard taken out it fails.TestRealityReplayGuard,TestRealityReplayGuardIsBounded,TestRealityReplayWindowTestRealityPostHandshakeWarm,TestRealityPostHandshakeWaitIsBoundedTestRealityPostHandshakeRecordsImitatedandTestRealityPostHandshakeALPNnow expect the first connection to carry the target's records.go test .passes on Windows (Go 1.26.8);go test -race -run Reality .passes ingolang:1.27.Not covered
No API change: the new fields of
RealityConfigare unexported. Not run inside Citrus or on a live server yet.