tls

package
v0.0.0-...-c597469 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: BSD-3-Clause, MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TLSConfig

type TLSConfig struct {
	CA   []byte
	Cert []byte
	Key  []byte
}

func NewTLSConfig

func NewTLSConfig(ca, cert, key string) *TLSConfig

func SelfSignedTLSConfig

func SelfSignedTLSConfig() *TLSConfig

SelfSignedTLSConfig generates a self-signed CA, certificate and key. Very useful for unit testing.

func (*TLSConfig) CACertificate

func (this *TLSConfig) CACertificate() (*x509.Certificate, error)

CACertificate decodes the PEM block in the CA bytes and parses a X.509 certificate from the result.

func (*TLSConfig) Certificate

func (this *TLSConfig) Certificate() (tlsCert tls.Certificate, err error)

Certificate creates a X.509 Key Pair from Cert and Key bytes and prepares the Certificate.

func (*TLSConfig) Client

func (this *TLSConfig) Client(c net.Conn) net.Conn

Client takes a net.Conn and returns a crypto/tls.Conn for use on the client side of a TLS connection.

func (*TLSConfig) Server

func (this *TLSConfig) Server(c net.Conn) net.Conn

Server takes a net.Conn and returns a crypto/tls.Conn for use on the server side of a TLS connection.

Jump to

Keyboard shortcuts

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