THe idea was that other applications could use the websockets
to display the information their own way, but I'm not sure this
is really used in practice
Enumerating the interfaces is not free, especially on Windows where every
address lookup goes through the IP Helper service, so we sample slowly.
Losing a minute before rotating our client key after a network change is
harmless; burning CPU cycles every few seconds on an idle machine is not.
Suffix rules are stored as-is, just reversed in a critbit trie.
So the longest prefix can end inside a DNS label, and hide a
shorter rule that actually matches the name.
To handle that and prevent adversarial names with many labels to
cause many repeated searches, we allowed only two lookups per match.
That was designed for common usage patterns, where names were
expected to be domain names, not host names.
But there's a clean way to prevent an unbounded number of matches
and properly match any rules: just append a dot to the stored suffix
keys (and reversed query names). It acts as a label separator, so
the longest prefix can find the specific valid suffix with as ingle
lookup.
Fixes#3305
Try the rollover-sized certificate query over UDP first and return as
soon as the small query succeeds so that a truncated response can
trigger TCP fallback instead of waiting for large UDP probes to time
out.
We keep relayed UDP packets at the intended size after accounting for
the Anonymized DNSCrypt header.
When retrying through a relay over TCP, retain a rollover-sized
inner query because the relay still forwards it to the resolver over
UDP and applies the anti-amplification thing.
Preserve the UDP RTT when TCP is used only to complete certificate
retrieval, so resolver latency does not incorrectly appear to be the
TCP fallback latency.
An anonymized relay forwards certificate queries to the upstream
resolver over UDP only, and both the resolver and the relay refuse
to return a UDP response larger than the request that triggered
it.
A post-quantum certificate is about 1.3 KB, so a small certificate
probe came back truncated to the classical certificate alone, and
the proxy never learned that the resolver supported X-Wing when it
was reached through a relay.
Pad the large certificate probe well past the response size to fix
this.