-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
advancedtls: Add SNI logic to ServerOptions.GetCertificate #3697
Conversation
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.
Thanks for the draft! I left some comments at the first glance. Let me know if you have any questions.
@ZhenLian Thanks for the review! I made some changes. Could you please check it again? |
This PR is still a draft, is it right? |
@menghanl Yes :) |
Cindy/sni test
Added unit test for getCertificateWithSNI
@ZhenLian I added a unit test to test the newly added GetCertificate with SNI logic. However, one of the Travis-CI test fails and the error message shows |
@cindyxue It looks like Go 1.9 doesn't support this function .... To bypass this check, you may want to use the build Constraints to have different implementations on different Go versions. See #3626 for example. |
@easwars Hi Easwar, Can you please take a look at this PR please? Thanks in advance! |
daf1375
to
8fd0b50
Compare
@easwars Thank you so much for the code review, Easwar! I have made changes addressing the review comments. Could you please take another look and see if there are more places to change? Thanks again! |
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 good to me. Some minor nits to take care of before merging.
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.
This PR does the following thing:
For go1.10 and above,
config.GetCertificate
is now able to perform SNI logic based onServerOptions.GetCertificate
and return the certificate that matches the common name or DNS field in the givenClientHelloInfo
.For go1.9,
config.GetCertificate
will always return the first certificate in the certificate list given byServerOptions.GetCertificate
becauseSupportsCertificate
is not supported.@ZhenLian