chore: listeners support tuic
This commit is contained in:
@ -4,7 +4,8 @@ import (
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
)
|
||||
func ParseCert(certificate,privateKey string) (tls.Certificate, error) {
|
||||
|
||||
func ParseCert(certificate, privateKey string) (tls.Certificate, error) {
|
||||
cert, painTextErr := tls.X509KeyPair([]byte(certificate), []byte(privateKey))
|
||||
if painTextErr == nil {
|
||||
return cert, nil
|
||||
@ -12,7 +13,7 @@ func ParseCert(certificate,privateKey string) (tls.Certificate, error) {
|
||||
|
||||
cert, loadErr := tls.LoadX509KeyPair(certificate, privateKey)
|
||||
if loadErr != nil {
|
||||
return tls.Certificate{}, fmt.Errorf("parse certificate failed,maybe format error:%s, or path error: %s", painTextErr.Error(), loadErr.Error())
|
||||
return tls.Certificate{}, fmt.Errorf("parse certificate failed, maybe format error:%s, or path error: %s", painTextErr.Error(), loadErr.Error())
|
||||
}
|
||||
return cert, nil
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user