async-rs / async-tls

A TLS implementation over AsyncRead and AsyncWrite
https://async.rs
Apache License 2.0
167 stars 47 forks source link

Get protocol after handshake #30

Open MoMannn opened 4 years ago

MoMannn commented 4 years ago

I was able to get this up and running but I cannot find a way to get which alpn protocol was decided (lets say server supports both http2 and http1.1 on alpn). Underlying ServerSession of rustls supports this but it is private trough TlsStream or acceptor. What is the correct way to access it?

xpepermint commented 4 years ago
pub struct TlsStream<IO> {
    pub(crate) io: IO,
    pub(crate) session: ServerSession,
    pub(crate) state: TlsState,
}

Looks like session should be pub to access this information.