-
Notifications
You must be signed in to change notification settings - Fork 0
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
mTLS authentication w/ tests #4
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.
Looks good. Would be nice to see more documentation and comments for exported functions and structs.
) | ||
|
||
func init() { | ||
flag.IntVar(&grpcPort, "grpc-port", 50051, "Port to expose the gRPC server on") |
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.
nit: Define default port number constant since it is used by both server and client.
tc := validTestCase() | ||
tc.clientCredsFiles.Cert = "self-signed.crt" | ||
tc.clientCredsFiles.Key = "self-signed.key" | ||
tc.expectedErr = errors.New("context deadline exceeded") |
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.
Is it possible to improve the error handling for this case? Receiving a 'context deadline exceeded' here might not be too helpful in figuring out what went wrong.
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.
The only option I see is to somehow inspect the logs emitted by the grpc framework. In the returned error object itself, the more precise message seems to be just a "connection error" or "connection closed".
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.
does grpc.WithBlock()
(or some other dial option) help catch the TLS error early?
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.
Not really. I already use grpc.WithReturnConnectionError()
which implies grpc.WithBlock()
and is even more helpful in this regard.
tc := validTestCase() | ||
tc.clientCredsFiles.Cert = "self-signed.crt" | ||
tc.clientCredsFiles.Key = "self-signed.key" | ||
tc.expectedErr = errors.New("context deadline exceeded") |
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.
does grpc.WithBlock()
(or some other dial option) help catch the TLS error early?
No description provided.