Skip to content

lkrequest-go v0.2.2

Choose a tag to compare

@ezxlabs-admin ezxlabs-admin released this 25 Sep 13:53
· 4 commits to main since this release

Updates the bundled lkrequest-ffi native engine, adds the Chrome 153,
Chrome 154 and Firefox 156 presets, and binds the new proxy-configuration and
MASQUE entry points. Every addition is new API — the native surface grew by 21
symbols and changed none — so every existing call shape keeps working.

Most of this release is invisible until you look at the wire. The Cookie
header was being sent in an arbitrary order that differed between sessions, and
the QUIC wire image of the existing Chrome presets has changed — both are
fingerprint fixes that apply to code you have already written. The largest
performance fix is an HTTP/3 fallback path that silently rebuilt the connection
for every request. Two entries change behaviour you may be relying on and are
worth reading before upgrading: the default port for a portless HTTP proxy URL,
and the proxy identity encoding.

🚀 Features

  • Chrome 153 Preset — SetPreset("chrome_153") / NewClient("chrome_153"), captured from Chrome 153.0.8010.37 (Windows, September 2026). TCP TLS keeps Chrome 152's signature-algorithm GREASE and trims the shuffled 0xca34 trust-anchor identifier vector from 32 values to 28. HTTP/2 keeps Chrome 152's SETTINGS, connection window, pseudo-header order and initial HEADERS priority. QUIC keeps the classic nine signature algorithms, shuffled ClientHello extensions and the same 28 identifiers.
  • Chromium QUIC Wire Generation — the Chrome presets now follow Chromium's own generation rules for the randomized parts of the HTTP/3 and QUIC wire image: a random reserved SETTINGS id and value, a 0–3 byte control-stream GREASE frame and no request-stream GREASE; reserved transport parameters drawn from the full 62-bit GREASE id space with 0–15 byte payloads and a randomized GREASE version position; and client Initials that split, pad and shuffle their CRYPTO data with interleaved PING/PADDING, including across loss, Retry and 0-RTT. This applies to the Chrome presets you are already using, not only to Chrome 153. Custom profiles and previously serialized ones are unaffected — both underlying fields default to off.
  • Chrome 154 Preset — SetPreset("chrome_154"), captured from Chrome 154.0.8037.58 (Windows, September 2026). Every layer keeps Chrome 153's shape: TCP TLS with its 28 trust-anchor identifiers, HTTP/2, QUIC TLS, QUIC transport parameters and Chromium Initial packetization. HTTP/3 application settings keep Chrome 153's baseline, as upstream's capture path received no QUIC response to compare against.
  • Firefox 156 Preset — SetPreset("firefox_156"), captured from Firefox 156.0.1 (Windows, September 2026). Against Firefox 147 it drops the two ECDSA CBC cipher suites and both FFDHE groups and moves ECH GREASE to AES-128-GCM; HTTP/2 is unchanged. It has no QUIC profile: upstream keeps HTTP/3 off until it can reproduce Firefox's transport and Initial-packet fields exactly.
  • Proxy Credentials Beyond Username/Password — ParseProxyConfig returns a ProxyConfig that can carry a static HTTP credential — SetHTTPAuth("Preshared", psk), PrivateToken, Bearer and the like — and choose its header with SetAuthHeader: Proxy-Authorization by default, or Authorization for masque-go and RFC 9484 style deployments. SetUserPass sets a username and password without URL-encoding them. Hand it to SessionBuilder.SetProxyConfig or ProxyPoolBuilder.AddProxyConfig; both copy it. A header credential on a SOCKS5 proxy, which has nowhere to put one, is an error rather than a credential silently never sent.
  • MASQUE Proxies (Experimental) — a masque:// proxy carries the QUIC connection to the origin inside an RFC 9298 CONNECT-UDP tunnel. NewMasqueConfig configures the hop to the proxy — a private CA via AddCACertsPEM / AddCACertDER, SetUseNativeCerts, SetServerName, tunnel reclamation and, for development only, SetVerify — independently of the client's own trust settings. ClientBuilder.SetMasqueConfig applies it to requests, and SetMasqueTunnelProbe on both pools health-checks MASQUE proxies with a real handshake instead of skipping them. A MASQUE route carries HTTP/3 only and never falls back to a direct connection. This needs a library built with the masque feature, and the bundled libraries are not: with them NewMasqueConfig returns an error saying so and masque:// URLs are rejected.

