Don't store wildcards in the known hosts file
This commit is contained in:
parent
0343248952
commit
e01d59f8f6
13
client.go
13
client.go
@ -45,6 +45,11 @@ type Request struct {
|
|||||||
TLS tls.ConnectionState
|
TLS tls.ConnectionState
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hostname returns the request host without the port.
|
||||||
|
func (r *Request) Hostname() string {
|
||||||
|
return hostname(r.Host)
|
||||||
|
}
|
||||||
|
|
||||||
// NewRequest returns a new request. The host is inferred from the provided url.
|
// NewRequest returns a new request. The host is inferred from the provided url.
|
||||||
func NewRequest(rawurl string) (*Request, error) {
|
func NewRequest(rawurl string) (*Request, error) {
|
||||||
u, err := url.Parse(rawurl)
|
u, err := url.Parse(rawurl)
|
||||||
@ -180,7 +185,7 @@ type Client struct {
|
|||||||
// TrustCertificate, if not nil, will be called to determine whether the
|
// TrustCertificate, if not nil, will be called to determine whether the
|
||||||
// client should trust the given certificate.
|
// client should trust the given certificate.
|
||||||
// If error is not nil, the connection will be aborted.
|
// If error is not nil, the connection will be aborted.
|
||||||
TrustCertificate func(cert *x509.Certificate, knownHosts *KnownHosts) error
|
TrustCertificate func(req *Request, cert *x509.Certificate, knownHosts *KnownHosts) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send sends a Gemini request and returns a Gemini response.
|
// Send sends a Gemini request and returns a Gemini response.
|
||||||