Skip to content

Commit 476fd87

Browse files
committed
Expose underlying methods on native_tls::TlsStream
1 parent f995a78 commit 476fd87

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/tls_stream.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,30 @@ impl<S> TlsStream<S> {
4949
{
5050
&mut self.0.get_mut().inner
5151
}
52+
53+
/// Returns the number of bytes that can be read without resulting in any network calls.
54+
pub fn buffered_read_size(&self) -> crate::Result<usize>
55+
where
56+
S: AsyncRead + AsyncWrite + Unpin,
57+
{
58+
self.0.buffered_read_size()
59+
}
60+
61+
/// Returns the peer's leaf certificate, if available.
62+
pub fn peer_certificate(&self) -> crate::Result<Option<crate::Certificate>>
63+
where
64+
S: AsyncRead + AsyncWrite + Unpin,
65+
{
66+
self.0.peer_certificate()
67+
}
68+
69+
/// Returns the tls-server-end-point channel binding data as defined in [RFC 5929](https://tools.ietf.org/html/rfc5929).
70+
pub fn tls_server_end_point(&self) -> crate::Result<Option<Vec<u8>>>
71+
where
72+
S: AsyncRead + AsyncWrite + Unpin,
73+
{
74+
self.0.tls_server_end_point()
75+
}
5276
}
5377

5478
impl<S> AsyncRead for TlsStream<S>

0 commit comments

Comments
 (0)