testhelper

package
v1.17.3 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CAFilePath added in v1.17.0

func CAFilePath(dir string) string

func CertFilePath added in v1.17.0

func CertFilePath(dir string) string

func ConvertFileToBase64 added in v1.17.0

func ConvertFileToBase64(file string) string

func CreateTemp

func CreateTemp(t testing.TB, dir, pattern string) *os.File

CreateTemp is a helper function which creates a temporary file, and it is automatically closed after test is completed

func GenerateSelfSignedCA added in v1.17.0

func GenerateSelfSignedCA(filePath string) (*tls.Certificate, error)

func GenerateSelfSignedCAPool added in v1.17.0

func GenerateSelfSignedCAPool(caCert *tls.Certificate) (*x509.CertPool, error)

func GenerateServerCert added in v1.17.0

func GenerateServerCert(
	caCert *tls.Certificate,
	commonName string,
	serialNumber int64,
	certPubFile string,
	certPrivFile string,
) (*tls.Certificate, error)

func GenerateTestCerts added in v1.17.0

func GenerateTestCerts(tempDir string, commonName string, num int) ([]*tls.Certificate, *x509.CertPool, *x509.CertPool, error)

func KeyFilePath added in v1.17.0

func KeyFilePath(dir string) string

func MkdirTemp

func MkdirTemp(t testing.TB, dir, pattern string) string

MkdirTemp is a helper function which creates a temporary directory, and they are automatically removed after test is completed

Types

type CertChain added in v1.17.0

type CertChain struct {
	CertPubFile string
	CertKeyFile string
	CaPubFile   string
}

func GenerateTestChain added in v1.17.0

func GenerateTestChain(tempDir string, commonName string) (CertChain, error)

func GenerateTestChainWithSN added in v1.17.0

func GenerateTestChainWithSN(tempDir string, commonName string, serialNumber int64,
) (CertChain, *tls.Certificate, error)

Jump to

Keyboard shortcuts

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