-
Notifications
You must be signed in to change notification settings - Fork 130
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
TLS dialer #106
base: master
Are you sure you want to change the base?
TLS dialer #106
Conversation
Hi, @nemith . Can you review this PR please? |
I am not longer a maintainer on this project |
@nemith |
@@ -18,6 +18,22 @@ type DNSHostProvider struct { | |||
lookupHost func(string) ([]string, error) // Override of net.LookupHost, for testing. | |||
} | |||
|
|||
func addrsByHostname(server string) ([]string, error) { |
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: since this is used in the function below, this function would be sorted below it.
"time" | ||
) | ||
|
||
func CreateTLSConfig(rootCAFile, certFile, keyFile string) (*tls.Config, error) { |
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 should not assume files, and have io.Reader
as input for all three inputs. This allows a better library experience having tests and callers pass in content as they see fit.
also the tls package allows this to work then with https://pkg.go.dev/crypto/tls#X509KeyPair
}, nil | ||
} | ||
|
||
func GetTLSDialer(servers []string, dialer *net.Dialer, tlsConfig *tls.Config) (Dialer, error) { |
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 this function then used as the option to use as an option? The notion would normally be that the surrounding library would pass in this dialer themselves. If we wanted to support TLS Dial in the zk lib. I would want to have this outside the main zk package and in a supporting package
Hello.
Here is an implementation of a dialer using tls connect.
Also I have added a function which returns a simple tls.Config. This is probably the most common way to create it, so I decided to put it in this library.
I think it might be useful.
Usage example: