summaryrefslogtreecommitdiff
path: root/gemini/tls.go
diff options
context:
space:
mode:
Diffstat (limited to 'gemini/tls.go')
-rw-r--r--gemini/tls.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/gemini/tls.go b/gemini/tls.go
new file mode 100644
index 0000000..3cdf93b
--- /dev/null
+++ b/gemini/tls.go
@@ -0,0 +1,16 @@
+package gemini
+
+import "crypto/tls"
+
+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
+}