pusher: optional IPv6 preference for welist reports + log report failures #1
Reference in New Issue
Block a user
Delete Branch "SAFE21.io/bal-server:fix/pusher-welist-ipv6-preference"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
welist.bitcoin-after.lifepublishes both A (IPv4) and AAAA (IPv6) records. On some networks (observed on an Umbrel OS host behind a residential ISP) the IPv4 route to the welist host is broken: the TCP handshake completes, but the connection stalls before any TLS data, while IPv6 works fine. The default connector picks the broken family and the report request hangs until it errors.To make things worse, the failure is invisible:
main_resultcallslet _ = send_stats_report(...), silently discarding any error, so a failing welist report can go unnoticed indefinitely.Changes
BAL_PUSHER_PREFER_IPV6, default off): when truthy, the pusher resolves the welist host itself and pins the reqwest client to its first AAAA address. The original hostname is still used for theHostheader and TLS SNI. When the variable is unset — the default — or no AAAA record exists, behavior is completely unchanged.send_stats_report/calculate_statserrors are now logged withwarn!instead of being silently discarded, so connectivity problems are diagnosable from the logs.Backward compatibility
Default behavior is unchanged; IPv6 pinning only activates when explicitly opted in via the new env var.
Testing
cargo fmt -- --check: cleancargo test: all tests pass, including 5 new unit tests for the URL host/port parsingcargo clippy: no new warnings introduced (the only warnings present are pre-existing in the current codebase)we.safe21.io): with IPv6 pinning, welist reports succeed every block (Report to welist(...) Sent: "ok")Possible follow-up
A full happy-eyeballs approach (probe both families concurrently, use whichever connects first) would make this automatic without an env var. It was intentionally left out of scope to keep this change minimal and zero-risk.
Contributed by SAFE21.io (Will-Executor operator,
we.safe21.io).