tls

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2020 License: GPL-3.0 Imports: 8 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
	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
	MinTlsVersion uint16
}

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 (*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) 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)

Jump to

Keyboard shortcuts

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