Documentation
¶
Overview ¶
Package tls provides helper functions for building client and server TLS configurations.
Index ¶
- func LoadCertPoolFromFS(fsys fs.FS, certPoolPath string) (*x509.CertPool, error)
- func LoadCertPoolFromFile(certPoolPath string) (*x509.CertPool, error)
- func NewClientTLSConfig(c ClientConfig) (*tls.Config, error)
- func NewServerTLSConfig(c ServerConfig) (*tls.Config, error)
- type ClientConfig
- type ServerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadCertPoolFromFS ¶
LoadCertPoolFromFS loads a certificate pool from a PEM file in the provided filesystem.
func LoadCertPoolFromFile ¶
LoadCertPoolFromFile loads a certificate pool from a PEM file.
func NewClientTLSConfig ¶
func NewClientTLSConfig(c ClientConfig) (*tls.Config, error)
NewClientTLSConfig creates a TLS configuration for a client from the given config.
func NewServerTLSConfig ¶
func NewServerTLSConfig(c ServerConfig) (*tls.Config, error)
NewServerTLSConfig creates a TLS configuration for a server from the given config.
Types ¶
type ClientConfig ¶
type ClientConfig struct {
RootCAFile string `mapstructure:"root-ca-file" json:",omitempty"`
Certificate string `mapstructure:"cert" json:",omitempty"`
Key string `mapstructure:"key" json:",omitempty"`
InsecureSkipVerify bool `mapstructure:"insecure-skip-verify"`
}
ClientConfig specifies TLS client configuration.
type ServerConfig ¶
type ServerConfig struct {
Certificate string `mapstructure:"cert" json:",omitempty"`
Key string `mapstructure:"key" json:",omitempty"`
ClientCA string `mapstructure:"client-ca" json:",omitempty"`
}
ServerConfig specifies TLS server configuration.
Click to show internal directories.
Click to hide internal directories.