summaryrefslogtreecommitdiff
path: root/pkg/cfg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/cfg')
-rw-r--r--pkg/cfg/tls.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/pkg/cfg/tls.go b/pkg/cfg/tls.go
new file mode 100644
index 0000000..6414b25
--- /dev/null
+++ b/pkg/cfg/tls.go
@@ -0,0 +1,18 @@
+package cfg
+
+import (
+ "crypto/tls"
+
+ "github.com/xlgmokha/x/pkg/x"
+)
+
+func WithSelfSigned(cert, key string) cfg.Option {
+ certificate := x.Must(tls.LoadX509KeyPair(cert, key))
+
+ return func(config *cfg.Config) {
+ config.TLS = &tls.Config{
+ MinVersion: tls.VersionTLS13,
+ Certificates: []tls.Certificate{certificate},
+ }
+ }
+}