Documentation
¶
Index ¶
- func AddrsToURLs(addrs []string, tlsCfg *tls.Config) []string
- func ModifyURLScheme(url string, tlsCfg *tls.Config) string
- func NewCert(certfile, keyfile string, ...) (*tls.Certificate, error)
- func NewCertPool(caFiles []string) (*x509.CertPool, error)
- func PickMatchedURL(urls []string, tlsCfg *tls.Config) string
- func TrimHTTPPrefix(str string) string
- type TLSConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddrsToURLs ¶
AddrsToURLs converts a list of addresses to a list of URLs.
func ModifyURLScheme ¶
ModifyURLScheme modifies the scheme of the URL based on the TLS config.
func NewCert ¶
func NewCert(certfile, keyfile string, parseFunc func([]byte, []byte) (tls.Certificate, error)) (*tls.Certificate, error)
NewCert generates TLS cert by using the given cert,key and parse function.
func NewCertPool ¶
NewCertPool creates x509 certPool with provided CA files.
func PickMatchedURL ¶
PickMatchedURL picks the matched URL based on the TLS config. Note: please make sure the URLs are valid.
func TrimHTTPPrefix ¶
TrimHTTPPrefix trims the HTTP/HTTPS prefix from the string.
Types ¶
type TLSConfig ¶
type TLSConfig struct {
// CAPath is the path of file that contains list of trusted SSL CAs. if set, following four settings shouldn't be empty
CAPath string `toml:"cacert-path" json:"cacert-path"`
// CertPath is the path of file that contains X509 certificate in PEM format.
CertPath string `toml:"cert-path" json:"cert-path"`
// KeyPath is the path of file that contains X509 key in PEM format.
KeyPath string `toml:"key-path" json:"key-path"`
// CertAllowedCNs is the list of CN which must be provided by a client
CertAllowedCNs []string `toml:"cert-allowed-cn" json:"cert-allowed-cn"`
SSLCABytes []byte
SSLCertBytes []byte
SSLKEYBytes []byte
}
TLSConfig is the configuration for supporting tls.
Click to show internal directories.
Click to hide internal directories.