gotham-rs / gotham

A flexible web framework that promotes stability, safety, security and speed.

Home Page:https://gotham.rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gotham 0.5-rc.1 -- expose ServerConfig in tls?

dacut opened this issue · comments

I'm playing with the release candidate of 0.5, and I'm loving how it encapsulates bits like hyper and tokio_rustls into the gotham:: namespace so I don't have to keep my own Cargo.toml in sync.

One oddity I've noticed (or at least I can't figure out otherwise): gotham::tls::start() has this signature:

pub fn start<NH, A>(addr: A, new_handler: NH, tls_config: rustls::ServerConfig)
where
    NH: NewHandler + 'static,
    A: ToSocketAddrs + 'static + Send

But tokio_rustls::rustls isn't pub used, so I can't get at ServerConfig myself:

use tokio::net::TcpListener;
use tokio_rustls::{rustls, TlsAcceptor};

I think it would make sense to pub use tokio_rustls::rustls::ServerConfig in gotham::tls so users don't have to go out and try to match up the tokio_rustls version manually. What do you think?

Thanks!

Looking a bit more at this, there may be additional bits from tokio_rustls::rustls needed to successfully get things working. My configuration required: use tokio_rustls::rustls::{Certificate, NoClientAuth, PrivateKey, ServerConfig, TLSError};

Maybe it would make more sense to pub use tokio_rustls::rustls? Not sure how nitty-gritty you want to get here...

I agree, I do think exposing rustls via pub export is not only ergonomic but also precedented by the other re-exports.