summaryrefslogtreecommitdiff
path: root/gemini/tls.go
diff options
context:
space:
mode:
authortjpcc <tjp@ctrl-c.club>2023-01-09 16:40:24 -0700
committertjpcc <tjp@ctrl-c.club>2023-01-09 16:40:24 -0700
commitff05d62013906f3086b452bfeda3e0d5b9b7a541 (patch)
tree3be29de0b1bc7c273041c6d89b71ca447c940556 /gemini/tls.go
Initial commit.
some basics: - minimal README - some TODOs - server and request handler framework - contribs: file serving, request logging - server examples - CI setup
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
+}