Skip to content
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: Rename get root certs related pieces #7207

Merged
merged 4 commits into from
May 8, 2024

Conversation

gtcooke94
Copy link
Contributor

This PR renames GetRootCAsParams to ConnectionInfo and GetRootCAsResults to RootCertificates to better name what these structs actually represent.

RELEASE NOTES: none

@gtcooke94 gtcooke94 added the Type: Internal Cleanup Refactors, etc label May 7, 2024
@gtcooke94 gtcooke94 added this to the 1.64 Release milestone May 7, 2024
@gtcooke94 gtcooke94 requested review from dfawley and erm-g May 7, 2024 15:14
// If users want to reload the root trust certificate, it is required to return
// the proper TrustCerts in GetRootCAs.
type GetRootCAsResults struct {
type RootCertificates struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it's just a wrapper and used as an output of a single function - how about RootCertificatesResults?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Results is just noise - this struct fundamentally is root certificates, and it's a given that it's a Result when it's the output of a function. To me this would be sort of like naming the function GetRootCAsFunction

@@ -479,7 +495,7 @@ func (o *Options) serverConfig() (*tls.Config, error) {
type advancedTLSCreds struct {
config *tls.Config
verifyFunc PostHandshakeVerificationFunc
getRootCAs func(params *GetRootCAsParams) (*GetRootCAsResults, error)
getRootCAs func(params *ConnectionInfo) (*RootCertificates, error)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be renamed to GetRootCertificates in this struct as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is non-exported so I wasn't as worried about getting it changed right now

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like if you do want to make this change, now would be a great time to do it. But I don't feel strongly. Same for the other one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Went on and made the change in both

@@ -384,9 +384,14 @@ func (s) TestClientServerHandshake(t *testing.T) {
if err := cs.LoadCerts(); err != nil {
t.Fatalf("cs.LoadCerts() failed, err: %v", err)
}
getRootCAsForClient := func(params *GetRootCAsParams) (*GetRootCAsResults, error) {
getRootCAsForClient := func(params *ConnectionInfo) (*RootCertificates, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here (and below) - getRootCertificatesForClient?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this was just tests and also not part of the API I'm trying to keep the diff focused on the API.
I don't mind making the changes here either, WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Went on and made the change in both

Copy link
Member

@dfawley dfawley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if you want me to force merge this. Mergeable was having issues this morning, it seems.

@@ -479,7 +495,7 @@ func (o *Options) serverConfig() (*tls.Config, error) {
type advancedTLSCreds struct {
config *tls.Config
verifyFunc PostHandshakeVerificationFunc
getRootCAs func(params *GetRootCAsParams) (*GetRootCAsResults, error)
getRootCAs func(params *ConnectionInfo) (*RootCertificates, error)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like if you do want to make this change, now would be a great time to do it. But I don't feel strongly. Same for the other one.

@dfawley dfawley assigned gtcooke94 and unassigned dfawley and erm-g May 7, 2024
@gtcooke94 gtcooke94 requested a review from erm-g May 7, 2024 20:48
@dfawley dfawley assigned erm-g and unassigned gtcooke94 May 7, 2024
@dfawley dfawley merged commit c76f686 into grpc:master May 8, 2024
11 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants