Documentation
¶
Index ¶
- func BuildClientTLS(c *tlspb.TLS) (*stdtls.Config, error)
- func BuildServerTLS(c *tlspb.TLS) (*stdtls.Config, error)
- func LoadCertPoolFromPEMFile(path string) (*x509.CertPool, error)
- func MustBuildServerTLS(c *tlspb.TLS) *stdtls.Config
- func MustServerConfig(opts ServerConfigOptions) *stdtls.Config
- func NewClientConfig(opts ClientConfigOptions) (*stdtls.Config, error)
- func NewServerConfig(opts ServerConfigOptions) (*stdtls.Config, error)
- type ClientConfigOptions
- type ServerConfigOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildClientTLS ¶
BuildClientTLS 从 TLS proto 构造客户端 *tls.Config。 当 c 为 nil 或 enable=false 时返回 (nil, nil),调用方据此决定是否启用 TLS。
func BuildServerTLS ¶
BuildServerTLS 从 TLS proto 构造服务端 *tls.Config。 当 c 为 nil 或 enable=false 时返回 (nil, nil),调用方据此决定是否启用 TLS。
func LoadCertPoolFromPEMFile ¶
LoadCertPoolFromPEMFile 从 PEM 文件加载证书池。
func MustBuildServerTLS ¶
MustBuildServerTLS 是 BuildServerTLS 的 panic 版本,TLS 配置非法时直接 panic。
func MustServerConfig ¶
func MustServerConfig(opts ServerConfigOptions) *stdtls.Config
MustServerConfig 构造服务端 TLS 配置,失败时 panic。
func NewClientConfig ¶
func NewClientConfig(opts ClientConfigOptions) (*stdtls.Config, error)
NewClientConfig 构造客户端 TLS 配置。
func NewServerConfig ¶
func NewServerConfig(opts ServerConfigOptions) (*stdtls.Config, error)
NewServerConfig 构造服务端 TLS 配置。
Types ¶
type ClientConfigOptions ¶
type ClientConfigOptions struct {
CAPath string
CertPath string
KeyPath string
ServerName string
InsecureSkipVerify bool
MinVersion uint16
}
ClientConfigOptions 描述客户端 TLS 配置来源。
type ServerConfigOptions ¶
ServerConfigOptions 描述服务端 TLS 配置来源。
Click to show internal directories.
Click to hide internal directories.