Skip to content

Releases

lkrequest-go v0.3.0

Choose a tag to compare

@ezxlabs-admin ezxlabs-admin released this 20 Nov 10:45

Updates the bundled lkrequest-ffi native engine to 0.3.0, adds the Chrome 158 preset, and binds
what the engine now offers: custom profiles and complete profile bundles, a response read-idle
timeout and deadlines that can be turned off, control of the TLS session cache, and per-request caps
on connection starts and resends with a JSON summary of a request's attempts. All of it is new API —
the native surface grew by 45 symbols and changed none.

Two upstream changes reach code you have already written: a request whose pooled connection closes
before an answer is no longer sent again, nor does HTTP/2 fall back to HTTP/1.1, unless you enable
it; and the default total timeout grows from 60 to 120 seconds. See Behaviour Changes. On macOS, cgo
builds now load the library embedded in the module on any machine, not only on the one that built it.

🚀 Features

  • Chrome 158 Preset — SetPreset("chrome_158") / NewClient("chrome_158"), captured from Chrome 158.0.8127.37 (Windows, November 2026). Every layer matches Chrome 157, the sorted order of its 28 trust-anchor identifiers included. Header values stay yours to set, so pair it with the Chrome/158 User-Agent and sec-ch-ua that go with it. The default preset remains chrome_155.
  • Custom Profiles and Profile Bundles — ExportPresetJSON(name) writes a built-in preset as a complete profile bundle, a JSON document holding every layer of the preset, HTTP/2 runtime behaviour and protocol policy included, and ClientBuilder.SetPresetJSON / SetPresetFile load one back, edited or not. SetTLSProfileJSON, SetH2ProfileJSON and SetQUICTLSProfileJSON replace a single layer with a native profile in the form FingerprintInfoJSON() reports, taking precedence over the preset or bundle whichever is called first, and ClearQUICFingerprint makes QUIC use the TCP TLS profile. Inputs are limited to 1 MiB and validated; a bundle error is an LkError whose DiagnosticsJSON() carries a preset_error with a stable code, the JSON Pointer path and a message. FingerprintInfoJSON() now reports the QUIC TLS profile as quic_tls.
  • Read-Idle Timeout and Optional Deadlines — ClientBuilder.SetTimeoutReadIdle(ms) limits how long each read of a response body may wait for data, buffered and streaming alike; it is off by default. DisableTimeoutDNS, DisableTimeoutTCPConnect, DisableTimeoutTLSHandshake, DisableTimeoutTTFB, DisableTimeoutTotal, DisableTimeoutQUICConnect and DisableTimeoutReadIdle turn a deadline off — the total one for server-sent events and other long-lived streams, for instance — and calling its setter again turns it back on.
  • TLS Session Cache Control — the TLS and QUIC session cache, on by default, can be turned off with ClientBuilder.SetTLSSessionCacheEnabled(false), after which every new connection makes a full handshake, or given a shorter lifetime with SetTLSSessionCacheTTL(ms), 0 caching nothing. ResetTLSSessionCacheTTL() restores the default lifetimes: one hour for TLS 1.2, up to seven days for TLS 1.3 and QUIC.
  • Attempt Limits and Attempt Summaries — SetConnectAttemptLimit caps the TCP and QUIC connections a request may start, and SetExtraHTTPAttemptLimit how many times it may be sent again while recovering from a failure. Set on a ClientBuilder, SessionBuilder or Request, a limit applies to each request below it; a session or request may only tighten what it inherits, and Build() or Send() reports a looser one as ErrInvalidConfig. ConnectAttemptLimit() and ExtraHTTPAttemptLimit() report the limit configured and in force at each level as an AttemptLimit, and a request over its connect limit fails with ErrResourceLimitExceeded. Request.EnableAttemptSummary(true) has the library record the request's attempts, which AttemptSummaryJSON() on its Response, StreamingResponse or LkError returns as JSON. None of it enables a retry or sets a deadline.

🐞 Fixes

  • cgo Builds on macOS Load the Embedded Library — the darwin library named itself by the absolute path of the directory it had been built in, so a -tags lkcgo binary on macOS looked for the library there and stopped with Library not loaded on any other machine. It now names itself @rpath/liblkrequest_ffi.dylib, cgo builds add lib/darwin_arm64 to the rpath, and the library no longer carries local build paths.
  • HTTP/2 Downloads No Longer Stall — the native HTTP/2 client replenished its receive window from the peer's send window instead of its own, so Firefox-profile downloads stalled after 128 KiB from servers advertising a larger window; WINDOW_UPDATE thresholds are corrected for the other profiles too.
  • TLS Session Resumption and Compatibility — TLS 1.2 sessions resume by session ID as well as by ticket, Safari profiles without the session_ticket extension included; each ticket attempt gets a fresh session ID; TLS 1.2 sessions last one hour by default without extending their original secret; a zero TLS 1.2 ticket lifetime counts as unspecified; and cached sessions are revoked after a fatal TLS error. The three 3DES suites Safari 26 advertises are implemented, an omitted TLS 1.2 CertificateStatus is accepted, P-521 key exchange and signatures are supported, and with verification off, servers signing with an advertised legacy scheme connect again.
  • Request Recovery — a cancelled or completed request can no longer be submitted again through a redirect, a protocol recovery or a TCP/QUIC race, and retries keep the request's original total deadline. A streaming request that loses a TCP race no longer submits through the HTTP/2 connection its rival pooled, nor consumes its single-use upload body. HTTP/3 0-RTT and recovery after rejected early data work again whether connection-close retries are on or not.
  • TLS Alerts and QUIC Diagnostics — a fatal TLS alert a server sends after the handshake, such as certificate_required, now fails an HTTP/1.1 request with ErrTLS instead of a bare connection reset, and does not make it replayable. DiagnosticsJSON() gains quic_ms, the QUIC handshake time, and reports the remote address, cipher and protocol of HTTP/3 requests, those on a pooled connection included.
  • DNS and QUIC Hardening — the bundled Hickory resolver moves to 0.26.3, with a bound on DNS question-count allocation (a 12-byte malformed response allocated 5.5 MiB). QUIC fixes for Initial tokens, MAX_STREAM_DATA limits and truncated datagrams on Unix are backported, and connection IDs are released when local TLS initialization fails.

