Documentation ¶
Index ¶
- Variables
- func GetClientTLSConfig(opts ...SSLConfigOption) (tlsConfig *tls.Config, err error)
- func GetServerTLSConfig(opts ...SSLConfigOption) (tlsConfig *tls.Config, err error)
- func GetX509CACertPool(caCertFile string) (caCertPool *x509.CertPool, err error)
- func LoadTLSCertificate(certFile, keyFile, plainPassphase string) (tlsCert []tls.Certificate, err error)
- func ParseDefaultSSLCipherSuites(ciphers string) []uint16
- func ParseSSLCipherSuites(ciphers string, permitTLSCipherSuiteMap map[string]uint16) []uint16
- func ParseSSLProtocol(sprotocol string) uint16
- func TLSCipherSuits() []uint16
- type SSLConfig
- type SSLConfigOption
- func DefaultClientTLSOptions() []SSLConfigOption
- func DefaultServerTLSOptions() []SSLConfigOption
- func WithCA(f string) SSLConfigOption
- func WithCert(f string) SSLConfigOption
- func WithCipherSuits(s []uint16) SSLConfigOption
- func WithKey(k string) SSLConfigOption
- func WithKeyPass(p string) SSLConfigOption
- func WithVerifyHostName(b bool) SSLConfigOption
- func WithVerifyPeer(b bool) SSLConfigOption
- func WithVersion(min, max uint16) SSLConfigOption
Constants ¶
This section is empty.
Variables ¶
View Source
var MaxSupportedTLSVersion uint16 = tls.VersionTLS12
MaxSupportedTLSVersion is the max supported TLS version
View Source
var TLSCipherSuiteMap = map[string]uint16{ "TLS_RSA_WITH_AES_128_GCM_SHA256": tls.TLS_RSA_WITH_AES_128_GCM_SHA256, "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256": tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, "TLS_RSA_WITH_AES_256_GCM_SHA384": tls.TLS_RSA_WITH_AES_256_GCM_SHA384, "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384": tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, "TLS_RSA_WITH_AES_128_CBC_SHA256": tls.TLS_RSA_WITH_AES_128_CBC_SHA256, }
View Source
var TLSVersionMap = map[string]uint16{ "TLSv1.0": tls.VersionTLS10, "TLSv1.1": tls.VersionTLS11, "TLSv1.2": tls.VersionTLS12, }
Functions ¶
func GetClientTLSConfig ¶
func GetClientTLSConfig(opts ...SSLConfigOption) (tlsConfig *tls.Config, err error)
*
verifyPeer Whether verify client supplyCert Whether send certificate verifyCN Whether verify CommonName
func GetServerTLSConfig ¶
func GetServerTLSConfig(opts ...SSLConfigOption) (tlsConfig *tls.Config, err error)
func GetX509CACertPool ¶
func LoadTLSCertificate ¶
func LoadTLSCertificate(certFile, keyFile, plainPassphase string) (tlsCert []tls.Certificate, err error)
func ParseSSLCipherSuites ¶
func ParseSSLProtocol ¶
func TLSCipherSuits ¶
func TLSCipherSuits() []uint16
Types ¶
type SSLConfigOption ¶
type SSLConfigOption func(*SSLConfig)
func DefaultClientTLSOptions ¶
func DefaultClientTLSOptions() []SSLConfigOption
func DefaultServerTLSOptions ¶
func DefaultServerTLSOptions() []SSLConfigOption
func WithCA ¶
func WithCA(f string) SSLConfigOption
func WithCert ¶
func WithCert(f string) SSLConfigOption
func WithCipherSuits ¶
func WithCipherSuits(s []uint16) SSLConfigOption
func WithKey ¶
func WithKey(k string) SSLConfigOption
func WithKeyPass ¶
func WithKeyPass(p string) SSLConfigOption
func WithVerifyHostName ¶
func WithVerifyHostName(b bool) SSLConfigOption
func WithVerifyPeer ¶
func WithVerifyPeer(b bool) SSLConfigOption
func WithVersion ¶
func WithVersion(min, max uint16) SSLConfigOption
Click to show internal directories.
Click to hide internal directories.