diff options
Diffstat (limited to 'config.go')
-rw-r--r-- | config.go | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -2,6 +2,7 @@ package main import ( "bufio" + "crypto/tls" "os" "sync" @@ -15,6 +16,7 @@ var config struct { Cert string `scfg:"cert"` Key string `scfg:"key"` } `scfg:"tls"` + _tls_config *tls.Config } var config_mutex sync.RWMutex @@ -31,6 +33,14 @@ func load_config(path string) error { if err != nil { return err } + cer, err := tls.LoadX509KeyPair(config.TLS.Cert, config.TLS.Key) + if err != nil { + return err + } + config._tls_config = &tls.Config{ + Certificates: []tls.Certificate{cer}, + MinVersion: tls.VersionTLS13, + } return nil }() != nil { return err |