⚠️ Behaviour Changes

  • Requests Are Not Replayed or Downgraded Unless You Enable It — a request whose pooled connection closed before an answer used to be sent again on a new connection, and HTTP/2 failures could fall back to HTTP/1.1. Both are now off by default, and such a request fails instead. ClientBuilder.SetRetryOnConnectionClose(true) and SetFallbackH2ToH1(true) turn them back on; an idempotent method alone does not. Session retry policies are unchanged, and HTTP/3 0-RTT recovery stays on.
  • The Default Total Timeout Is 120 Seconds — up from 60. A client that relied on the default to give up after a minute now waits two; SetTimeoutTotal(60000) restores the old limit.

lkrequest-go v0.2.5

Choose a tag to compare

@ezxlabs-admin ezxlabs-admin released this 09 Nov 05:48

Updates the bundled lkrequest-ffi native engine, adds the Chrome 156 and
Chrome 157 presets, lets HTTP/1.1 requests send their header names in
lowercase, and negotiates Trust Anchor Identifiers. All of it is new API — the
native surface grew by four symbols and changed none — and none of it changes
anything until you opt in: the default preset stays Chrome 155, HTTP/1.1
header names stay Title-Case, and a client sends the trust anchor identifiers
its preset carries and does nothing more with them.

Four upstream changes do reach code you have already written, all at the TLS
handshake: the default chrome_155 preset sends its trust anchor identifiers
in one sorted order instead of shuffling them, a handshake that fails after
the server listed its trust anchors is no longer retryable, TLS 1.3
Certificate messages are parsed more strictly, and the bundled roots no longer
include the root of the distrusted emSign intermediates. See Behaviour
Changes.

🚀 Features

  • Chrome 156 Preset — SetPreset("chrome_156") / NewClient("chrome_156"), captured from Chrome 156.0.8078.48 (Windows, October 2026). Every layer matches Chrome 155: TCP TLS with its 28 trust-anchor identifiers, HTTP/2, QUIC TLS, QUIC transport parameters, Initial packetization, and HTTP/3 SETTINGS and request priorities; it also keeps Chrome 155's QUIC behaviour. Header values stay yours to set, so pair it with the Chrome/156 User-Agent and sec-ch-ua that go with it. The default preset remains chrome_155.
  • HTTP/1.1 Header-Name Casing — ClientBuilder.SetHTTP1TitleCaseHeaders(false) sends HTTP/1.1 header names in lowercase (content-type) instead of the default Title-Case (Content-Type); Host stays capitalized. It covers every header, default headers and generated ones such as content-length included, on new, reused and preconnected connections, buffered and streaming alike. Header values and request bodies go out unchanged, and in neither mode is the spelling given to AddHeader kept. HTTP/2 and HTTP/3 always send lowercase names, so it changes nothing there.
  • Chrome 157 Preset — SetPreset("chrome_157") / NewClient("chrome_157"), captured from Chrome 157.0.8103.39 (Windows, November 2026). Every layer matches Chrome 156, its 28 trust-anchor identifiers and the one sorted order they go out in included. Header values stay yours to set, so pair it with the Chrome/157 User-Agent and sec-ch-ua that go with it. The default preset remains chrome_155.
  • Trust Anchor Identifiers — Chrome presets advertise the IDs of the roots a client accepts in the TLS trust_anchors extension (draft-ietf-tls-trust-anchor-ids); a client can now negotiate them, over TCP and, with a QUIC/H3-capable library, QUIC. ClientBuilder.SetTrustAnchorPolicy(TrustAnchorPolicy{...}) chooses what to advertise, the preset's list (TrustAnchorAdvertiseProfile, the default) or the sorted IDs of the roots the client trusts (TrustAnchorAdvertiseTrusted), and whether a request may reconnect once (TrustAnchorRecoveryOnce) when its handshake fails after the server listed the roots it can serve, asking then for the first of them the client trusts. AddTrustAnchorBinding(anchorIdentity, id) binds an ID to a root the client trusts, named by TrustAnchorIdentity(certDER); the built-in roots come with theirs. None of it changes which certificates are trusted. Build() reports, as ErrInvalidConfig, what it cannot honour: recovery without certificate verification or together with SetFallbackProxyToDirect, any policy but the default on a preset without the extension (Firefox, Safari) or with synthetic TLS randomization, and a binding to a root the client does not trust. DiagnosticsJSON() of a response or an LkError now carries a trust_anchor object for the TLS connection the request opened: the requested and available IDs, the identity of the root that verified the chain and, after a recovery, the failed first attempt. It is null for a request on a pooled connection.

