Closed joshtriplett closed 11 months ago
Will do. However, as a low-level API user, you may want to skip AcmeAcceptor and do it like this: https://github.com/FlorianUekermann/rustls-acme/blob/main/examples/low_level_async_rustls.rs
I would like to AcmeAcceptor in favor of the approach in that example, which also solves your async/futures-rustls problem from #46 (I just haven't gotten around to adding some helper functions to make the slightly verbose bits a little more convenient).
@FlorianUekermann I ended up doing this, for trillium-acme (and accepting the use of futures-rustls): https://github.com/trillium-rs/trillium/pull/377/files#diff-902678dccdaf31ecba2b5681427a8ea78425590bda68b8a3b937e49db415e57e
Is there a better way to do that that doesn't use AcmeAcceptor
?
If you don't care about futures-rustls vs async-rustls anymore, using AcmeAcceptor gets you there with the less code, but it's no different under the hood than doing it like this: https://github.com/FlorianUekermann/rustls-acme/blob/main/examples/low_level_async_rustls.rs
The benefit of the latter solution is that whether you use futures-rustls, async-rustls or anything else is your choice. The only difference is that you have to check yourself if an incoming connection is a tls-alpn-01 validation attempt or not, by looking at the client hello (the if in the example above). If it's a validation attempt you just use another resolver/rustls-config to accept the request. That's all there is to AcmeAcceptor.
As I mentioned, I'll probably deprecate AcmeAcceptor, but whether you avoid using it now doesn't matter unless you benefit from avoiding futures-rustls.
@FlorianUekermann I realize that I could do what AcmeAcceptor does by hand, but it's nice to have the higher-level handling and not have to check the incoming connection to see if it's a challenge. Perhaps there's another high-level API that would make that even easier with even less verbose code, but AcmeAcceptor seems easier than doing it by hand.
Yes, the low-level API without AcmeAcceptor is a bit verbose. I added some helper functions/methods and updated all low-level examples accordingly. Maybe that helps a bit.
https://github.com/FlorianUekermann/rustls-acme/blob/main/examples/low_level.rs
Please consider providing a
Debug
implementation forAcmeAcceptor
, to make it possible to#[derive(Debug)]
for a struct containingAcmeAcceptor
.