- add file based cert

- print out the exposed address
- handle empty exposed address
This commit is contained in:
Zoltan Papp
2024-07-03 15:03:57 +02:00
parent 15a7b7629b
commit 1a5ee744a8
5 changed files with 56 additions and 5 deletions

19
encryption/cert.go Normal file
View File

@ -0,0 +1,19 @@
package encryption
import "crypto/tls"
func LoadTLSConfig(certFile, keyFile string) (*tls.Config, error) {
serverCert, err := tls.LoadX509KeyPair(certFile, keyFile)
if err != nil {
return nil, err
}
config := &tls.Config{
Certificates: []tls.Certificate{serverCert},
ClientAuth: tls.NoClientCert,
NextProtos: []string{
"h2", "http/1.1", // enable HTTP/2
},
}
return config, nil
}