🐞 Fixes

  • Native Dependency Updates — the native engine moves to rustls-webpki 0.103.16, Tokio 1.53.3 and zstd 0.13.4 (zstd-safe 7.4.0, zstd-sys 2.1.2), which clears the RustSec advisories upstream's audit reported against the versions it used. No API change; the bundled roots, updated along with them, are covered under Behaviour Changes.

⚠️ Behaviour Changes

  • Chrome 155 Sends Its Trust Anchor Identifiers in One Sorted Order — visible on the wire, and chrome_155 is the default preset. Its 28 trust-anchor identifiers used to go out shuffled anew for every ClientHello; they now go out, over TCP and QUIC, in the one sorted order Chrome 155 itself sends them in, as its source and captures show. The identifiers themselves are unchanged, the ClientHello's extensions are still permuted for every handshake, and chrome_152 to chrome_154 keep shuffling theirs.
  • Handshake Failures After a Server Lists Its Trust Anchors Are Not Retried — when a server answers the trust_anchors extension with the identifiers it can serve and the handshake then fails, LkError.IsRetryable() is now false and automatic retries stop, whether recovery is on or not, unless ECH was rejected. Error codes and messages are unchanged, and servers that do not negotiate trust anchors are not affected.
  • Stricter TLS 1.3 Certificate Handling — a server Certificate message with trailing bytes, a zero-length certificate, or a certificate entry whose extensions are missing, truncated or repeated now fails the handshake, as does an empty or malformed list of trust anchors in its EncryptedExtensions, which used to be ignored. A certificate that both names another host and chains to no trusted root is now reported for the name rather than the chain.
  • The Root of the Distrusted emSign Intermediates Is No Longer Bundled — the bundled Mozilla roots move to webpki-roots 1.0.10, which drops emSign ECC Root CA - G3, so a chain through the emSign intermediates under it no longer verifies against the bundled roots. To keep trusting it, add it yourself with AddCACertFile / AddCACertMemory, or use SetUseNativeCerts(true) on a system that still trusts it.

lkrequest-go v0.2.4

Choose a tag to compare

@ezxlabs-admin ezxlabs-admin released this 19 Oct 04:54

Updates the bundled lkrequest-ffi native engine, adds the Chrome 155 preset
and makes it the default, reads session cookies with their attributes, and lets
a request set its HTTP/2 priority weight. Every addition is new API — the native
surface grew by three symbols and changed none — so every existing call shape
keeps working.

Most fixes reach code you have already written: a site that advertises HTTP/3
on a network that drops UDP no longer fails every request, a redirect to
another origin no longer carries the client's default Authorization along,
and HTTP/2 requests that were given up on are reset instead of holding their
stream open. Three entries change behaviour you may be relying on and are worth
reading before upgrading: the default preset, the HTTP/2 frames of the Chrome
and Firefox 156 presets, and proxy pools, which now wait for a proxy instead of
handing out a direct connection.

🚀 Features

  • Chrome 155 Preset — SetPreset("chrome_155") / NewClient("chrome_155"), captured from Chrome 155.0.8059.40 (Windows, October 2026). Every layer keeps Chrome 154's shape: TCP TLS with its 28 trust-anchor identifiers, HTTP/2, QUIC TLS, QUIC transport parameters, Initial packetization and HTTP/3 SETTINGS — the last now observed directly on a successful HTTP/3 response rather than inherited. What sets it apart is how its QUIC connections behave once established: it adopts Chrome 155's HTTP/3 request handling, including a PRIORITY_UPDATE sent for each request stream before its HEADERS, and its loss-recovery and packetization timing.
  • Cookie Attributes — Session.GetCookiesWithAttrs(url) and Session.GetAllCookies() return []CookieInfo: name and value together with Domain, HostOnly, Path, Secure, HTTPOnly, SameSite and ExpiresUnix (nil for a session cookie; IsPersistent() says which). GetCookies returns name/value pairs, so two cookies sharing a name at different paths came back as two indistinguishable entries; here Path tells them apart, longest path first. GetCookiesWithAttrs is scoped to a URL like GetCookies; GetAllCookies spans every domain, oldest first, and is the view to persist or hand to a browser automation context. Reading only — SetCookieWithAttrs still cannot set SameSite or an expiry. Cookie is unchanged.
  • Per-Request HTTP/2 Priority Weight — Request.SetH2PriorityWeight(weight) sets the weight in the legacy priority field of the request's HTTP/2 HEADERS frame as it goes on the wire: 0–255, one less than the 1–256 weight it encodes. It is for a request a browser weighs differently from what the preset sends by default. It applies whether the request opens a connection or reuses one, buffered or streaming; it leaves the priority header, the stream dependency and the exclusive flag alone; and it holds for that request only, though Clone() carries it over. A preset whose HEADERS carry no legacy priority field still sends none, and HTTP/1.1 and HTTP/3 ignore it.

🐞 Fixes

  • Cookie Calls on a Shared Session — the library hands cookie readers a buffer it frees as soon as a cookie is set, removed or cleared, or the same query runs again. GetCookie and GetCookies / GetCookiesJSON copied that buffer without synchronizing with those calls, so on a Session shared across goroutines — which is documented as safe — a read racing a write could return a corrupted value instead of the cookie. Cookie reads and writes on one Session are now serialized; a Clone() has its own buffers and is not affected by its original.
  • Arguments Read From a Moved Goroutine Stack — strings shorter than 32 bytes (URLs, header and cookie names and values, preset names, ...), and small byte slices or arrays handed to the library, could be left on the calling goroutine's stack and passed by address. Go moves a stack when it grows or when the GC shrinks it, so the library could read the old, freed stack instead of the argument. With the default purego engine the call then failed or, worse, succeeded on the wrong value — a cookie stored under a corrupted name, for instance; with lkcgo the process aborted with fatal error: found bad pointer in Go heap. It took a stack move inside a narrow window, so it showed up mostly under heavy concurrency and GC load, but nothing ruled it out. Every buffer passed to the library is now heap allocated, where it does not move.
  • A QUIC Handshake That Times Out Falls Back to TCP — once a site had advertised HTTP/3 through Alt-Svc, a request on a network that silently drops UDP waited out the QUIC handshake timeout and then failed with it, instead of falling back to TCP as it does when the handshake fails any other way — and every request after it did the same. Buffered and streaming requests now fall back to HTTP/2 or HTTP/1.1.
  • Redirects No Longer Carry Default Credentials to Another Origin — headers added with ClientBuilder.AddDefaultHeader were applied again on every hop of a redirect chain, so a default Authorization, Cookie or Host went along to the destination of a redirect to another origin, although the same headers set on the request itself were dropped there. Defaults are now filtered hop by hop the way a request's own headers are: a redirect that leaves the origin (scheme, host or port) drops a default Authorization, Cookie and Host; one from https to http drops a default Referer; one that turns a POST into a GET drops the default Content-Type, Content-Encoding, Content-Language, Content-Location and Content-Length. The client's defaults are untouched for the next request.
  • A Location in Raw UTF-8 Is Followed — a redirect whose Location held raw UTF-8 bytes (/café) was reported as missing its Location and failed. The value is now decoded, resolved against the current URL and percent-encoded on the way out, as a percent-encoded one is; one that is not valid UTF-8 is an error that says so.
  • An Empty Max-Age in Set-Cookie Is Ignored — Set-Cookie: sid=abc; Max-Age= was read as a Max-Age too large to represent, so the cookie was kept until the year 9999 instead of as a session cookie; and because Max-Age outranks Expires, a response that deleted a cookie with Max-Age=; Expires=<a past date> left it in place. An empty Max-Age now counts as absent, and a valid one given before it still applies.
  • Truncated and Look-Alike deflate Bodies — a deflate body that ended before its stream did came back shorter without an error, buffered or streaming; it is now an error. A raw deflate stream, which some servers send in place of the zlib format the name stands for, was rejected as corrupt when its first bytes happened to read as a zlib header; it is now accepted.
  • Abandoned HTTP/2 Requests Are Reset — a request given up on after it was sent — a timeout, a cancelled context, a streaming response closed early — was never reset with RST_STREAM, so its stream stayed open on the server for as long as the connection lived. On a shared Session that could use up the server's concurrent-stream limit, after which further requests queued without being sent and timed out. Such a request is now reset with CANCEL and its stream freed. HTTP/1.1 was not affected.
  • Requests the Server Never Processed Are Replayed — a request that an HTTP/2 GOAWAY cut off before any response headers arrived, or that HTTP/3 refused with H3_REQUEST_REJECTED before them, never reached the server's processing, and is now treated as safe to replay automatically.
  • Reused HTTP/1.1 Connections Reset by the Server — a request sent on a pooled HTTP/1.1 connection that the server had reset failed with an HTTP error, so SetRetryOnConnectionClose, which is on by default, did not apply. The reset now counts as the connection closing: a request that is safe to replay is retried on a new connection, and a POST still fails.
  • SetTimeoutDNS Bounds Every Lookup — the DNS timeout is now a deadline for each query the client makes, address and HTTPS-record lookups alike, through the built-in resolver ahead of its own retries or through a SetDNSResolver callback. A request that runs into it fails as a timeout in the DNS phase.
  • The First Request on a New HTTP/2 Connection Gets Its Priority — the request that opens a connection now resolves its priority from the same request and client headers, and the same fetch-destination rules, as a request on a reused connection, so a navigation keeps its navigation priority on a fresh connection too.
  • A Proxy's Refusal After the Authentication Retry Keeps Its Status — when a proxy answered CONNECT with 407 and then refused the retry that carried credentials, the error always said authentication had failed, even for a 503. A second 407 is still reported that way; any other status is now reported as the tunnel being refused, with that status.
  • TLS, ECH and QUIC Handshake Corrections — a broad upstream pass over handshake behaviour, much of it visible on the wire. The client now refuses, with the alert Chromium or NSS sends, a server hello a browser would refuse — a version, cipher suite, compression method or ALPN protocol it never offered, a malformed or padded extension, a wrong session-ID echo, a fallback to TLS 1.2 after a HelloRetryRequest — before deriving any key. A TLS 1.3 handshake queues its compatibility ChangeCipherSpec until the client's final flight, as Chromium and NSS do. After a HelloRetryRequest the client drops pre-shared keys whose hash no longer matches, keeps the first ClientHello's trust-anchor order, and carries the cookie into a real ECH handshake's inner ClientHello. ECH rejection is handled across HelloRetryRequest and TLS 1.2, and over QUIC as CRYPTO_ERROR(ech_required). ECH GREASE is generated as each browser generates it: an X25519 key pair for the enc field on Chromium, and Firefox's per-handshake choice between AES-128-GCM and ChaCha20-Poly1305.

