Open Ludea opened 10 months ago
Any specific ideas on how to do that? I'm not quite sure what would be useful here.
Maybe the best way to integrate would be contributing (to tonic) a feature gated method to its high-level server builder, which takes an AcmeConfig, instead of the fixed certificate config they have at the moment.
Just came across this myself. I've not tried this yet, but after looking at this tonic TLS server example I'm wondering whether you could use a AcmeAcceptor
here and be good to go:
@FlorianUekermann do you think that will work? I'm yet to try it but will do as soon as I can find time.
I appreciate this doesn't mean that this crate gets a more convenient tonic integration but assuming it's possible to do the above, I feel like it wouldn't be a stretch to add it, or at least an example.
EDIT: I think you'd also have to change the ServerConfig
here to use the ACME resolver of this crate:
Or it may even be possible to use the tokio integration (https://docs.rs/rustls-acme/latest/rustls_acme/tokio/struct.TokioIncoming.html) like this:
https://github.com/FlorianUekermann/rustls-acme/blob/main/examples/high_level_tokio.rs
And pass incoming TLS connections straight to serve_connection
:
Yes, both options look very promising.
The convenience aspect is more about tower than tonic I guess. You might even be able to use the high-level API then. Given how popular tower is, I think offering helpers for it may be a good idea anyway.
I see there is Warp and Axum support.
It would be awesome to get Tonic support too