mirror of
https://github.com/netbirdio/netbird.git
synced 2024-12-15 19:31:06 +01:00
20 lines
404 B
Go
20 lines
404 B
Go
|
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
|
||
|
}
|