⚠️ Behaviour Chang...

Read more

lkrequest-go v0.2.3

Choose a tag to compare

@ezxlabs-admin ezxlabs-admin released this 25 Sep 14:17

Moves the module to the renamed GitHub organization. The API and the bundled
lkrequest-ffi native engine are unchanged from 0.2.2; the import path is the
only thing to update.

⚠️ Breaking Changes

  • New Module Path — the module is now github.com/EZXLabs/lkrequest-go. Replace github.com/EZ-XLabs/lkrequest-go/lkrequest with github.com/EZXLabs/lkrequest-go/lkrequest in your imports and go get github.com/EZXLabs/lkrequest-go/lkrequest@v0.2.3. Versions up to 0.2.2 declare the old path and can only be fetched under it; requesting them under the new one fails with module declares its path as: github.com/EZ-XLabs/lkrequest-go. From 0.2.3 on, only the new path works.

lkrequest-go v0.2.2

Choose a tag to compare

@ezxlabs-admin ezxlabs-admin released this 25 Sep 13:53

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.

lkrequest-go v0.2.1

Choose a tag to compare

@ezxlabs-admin ezxlabs-admin released this 04 Sep 05:15

🚀 Features

  • macOS / Apple Silicon Support — darwin/arm64 now ships with an embedded library, so go get builds and runs on Apple Silicon without any manual setup. Earlier releases carried the darwin/arm64 embed declaration without the matching library, which made the package fail to compile on macOS with pattern lib/darwin_arm64/liblkrequest_ffi.dylib: no matching files found. The bundled macOS engine is built with synthetic-fp and quic-h3, like the Linux and Windows libraries, so fingerprint randomization and HTTP/3 are available there too.
  • Chrome 152 Preset — SetPreset("chrome_152") / NewClient("chrome_152"), captured from Chrome 152.0.7977.65 (Windows, August 2026). TCP TLS prepends an independently randomized GREASE code point to signature_algorithms ahead of the ML-DSA entries, and adds Chromium/BoringSSL's trust-anchor identifiers extension (0xca34) with its order reshuffled per ClientHello. HTTP/2 keeps Chrome 151's SETTINGS, connection window, pseudo-header order and priority shape. QUIC keeps the Chrome 151 signature and transport baseline minus the google_initial_rtt transport parameter (0x3127), which Chrome no longer sends; H3 SETTINGS retain the latest verified Chrome baseline because the capture did not establish a complete H3 exchange.
  • Chrome-Accurate HTTP/2 DATA Framing — Chrome presets now cap each outbound DATA payload at 16375 bytes, so the 9-byte frame header plus payload land in a single 16 KiB socket write the way Chromium does. Request bodies larger than that are split across more DATA frames than before; this is a fingerprint-fidelity improvement and needs no code change.

🐞 Fixes

  • Multipart Boundary No Longer Names the Library — the boundary was built as ----lkrequest{hex}, putting the crate name in the Content-Type of every upload, where a single server-side regex identified it whatever the TLS and HTTP/2 fingerprints said. It now matches what a real Chrome emits: ----WebKitFormBoundary followed by exactly 16 alphanumerics, drawn by rejection sampling so the character distribution is uniform. This changes the bytes on the wire — tests that pin the boundary or the exact request body need updating.
  • Multipart Field Names and Filenames Are Escaped — Multipart.AddText / AddFile interpolated caller-supplied names into Content-Disposition verbatim, so a name containing CR or LF could terminate the header line and append part headers, start an extra part, or forge the boundary. " now becomes %22, CR and LF become %0D and %0A, and a CR or LF in a part's content type is rejected outright since that header has no quoted form to escape into.
  • Sessions Are No Longer Capped at 64 Connections by Default — the implicit ceiling made unrelated high-concurrency workloads fail with session connection limit reached. The default is now unbounded; ClientBuilder.SetMaxConnectionsPerSession and SessionBuilder.SetMaxConnections still impose a hard budget when set. This revises the strict-enforcement note from 0.2.0: enforcement is unchanged, only the default ceiling is gone.
  • 304 Not Modified Is No Longer Treated as a Redirect — every 3xx was classified as a redirect, so a conditional request answered with 304 (and likewise 300 / 305 / 306) reached the Location lookup and failed with redirect response missing Location header. Only 301 / 302 / 303 / 307 / 308 are followed now; the rest are returned to the caller as-is.
  • Redirects Rewrite the Method Only Where the Spec Says To — 301, 302 and 303 unconditionally became GET, so a HEAD request came back as a GET, which Chrome does not do. 303 still rewrites everything except HEAD.
  • Multi-Layer Content-Encoding Is Decoded — only the outermost coding was handled, so gzip, br was returned still compressed under a header claiming otherwise. Codings are applied in reverse order now, on both Send() and SendStreaming().
  • Content-Encoding: deflate Accepts the zlib Form — only a bare raw-deflate stream was decodable, so servers sending the zlib-wrapped form the spec actually defines failed outright. Both the buffered and streaming paths sniff the header and pick the matching decoder.
  • Status-Code Retries Are Gated on Replay Safety — the error-retry path checked replay safety, the status path checked nothing, so a POST answered with 502 was sent twice. A non-idempotent method is now replayed only on a status that says it was not applied (429, 503); 502, 504 and the Cloudflare 520–530 range are ambiguous about whether the origin already processed the request and are returned to the caller instead. Safe methods are unaffected.
  • HTTP/2 Graceful Shutdown — a GOAWAY carrying NO_ERROR (which Google and Cloudflare send routinely for connection turnover) set no connection error, while the draining check keyed off "has error", so the driver kept opening streams the peer had already promised to refuse. Draining is keyed off GOAWAY receipt itself now, and queued requests fail over to a fresh connection.
  • HTTP/2 Responses Are Validated Rather Than Quietly Repaired — a content-length disagreeing with the DATA actually delivered was accepted (a response-length desync), unparseable headers were dropped, and a missing or malformed :status became 500. Connection-specific fields are now rejected, pseudo-header rules enforced, DATA held to the same standard as HEADERS, and a malformed response resets the stream instead of leaving the peer sending DATA on a stream already torn down.
  • HTTP/2 Connection State Machine — frames could be interleaved into a CONTINUATION sequence, HEADERS-path stream-state checks were weaker than the DATA path's, and an INITIAL_WINDOW_SIZE overflow mapped to the wrong error code. Fixing the DATA path also closed a connection-window leak where a frame on a stream that could not receive consumed window that was never replenished.
  • TLS Post-Handshake Message Reassembly — each record was treated as exactly one message, so a KeyUpdate sharing a record with a NewSessionTicket was silently dropped: read keys were never rotated and every subsequent record failed to decrypt. Coalesced tickets past the first were lost the same way. Decrypted bytes are buffered and only complete messages dispatched now.
  • The Handshake Fails on Server Choices the Client Never Offered — a TLS 1.2 named_curve, a ServerKeyExchange signature algorithm, or a TLS 1.3 CertificateVerify scheme was checked only against what the implementation supports, never against what the ClientHello advertised. Duplicate-extension detection also ran only on the HelloRetryRequest branch, and unsolicited TLS 1.2 extensions had no "did we offer this?" check at all.
  • TLS Record Layer Hardened and Session-Ticket Trust Bounded — plaintext handshake and alert records were still accepted after handshake keys were installed, an unknown record content type was silently skipped, TLS 1.2 resumption neither recorded nor checked Extended Master Secret state, and ticket lifetimes were unbounded (now capped at seven days).
  • The Peer's record_size_limit Is Honoured When Sending — the extension was advertised but never applied, so a peer that asked for smaller records got 16384-byte ones anyway.
  • A TLS 1.2 HelloRequest Is Refused With a Fatal Alert — it was dropped silently, which no browser does, leaving a behavioural probe for any server willing to send one. It now sends a fatal no_renegotiation and aborts, matching BoringSSL. Behaviour change: such a connection now ends in an error where it previously carried on.
  • A Connection Ending Without close_notify Is Distinguishable — the read loop now stops at close_notify rather than polling on, because anything arriving after it did not come from the peer, and those bytes were being appended to the response body.
  • ECH Rejection Aborts Instead of Returning an Unprotected Connection — when a server did not accept Encrypted ClientHello, the library logged it and carried on, handing back a connection whose true server name had never been protected, so the request ECH existed to hide went out in the clear. Both the TCP and QUIC paths now abort before any traffic keys exist, and the session redials once with the retry_configs the server supplied, as a browser does. Retrying without ECH is deliberately not a fallback. GREASE ECH is unaffected.
  • Alternative Services No Longer Supply the TLS Identity — an Alt-Svc entry or HTTPS RR names where to send packets, but the endpoint must still prove it may serve the origin. The advertised host was used as the SNI and certificate name, so the alternative authenticated as itself, and conforming deployments failed outright because an HTTPS RR target is typically a CDN's internal name serving the origin's certificate. The dial target still follows the advertisement.
  • Alternative-Service Parsing — the bracketed IPv6 authority form was stripped at parse time while URL host lookups keep it, so a bare 2001:db8::1 reached the dialer unusable; persist=1 is now parsed; h3=":0" no longer produces an alt-authority on a reserved port; and draft advertisements such as h3-29 are ignored, matching Chrome 140+.
  • DNS HTTPS/SVCB Records Are Read as Records — fields from same-priority records were merged together, producing endpoint descriptions no server ever published. AliasMode is followed now (with loop detection and a hop cap), and mandatory and no-default-alpn are honoured instead of silently dropped, so a client no longer connects with a protocol the endpoint declared it does not speak.
  • HTTPS-RR Discovery Issues One Query per Request Instead of Two — protocol discovery and the handshake's automatic ECH configuration each ran their own lookup. Beyond the extra round trip, the two answers could disagree, leaving the ECH config out of ...
