tls

package
v0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 16, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CmdrTlsConfig

type CmdrTlsConfig struct {
	Enabled            bool          // Both
	CaCert             string        // server-side: optional server's CA;   client-side: client's CA
	ServerCert         string        //                                      client-side: the server's cert
	Cert               string        // server-side: server's cert bundle;   client-side: client's cert
	Key                string        // server-side: server's key;           client-side: client's key
	ClientAuth         bool          // Both
	InsecureSkipVerify bool          // client-side only
	MinTlsVersion      VersionTLS    // Both
	DialTimeout        time.Duration // for dialing
	// contains filtered or unexported fields
}

CmdrTlsConfig wraps the certificates. For server-side, the `Cert` field must be a bundle of server certificates with all root CAs chain. For server-side, the `CaCert` is optional for extra client CA's.

func NewCmdrTlsConfig

func NewCmdrTlsConfig(prefixInConfigFile, prefixInCommandline string) *CmdrTlsConfig

func NewTlsConfig

func NewTlsConfig(fn func(config *CmdrTlsConfig)) *CmdrTlsConfig

func (*CmdrTlsConfig) Dial

func (s *CmdrTlsConfig) Dial(network, addr string) (conn net.Conn, err error)

Dial connects to the given network address using net.Dial and then initiates a TLS handshake, returning the resulting TLS connection. Dial interprets a nil configuration as equivalent to the zero configuration; see the documentation of Config for the defaults.

func (*CmdrTlsConfig) InitTlsConfigFromCommandline

func (s *CmdrTlsConfig) InitTlsConfigFromCommandline(prefix string)

func (*CmdrTlsConfig) InitTlsConfigFromConfigFile

func (s *CmdrTlsConfig) InitTlsConfigFromConfigFile(prefix string)

func (*CmdrTlsConfig) IsCertValid

func (s *CmdrTlsConfig) IsCertValid() bool

func (*CmdrTlsConfig) IsClientAuthValid

func (s *CmdrTlsConfig) IsClientAuthValid() bool

func (*CmdrTlsConfig) IsServerCertValid

func (s *CmdrTlsConfig) IsServerCertValid() bool

func (*CmdrTlsConfig) NewTlsListener

func (s *CmdrTlsConfig) NewTlsListener(l net.Listener) (listener net.Listener, err error)

func (*CmdrTlsConfig) String

func (s *CmdrTlsConfig) String() string

func (*CmdrTlsConfig) ToServerTlsConfig

func (s *CmdrTlsConfig) ToServerTlsConfig() (config *tls.Config)

ToServerTlsConfig builds an tls.Config object for server.Serve

func (*CmdrTlsConfig) ToTlsConfig

func (s *CmdrTlsConfig) ToTlsConfig() (config *tls.Config)

func (*CmdrTlsConfig) WithLogger

func (s *CmdrTlsConfig) WithLogger(logger log.Logger) *CmdrTlsConfig

type Initializer

type Initializer func(config *CmdrTlsConfig)

type VersionTLS

type VersionTLS uint16
const (
	VersionTLS10 VersionTLS = 0x0301
	VersionTLS11 VersionTLS = 0x0302
	VersionTLS12 VersionTLS = 0x0303
	VersionTLS13 VersionTLS = 0x0304

	// Deprecated: SSLv3 is cryptographically broken, and is no longer
	// supported by this package. See golang.org/issue/32716.
	VersionSSL30 VersionTLS = 0x0300
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL