From d42ce531c608bc6f0fe8b58912f06892710887d8 Mon Sep 17 00:00:00 2001 From: sentriz Date: Tue, 17 Feb 2026 15:36:20 +0000 Subject: [PATCH] fix(listenbrainz): disable post-quantum TLS to avoid connection reset errors listenbrainz's server can't handle the larger TLS ClientHello from Go's post-quantum key exchange (Kyber). Explicitly set classic curve preferences to avoid "connection reset by peer" errors. https://github.com/golang/go/issues/70139 --- listenbrainz/listenbrainz.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/listenbrainz/listenbrainz.go b/listenbrainz/listenbrainz.go index 1bd5082..81453de 100644 --- a/listenbrainz/listenbrainz.go +++ b/listenbrainz/listenbrainz.go @@ -2,6 +2,7 @@ package listenbrainz import ( "bytes" + "crypto/tls" "encoding/json" "errors" "fmt" @@ -30,11 +31,15 @@ type Client struct { } func NewClient() *Client { - // disable keep-alive to avoid "connection reset by peer" errors caused by a race between - // the server closing idle connections and the client reusing them for new requests + // disable post-quantum key exchange (Kyber) to avoid "connection reset by peer" errors. + // listenbrainz's server can't handle the larger TLS ClientHello + // https://github.com/golang/go/issues/70139 return NewClientCustom(&http.Client{ Transport: &http.Transport{ - DisableKeepAlives: true, + TLSClientConfig: &tls.Config{ + MinVersion: tls.VersionTLS12, + CurvePreferences: []tls.CurveID{tls.X25519, tls.CurveP256, tls.CurveP384}, + }, }, }) }