Read more

lkrequest-go v0.2.0

Choose a tag to compare

@ezxlabs-admin ezxlabs-admin released this 18 Aug 02:34

Updates the bundled lkrequest-ffi native engine with upstream stability,
interoperability, and security fixes, and adds a Go-side convenience layer over
the existing FFI surface. The native changes need the matching FFI libraries
for this release; the Go API additions introduce no new native symbols. All
existing call shapes keep working.

🚀 Features

  • HTTP Verb Helpers — Session and SessionPoolGuard gain Get / Post / Put / Delete / Head / Patch / Options, plus a generic Request(method, url) for methods without a helper. They return *Request rather than (*Request, error), so a construction failure travels with the request and is reported by Send() instead of needing its own error check: session.Get(url).AddHeader(...).Send(). NewRequest(session, method, url) is unchanged for callers that want the error up front.
  • JSON Body Marshalling — Request.SetJSON(v any) encodes a Go value with encoding/json, alongside SetJSONBody which still takes a pre-encoded document. Clone() replays the encoded form rather than re-marshalling the original value.
  • Aggregate Response Views — Response.Cookies() and Response.Redirects() return slices, matching how Headers() already relates to HeaderAt(). The indexed accessors (CookieAt, RedirectAt, ...) are unchanged.
  • Structured Cookie Jar Access — Session.GetCookies(url) decodes what GetCookiesJSON(url) reports raw.
  • New Types — Cookie and Redirect. Cookie is deliberately not net/http.Cookie: the FFI layer reports name and value only, so the remaining attribute fields would read as "not set" rather than "not available".
  • Chrome 151 Preset — SetPreset("chrome_151") / NewClient("chrome_151"), captured from Chrome 151.0.7922.72 (Windows, July 2026). TCP TLS/H2 stable fields match Chrome 150; the QUIC layer removes the three ML-DSA signature algorithms while keeping the classic list plus rsa_pkcs1_sha1, with QUIC transport parameters and H3 SETTINGS carried over from Chrome 150.
  • Dedicated Chrome 150 QUIC / HTTP/3 Preset — Chrome 150 now uses dedicated QUIC-TLS and H3 profiles instead of reusing Chrome 146. The preset covers its captured signature algorithms, QUIC transport parameters, QPACK limits, navigation PRIORITY_UPDATE, connection ID lengths, and Initial datagram sizing.

🐞 Fixes

  • HTTP/2 Interim Responses — The native HTTP/2 driver now consumes 1xx informational responses (e.g. 103 Early Hints, which Cloudflare sends ahead of its final response) and returns the subsequent final response. Response.StatusCode() no longer reports 103 as the final status for such origins.
  • HTTP/2 Stream-Limit Backpressure — Requests exceeding the peer's SETTINGS_MAX_CONCURRENT_STREAMS (commonly 100–128) now wait asynchronously for a free stream slot instead of failing locally with a MAX_CONCURRENT_STREAMS exceeded protocol error. Queued requests remain bounded by the total timeout (SetTimeoutTotal).
  • Multi-Address DNS Fallback — Connections now try every resolved address (interleaved by family, RFC 8305-style) instead of only the first one, fixing dual-stack hostnames on hosts without a working IPv6 route. Applies to direct TCP and to socks5:// local resolution, which reconnects and re-authenticates per candidate on retryable replies; socks5h:// behaviour is unchanged. SetTimeoutTCPConnect still bounds all attempts together.
  • DNS Lookup Coalescing — Concurrent system-DNS lookups for the same host are merged into a single resolver call instead of issuing duplicate queries.
  • TLS Optional Client Certificates — Servers requesting an optional client certificate no longer fail the handshake when no certificate is configured.
  • HTTP/1 Redirect Reconnect — A redirect canceled on a reused pooled connection now reconnects and completes instead of failing the request.
  • Session Connection Quota — SessionBuilder.SetMaxConnections is enforced strictly: background QUIC probes also take a connection permit, and exceeding the cap surfaces session connection limit reached instead of silently overshooting the limit.
  • Linux glibc Baseline — The Linux native library is built against glibc ≤ 2.36 again. Interim builds silently required GLIBC_2.38 and failed to dlopen on Debian 12 / Ubuntu 22.04; upstream CI now pins the build image and asserts the baseline.
  • TLS 1.3 ECH + HelloRetryRequest Parity — Real ECH retries now reuse the ECH configuration, HPKE sender context, inner random, GREASE values, and extension permutation. HRR confirmation, selected groups, cookie-only retries, dummy CCS, invalid extensions, and local fatal alerts now follow the expected browser and RFC flow.
  • ECH + PSK + HRR Binders — Pre-shared keys remain confined to ClientHelloInner, with binders calculated from the correct CH1 and CH2 transcripts. Resumed real-ECH handshakes no longer abort through the previous unsupported path.
  • QUIC/H3 HRR State Transitions — QUIC now revokes 0-RTT stream and packet state immediately after HRR, maps local TLS alerts to QUIC CRYPTO_ERROR codes, and completes forced P-384 retries through the H3 handshake flow.
  • TLS Handshake Record Reassembly — TLS 1.2 and TLS 1.3 handshake messages fragmented across multiple records are now buffered until complete, fixing failures such as truncated handshake message in record on large certificate flights. ClientHello bytes and observable JA3 / JA4 fingerprints are unchanged.
  • ECH and DNS-Leak Hardening — Corrects the real-ECH transcript, prevents HTTPS/SVCB discovery from bypassing remote DNS on socks5h and CONNECT routes, and restricts ALPS use to applicable protocol paths.
  • ALPS Fingerprint Correctness — Decouples ALPS advertisement from the client-settings payload, matching Chrome behavior when ALPS is advertised with an empty payload.
  • HTTP/2 Frame Bounds — Validates inbound frame sizes against the client's advertised MAX_FRAME_SIZE instead of trusting the peer's setting.
  • Certificate Parsing Safety — Malformed certificate DER lengths now return a TLS error instead of triggering an out-of-bounds panic.
  • Retry Replay Safety — Automatic retries no longer resend non-idempotent requests after ambiguous post-send failures; retries remain allowed when the request is known not to have been processed.
  • Redirect Semantics — The total timeout now spans the complete redirect chain, 303 See Other is followed as GET, and sensitive/body-specific headers are stripped according to redirect origin and method changes.
  • SOCKS5 UDP Compatibility — QUIC-over-SOCKS5 accepts relay replies from the advertised relay IP even when the source port differs from BND.PORT, improving compatibility with relays using separate egress sockets or load balancers.
  • Synthetic Fingerprint Negotiability — Libraries built with synthetic-fp enforce a signature-algorithm floor so recombined fingerprints remain capable of completing a TLS handshake.

lkrequest-go v0.1.0

Choose a tag to compare

@ezxlabs-admin ezxlabs-admin released this 12 Aug 11:02

🚀 Features

  • TLS Fingerprint Control — Byte-level ClientHello matching real browsers, via named presets
  • HTTP/2 Fingerprint Control — SETTINGS frame order, pseudo-header order, WINDOW_UPDATE, PRIORITY frames
  • HTTP/3 + QUIC — Feature-gated (FeatureSupported("quic-h3")): HTTP/3 over QUIC with fingerprint-aware Transport Parameters, Alt-Svc auto-discovery, and H2→H3 upgrade; per-request protocol preference (SetPreferredHTTPVersion) and negotiated version (Response.NegotiatedVersion)
  • Built-in Browser Presets — Chrome 131/144/145/146/147/148/149/150, Firefox 133/147, Safari 18/26
  • Fingerprint Randomization — Per-connection TLS extension-order jitter (drifts JA3, stays a real browser); synthetic cross-layer identities with a synthetic-fp library (ClientBuilder.SetRandomize)
  • Custom TCP Fingerprint — JA4T-style TCP fingerprinting (SetTCPFingerprintJA4T)
  • Header / Cookie Order — Send order configurable at client / session / request levels (AddHeaderOrder / AddH3HeaderOrder / AddCookieOrder)
  • Dual Binding Engine — purego (default, no C compiler, embedded library) and cgo (lkcgo build tag, static link)
  • Session Management — Cookie jar, connection pooling, HTTP/2 multiplexing, redirect and retry policy
  • Retry Policies — Fixed interval / exponential backoff (with jitter)
  • Proxy Support — SOCKS5 and HTTP CONNECT; per-session and per-request overrides
  • Proxy Pool & Session Pool — Rotation (round-robin / random), health checks, and bad-proxy marking
  • Custom DNS Resolver — Built-in DoH (Google / Cloudflare / Quad9) or a pluggable resolver with HTTPS/SVCB lookup
  • SOCKS5 UDP Relay Probing — Detect UDP ASSOCIATE support for QUIC-over-SOCKS5 (Client.Socks5UDPProbe)
  • Connection Prewarming — Preconnect / PreconnectAsync to pre-establish DNS + TCP + TLS
  • Streaming Responses — StreamingResponse implements io.ReadCloser
  • Multipart / Form-Data — Text and file uploads
  • Authentication — Bearer token and basic auth
  • Auto-Decompression — gzip / br / deflate / zstd, controllable via AcceptEncoding
  • Certificate Management — Custom CA, verify toggle, native certs, ECH, and TLS keylog
  • Context Support — Cancelable (SendWithContext) and async (SendAsync, channel-based) sends
  • Request Diagnostics — Per-phase timings (DNS / TCP / TLS / TTFB) via DiagnosticsJSON
  • Typed Errors — Error code, phase, retryable flag, and diagnostics on LkError