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

@@ -22,8 +22,8 @@ func init() {
client = &gemini.Client{}
client.KnownHosts.Load()
client.TrustCertificate = func(req *gemini.Request, cert *x509.Certificate, knownHosts *gemini.KnownHosts) error {
err := knownHosts.Lookup(req.Hostname(), cert)
client.TrustCertificate = func(hostname string, cert *x509.Certificate, knownHosts *gemini.KnownHosts) error {
err := knownHosts.Lookup(hostname, cert)
if err != nil {
switch err {
case gemini.ErrCertificateNotTrusted:
@@ -37,7 +37,7 @@ func init() {
return nil
} else if userTrustsCertificatePermanently() {
// Add the certificate to the known hosts file
knownHosts.Add(req.Hostname(), cert)
knownHosts.Add(hostname, cert)
return nil
}
}