🐞 Fixes

  • Cookie Header Order Now Matches Chrome — the session jar iterated a hash map, so the order cookies were sent in was arbitrary and differed from one session to the next, which is itself a tell. AddCookieOrder only pinned the names it listed; everything else, including the relative order of same-name cookies at different paths, stayed random. The jar now records creation order and sorts the way Chrome's CookieSorter does — longer paths first, then older cookies first — verified upstream against a Chrome 153 capture fed the same Set-Cookie sequence. AddCookieOrder still takes precedence for the names it lists. Session.GetCookie also now reliably returns the longest-path match, which it previously documented but did not do.
  • HTTP/3 Fallback No Longer Loses the Connection Pool — with HTTP/3 enabled, an origin whose QUIC was unreachable re-established TCP and TLS for every request. The fallback did pool its HTTP/2 connection, but the pool lookup for the HTTP/3-with-fallback mode only ever searched for an HTTP/3 connection and never found it. Nothing failed and nothing was logged — the only symptom was latency, roughly 3× against affected origins, which includes any host advertising Alt-Svc h3 from a network where UDP is blocked. Healthy TCP connections and preconnects are now reused, failed QUIC reservations are released before falling back, and HTTP/3 advertisements from DNS are promoted into protocol selection.
  • Portless HTTP Proxy URLs Now Default to Port 80 — SetProxy("http://proxy.example.com") previously resolved to port 8080, a common proxy port but not the scheme's default. It now resolves to 80, as the URL says. Spell the port out (http://proxy.example.com:8080) if 8080 was what you relied on. https:// proxies are unaffected — 443 either way.
  • Proxy Identity Encoding Changed — the key used for proxy-pool cooldown and failure tracking is now a JSON array of ordered hops, each carrying protocol, host, port and a credential fragment — user:<name> for a username (never the password), an opaque fingerprint for a static HTTP credential — replacing the previous user@host:port and a>b>c chain form. The old encoding could not tell socks5 from socks5h, so two chains resolving hostnames at different hops shared a single cooldown entry. Existing cooldown state does not carry across the change.
  • ProxyPool.MarkBad Is Usable from Go — it takes the proxy's identity, which Go had no way to obtain; the one proxy string Go did expose, the URL, matches nothing, so MarkBad(url) succeeded and did nothing. ProxyConfig.Identity() now returns the key — for a proxy added by URL, ParseProxyConfig(url) and ask it. The mark is recorded asynchronously and takes effect shortly after MarkBad returns.
  • HTTP/3 Responses Using the QPACK Dynamic Table — the HTTP/3 client decoded response headers statelessly, although the Chrome presets advertise a QPACK dynamic table. A server that took up the offer and encoded headers against it failed the request with QPACK_DECOMPRESSION_FAILED. Responses are now decoded against the dynamic table, and the connection honours the QPACK capacity the profile advertises.
  • Replay Safety Across a Protocol Switch — a request that changed protocol mid-flight could be retried even though the earlier attempt may already have reached the server. Retry eligibility is now tracked through the switch, closing the gap left by the replay-safety work in 0.2.0.
  • Streaming Responses Honour HSTS — SendStreaming() skipped the session's HSTS handling: a known HSTS host was not upgraded to https:// on that path, and the response did not update HSTS state. Both now match Send().
  • TCP_NODELAY Is On by Default for Direct Connections — interactive HTTP benefits from disabling Nagle's algorithm, so direct TCP connections now set it unless a fingerprint turns it off explicitly. SetTCPFingerprintJA4T does not encode this field, so there is currently no way to turn it back off from Go.
  • Faster HTTP/2 Request Processing — the native HTTP/2 driver's write path was reworked and the HPACK encoder replaced with an in-house implementation. No API change. The per-header encoding policy that the browser presets depend on (indexed vs literal, Huffman on or off) drives the new encoder unchanged, and upstream's fingerprint goldens and packet-capture baselines were not regenerated, so the wire shape is unchanged.