Make TrustCertificate accept hostname instead of request

This commit is contained in:
adnano
2020-09-27 16:10:36 -04:00
parent 32a9fcba0c
commit 73a1692a5b
3 changed files with 7 additions and 7 deletions

View File

@@ -48,11 +48,11 @@ var DefaultClient *Client
func init() {
DefaultClient = &Client{
TrustCertificate: func(req *Request, cert *x509.Certificate, knownHosts *KnownHosts) error {
TrustCertificate: func(hostname string, cert *x509.Certificate, knownHosts *KnownHosts) error {
// Load the hosts only once. This is so that the hosts don't have to be loaded
// for those using their own clients.
setupDefaultClientOnce.Do(setupDefaultClient)
return knownHosts.Lookup(req.Hostname(), cert)
return knownHosts.Lookup(hostname, cert)
},
}
}