Add ErrCertificateExpired
This commit is contained in:
parent
352ad71af8
commit
c4c616518b
@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"errors"
|
|
||||||
"net"
|
"net"
|
||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
@ -183,7 +182,7 @@ func (c *Client) verifyConnection(cs tls.ConnectionState, hostname string) error
|
|||||||
}
|
}
|
||||||
// Check expiration date
|
// Check expiration date
|
||||||
if !time.Now().Before(cert.NotAfter) {
|
if !time.Now().Before(cert.NotAfter) {
|
||||||
return errors.New("gemini: certificate expired")
|
return ErrCertificateExpired
|
||||||
}
|
}
|
||||||
// See if the client trusts the certificate
|
// See if the client trusts the certificate
|
||||||
if c.TrustCertificate != nil {
|
if c.TrustCertificate != nil {
|
||||||
|
@ -11,6 +11,8 @@ var (
|
|||||||
ErrInvalidRequest = errors.New("gemini: invalid request")
|
ErrInvalidRequest = errors.New("gemini: invalid request")
|
||||||
ErrInvalidResponse = errors.New("gemini: invalid response")
|
ErrInvalidResponse = errors.New("gemini: invalid response")
|
||||||
|
|
||||||
|
ErrCertificateExpired = errors.New("gemini: certificate expired")
|
||||||
|
|
||||||
// ErrBodyNotAllowed is returned by ResponseWriter.Write calls
|
// ErrBodyNotAllowed is returned by ResponseWriter.Write calls
|
||||||
// when the response status code does not permit a body.
|
// when the response status code does not permit a body.
|
||||||
ErrBodyNotAllowed = errors.New("gemini: response status code does not allow body")
|
ErrBodyNotAllowed = errors.New("gemini: response status code does not allow body")
|
||||||
|
Loading…
Reference in New Issue
Block a user