20 lines
510 B
Go
20 lines
510 B
Go
package gemini
|
|
|
|
import "crypto/tls"
|
|
|
|
// FileTLS builds a TLS configuration from paths to a certificate and key file.
|
|
//
|
|
// It sets parameters on the configuration to make it suitable for use with gemini.
|
|
func FileTLS(certfile string, keyfile string) (*tls.Config, error) {
|
|
cert, err := tls.LoadX509KeyPair(certfile, keyfile)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &tls.Config{
|
|
Certificates: []tls.Certificate{cert},
|
|
MinVersion: tls.VersionTLS12,
|
|
ClientAuth: tls.RequestClientCert,
|
|
}, nil
|
|
}
|