tlsconf

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientAuthClient

func ClientAuthClient(serverName string, rootCA *x509.CertPool, clientCert tls.Certificate) (*tls.Config, error)

func ParseCAFile

func ParseCAFile(certfile string) (*x509.CertPool, error)

Types

type ClientAuthListener

type ClientAuthListener struct {
	// contains filtered or unexported fields
}

func NewClientAuthListener

func NewClientAuthListener(
	l *net.TCPListener, ca *x509.CertPool, serverCert tls.Certificate,
	handshakeTimeout time.Duration) *ClientAuthListener

func (*ClientAuthListener) Accept

func (l *ClientAuthListener) Accept() (tcpConn *net.TCPConn, tlsConn *tls.Conn, clientCN string, err error)

Accept() accepts a connection from the *net.TCPListener passed to the constructor and sets up the TLS connection, including handshake and peer CommmonName validation within the specified handshakeTimeout.

It returns both the raw TCP connection (tcpConn) and the TLS connection (tlsConn) on top of it. Access to the raw tcpConn might be necessary if CloseWrite semantics are desired: tlsConn.CloseWrite does NOT call tcpConn.CloseWrite, hence we provide access to tcpConn to allow the caller to do this by themselves.

func (*ClientAuthListener) Addr

func (l *ClientAuthListener) Addr() net.Addr

func (*ClientAuthListener) Close

func (l *ClientAuthListener) Close() error

Jump to

Keyboard shortcuts

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