Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func GetTLSConfig ¶
func GetTLSConfig(certPemPath, certKeyPath string, caPaths, caCerts []string, encCertPemPath, encCertKeyPath string) (*cmtls.Config, error)
GetTLSConfig 根据传入的参数,构建tls.Config对象 @param certPemPath @param certKeyPath @param caPaths @param caCerts @param encCertPemPath @param encCertKeyPath @return *cmtls.Config @return error
Types ¶
type CAClient ¶
type CAClient struct {
ServerName string
CaPaths []string
CaCerts []string
CertFile string
KeyFile string
CertBytes []byte
KeyBytes []byte
Logger log.LoggerInterface
//for gmtls1.1
EncCertFile string
EncKeyFile string
EncCertBytes []byte
EncKeyBytes []byte
}
CAClient CA客户端对象
func (*CAClient) GetCredentialsByCA ¶
func (c *CAClient) GetCredentialsByCA() (*credentials.TransportCredentials, error)
GetCredentialsByCA 获得TransportCredentials对象 @return *credentials.TransportCredentials @return error
type CAServer ¶
type CAServer struct {
CaPaths []string
CaCerts []string
CertFile string
KeyFile string
Logger log.LoggerInterface
}
CAServer CA服务端对象
func (*CAServer) GetCredentialsByCA ¶
func (s *CAServer) GetCredentialsByCA(checkClientAuth bool, customVerify CustomVerify) ( *credentials.TransportCredentials, error)
GetCredentialsByCA 获得服务端的TransportCredentials对象 @param checkClientAuth @param customVerify @return cert @return err
type CustomVerify ¶ added in v2.1.0
type CustomVerify struct {
VerifyPeerCertificate func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error
GMVerifyPeerCertificate func(rawCerts [][]byte, verifiedChains [][]*cmx509.Certificate) error
}
CustomVerify 自定义验证模式
Source Files
¶
- ca.go
- ca_client.go
- ca_server.go
- tls.go
Click to show internal directories.
Click to hide internal directories.