-
Notifications
You must be signed in to change notification settings - Fork 88
Add ClientBuilder helper to make setting up TLS connections easy. #197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add support for rustls in addition to native-tls.
Codecov Report
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the approach! I left a suggestion in there that I think can deal with the more customized setup routines users may have. As for testing STARTTLS, I thought our integration test already did that? If not, we should add one.
Co-authored-by: Jon Gjengset <[email protected]>
Use it for native and rustls initialization.
We have one, but it is marked |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh, you're right, I forgot that Greenmail doesn't support STARTTLS. That's awkward. I suppose we'll just have to leave that one for users to test then 😢
Happily added. Having the codecov always fail is a bit annoying. I copied the one you linked and tweaked it for the values that we're seeing in PRs here (ie 70% coverage low line, and don't fail for -2%). No problem if you want to change them to be tighter. |
Separately - what, if anything, do we want to move to the builder API?
I can see some of the docs and examples being kind of obvious. For the lib, some of the |
I think my preference here is actually to only have the builder API + |
Remove these functions. Update documentation to reference the ClientBuilder. Update examples to use the ClientBuilder except for timeout.rs, which now serves as an example of how to use Client::new() with a custom stream.
I put together a local test for this and confirmed the STARTTLS implementation in the |
Oh that sounds good to me. I prefer having one good way to do it: it is less code to maintain and nicer for users. I pushed a diff that removes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks!
@@ -15,10 +15,12 @@ categories = ["email", "network-programming"] | |||
|
|||
[features] | |||
tls = ["native-tls"] | |||
rustls-tls = ["rustls-connector"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separately, I wonder if we want to take this opportunity to rename the "other" tls
feature native-tls
, since it isn't really "more" standard than rustls
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good idea, so did a PR up here.
Addresses #190
Also add support for rustls in addition to native-tls. I think using
rustls
should be easier (and could even be the default?), so I just made it first class likenative-tls
. I have tested both thenative_tls()
andrustls()
paths.This just adds the
ClientBuilder
. If we're happy with the API here and the way it works, then I can take care of:/examples
) to use it where appropriate.I have not tested the STARTTLS code, since I do not have a STARTTLS enabled server to work with. How do we want to handle automating the tests to make sure it all works?
I have not added it, but I can see an argument for adding some knobs to control which CA bundle is added, or adding private CAs or something. The alternative it to just leave the existing API as is, which allows users to make their own TLS connection using whatever configuration that they want.
This change is