From 319bb7fa2c984da45422fa81d12b4a5226beb493 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Wed, 25 Feb 2026 11:21:45 +0000 Subject: fix IPv6 connection failures with Happy Eyeballs (RFC 8305) Implement a custom WebSocketTransport that races IPv6 and IPv4 connections with a 250ms head start for IPv6, matching browser behavior. This prevents broken IPv6 from blocking all relay connections indefinitely. This is a temporary fix until the upstream async-wsocket PR is merged: https://github.com/shadowylab/async-wsocket/pull/42 --- src/lib/client.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/lib/client.rs') diff --git a/src/lib/client.rs b/src/lib/client.rs index 32c2d37..2a4e081 100644 --- a/src/lib/client.rs +++ b/src/lib/client.rs @@ -63,6 +63,9 @@ use crate::{ login::{get_likely_logged_in_user, user::get_user_ref_from_cache}, repo_ref::{RepoRef, normalize_grasp_server_url}, repo_state::RepoState, + // TEMPORARY: Remove when async-wsocket includes Happy Eyeballs support. + // See src/lib/transport.rs header for full removal instructions. + transport::HappyEyeballsTransport, }; pub fn is_verbose() -> bool { @@ -206,6 +209,7 @@ impl Connect for Client { .verify_subscriptions(true), ) .signer(keys) + .websocket_transport(HappyEyeballsTransport) // TEMPORARY: see transport.rs .build() } else { nostr_sdk::ClientBuilder::new() @@ -214,6 +218,7 @@ impl Connect for Client { .relay_limits(RelayLimits::disable()) .verify_subscriptions(true), ) + .websocket_transport(HappyEyeballsTransport) // TEMPORARY: see transport.rs .build() }, relay_default_set: opts.relay_default_set, -- cgit v1.2.3