Skip to content

feat(client)!: connect over TCP and TLS - #19

Open
noahjoeris wants to merge 4 commits into
bitcoindevkit:masterfrom
noahjoeris:feat/transport-address-types
Open

feat(client)!: connect over TCP and TLS#19
noahjoeris wants to merge 4 commits into
bitcoindevkit:masterfrom
noahjoeris:feat/transport-address-types

Conversation

@noahjoeris

@noahjoeris noahjoeris commented Aug 20, 2026

Copy link
Copy Markdown

Description

Partially addresses #9

Adds built-in TCP and TLS connection support for async and blocking clients, plus a scheme-based connect facade supporting tcp:// and ssl://.

Breaking: Raises MSRV from 1.70 to 1.71, required by rustls 0.23.

use electrum_streaming_client::{AsyncClient, ConnectConfig};

let (client, events, worker) =
    AsyncClient::connect("tcp://electrum.blockstream.info:50001", &ConnectConfig::default()).await?;

Notes to reviewers

  • The blocking client uses separate reader and writer threads. rustls StreamOwned cannot be split into independent halves, so transport/tls.rs provides a split-capable adapter sharing the rustls state.
  • Tested async and blocking TCP/TLS manually.
  • SOCKS5 support will follow in a separate PR.

Changelog notice

- Breaking: Raise MSRV to 1.71.
- Added: Plaintext TCP and TLS (`ssl` feature) connections for async and blocking clients.
- Added: `AsyncClient::connect` and `BlockingClient::connect`, dispatching `tcp://` / `ssl://` URL strings.

rustls 0.23 requires 1.71. This is crate-wide, so the following TLS
feature is a breaking change for 1.70 toolchains.
Keep hostnames unresolved for later TLS/SNI, and give blocking/tokio
clients a connect-only TCP constructor. Dropping the blocking client
shuts the TCP socket down so the read thread unblocks.
Optional `ssl` feature using rustls 0.23. Blocking and tokio clients
get `connect_ssl`. Flush JSON-RPC writes so TLS buffers are pushed.
@noahjoeris
noahjoeris force-pushed the feat/transport-address-types branch from fc9d02c to be23078 Compare August 26, 2026 10:24
@noahjoeris noahjoeris changed the title feat: client connect over tcp and tls feat(client)!: connect over TCP and TLS Aug 26, 2026
@noahjoeris
noahjoeris marked this pull request as ready for review August 26, 2026 10:42
@noahjoeris noahjoeris self-assigned this Aug 26, 2026
Dispatch `tcp://` / `ssl://` URL strings to the TCP or TLS constructors
for async and blocking clients. A missing scheme defaults to TCP.
@noahjoeris
noahjoeris force-pushed the feat/transport-address-types branch from be23078 to 4159049 Compare August 26, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant