Skip to content

Conversation

@yukiiiteru
Copy link
Member

@yukiiiteru yukiiiteru commented Oct 27, 2025

Motivation

In previous implementation, volo::net::Conn has 4 variants: Tcp, Unix, Rustls and NativeTls, but we think it's not elegant to put Rustls and NativeTls here. And what's more, in most cases, we only need to be aware of TLS and do not need to be aware of which library is used behind it.

Solution

Wraps Rustls and NativeTls into Tls prefixed types and makes Conn cleaner.


Note

Unifies rustls/native-tls under generic TLS types and updates conn/transport/server paths to use Tls*, while bumping volo, volo-grpc, and volo-http versions.

  • Networking/TLS:
    • Introduce unified TLS abstractions: TlsStream, TlsConnector, TlsAcceptor, OwnedReadHalf, OwnedWriteHalf in volo/src/net/tls/*.
    • Replace ConnStream::{Rustls,NativeTls} with ConnStream::Tls; update negotiated_alpn, peer_addr, and split logic accordingly in volo/src/net/conn.rs.
    • Update connector/acceptor APIs to return ConnStream via unified Tls* types; add builders and ALPN support; mark AsyncReady unsupported for TLS in volo/src/net/ready.rs.
    • Disallow Unix domain sockets for TLS transports; route TCP connects through unified TLS in TlsMakeTransport.
  • HTTP (volo-http):
    • Client: TlsMakeConnection now wraps TLS handshake and returns Conn with ConnInfo using unified TlsConnector.
    • Server: perform TLS accept with ServerTlsConfig and ConnStream::Tcp only; import cleanup.
    • Cargo: pin volo = "0.11.2" and bump crate to 0.4.4.
  • gRPC (volo-grpc):
    • Server: use ServerTlsConfig for TLS; minor import adjustments.
    • Cargo: bump to 0.11.8 and depend on volo = "0.11.2".
  • Core (volo):
    • Expose unified TLS types and builders; adjust dialing/transport to use new TLS path; minor API return type changes (io::Result).
    • Version bump to 0.11.2 and lockfile updates.

Written by Cursor Bugbot for commit a1597ef. This will update automatically on new commits. Configure here.

@PureWhiteWu
Copy link
Member

bugbot run

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no bugs!


In previous implementation, `volo::net::Conn` has 4 variants: `Tcp`,
`Unix`, `Rustls` and `NativeTls`, but we think it's not elegant to put
`Rustls` and `NativeTls` here. And what's more, in most cases, we only
need to be aware of TLS and do not need to be aware of which library
is used behind it.

This commit wraps `Rustls` and `NativeTls` into `Tls` prefixed types
and makes `Conn` cleaner.

Signed-off-by: Yu Li <[email protected]>
@yukiiiteru yukiiiteru force-pushed the chore/tls branch 2 times, most recently from 00411dc to dd8664c Compare October 31, 2025 09:42
@codecov
Copy link

codecov bot commented Nov 3, 2025

Codecov Report

❌ Patch coverage is 44.02516% with 89 lines in your changes missing coverage. Please review.
✅ Project coverage is 40.84%. Comparing base (10e73ea) to head (3f25ef8).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
volo/src/net/tls/mod.rs 40.32% 74 Missing ⚠️
volo/src/net/conn.rs 42.10% 11 Missing ⚠️
volo/src/net/ready.rs 0.00% 2 Missing ⚠️
volo/src/net/tls/rustls.rs 75.00% 2 Missing ⚠️

❌ Your patch status has failed because the patch coverage (44.02%) is below the target coverage (70.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #627      +/-   ##
==========================================
+ Coverage   40.78%   40.84%   +0.05%     
==========================================
  Files         160      160              
  Lines       19544    19646     +102     
==========================================
+ Hits         7971     8024      +53     
- Misses      11573    11622      +49     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@yukiiiteru yukiiiteru merged commit 663fd5c into cloudwego:main Nov 3, 2025
14 of 15 checks passed
@yukiiiteru yukiiiteru deleted the chore/tls branch November 3, 2025 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants