Skip to content

Make connect_tls_psk_tunnel and connect_tls_psk_tunnel_native generic#99

Merged
jkcoxson merged 1 commit into
jkcoxson:masterfrom
maxslarsson:generic-tls-psk-tunnel
May 8, 2026
Merged

Make connect_tls_psk_tunnel and connect_tls_psk_tunnel_native generic#99
jkcoxson merged 1 commit into
jkcoxson:masterfrom
maxslarsson:generic-tls-psk-tunnel

Conversation

@maxslarsson
Copy link
Copy Markdown
Contributor

Make connect_tls_psk_tunnel and connect_tls_psk_tunnel_native generic over any S: ReadWrite instead of requiring Box<dyn ReadWrite> or TcpStream specifically.

This lets callers pass any stream type directly without boxing. The underlying implementations (tls_psk_handshake and tokio_openssl::SslStream::new) were already generic, so this just threads that genericity through to the public API.

Changes:

  • connect_tls_psk_tunnel_native: Box<dyn ReadWrite> -> S: ReadWrite
  • connect_tls_psk_tunnel: tokio::net::TcpStream -> S: ReadWrite
  • Removed unnecessary Box::new() wrapping in tunnel_provider.rs

Both functions now accept any `S: ReadWrite` instead of hardcoding
`Box<dyn ReadWrite>` / `TcpStream`. Callers no longer need to box
their streams.
@maxslarsson maxslarsson force-pushed the generic-tls-psk-tunnel branch from d62873f to c862351 Compare May 8, 2026 10:57
@jkcoxson jkcoxson merged commit b35fefa into jkcoxson:master May 8, 2026
3 checks passed
@jkcoxson
Copy link
Copy Markdown
Owner

jkcoxson commented May 8, 2026

Thanks. I'm curious, what are you using this library for?

@maxslarsson maxslarsson deleted the generic-tls-psk-tunnel branch May 8, 2026 17:42
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.

2 participants