Fix known host expires check

This commit is contained in:
adnano 2020-09-25 20:31:03 -04:00
parent eaa034204a
commit be55224f89
2 changed files with 2 additions and 2 deletions

View File

@ -34,7 +34,7 @@ The way this is implemented in this package is like so:
1. Client makes a request with `NewRequest`. The client then sends the request
with `Send(*Request) (*Response, error)`. The client can optionally verify
the server certificates with `VerifyCertificate(*x509.Certificate, *Request)`
the server certificate with `VerifyCertificate(*x509.Certificate, *Request)`
2. Server recieves the request and constructs a response.
The server calls the `Serve(*ResponseWriter, *Request)` method on the
`Handler` field. The handler writes the response. The server then closes

View File

@ -26,7 +26,7 @@ func (k KnownHosts) Has(hostname string, cert *x509.Certificate) bool {
now := time.Now().Unix()
fingerprint := Fingerprint(cert)
for i := range k {
if k[i].Expires < now && k[i].Hostname == hostname && k[i].Fingerprint == fingerprint {
if k[i].Expires > now && k[i].Hostname == hostname && k[i].Fingerprint == fingerprint {
return true
}
}