From ff05d62013906f3086b452bfeda3e0d5b9b7a541 Mon Sep 17 00:00:00 2001 From: tjpcc Date: Mon, 9 Jan 2023 16:40:24 -0700 Subject: Initial commit. some basics: - minimal README - some TODOs - server and request handler framework - contribs: file serving, request logging - server examples - CI setup --- gemini/tls.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 gemini/tls.go (limited to 'gemini/tls.go') 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 +} -- cgit v1.2.3