testsupport

package
v0.14.2-alpha Latest Latest
Warning

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

Go to latest
Published: May 12, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTestPurpose  = errors.New("error raised in a test")
	ErrTestPurpose2 = errors.New("another error raised in a test")
)

Functions

func DecodeTestConfig

func DecodeTestConfig(data []byte) (map[string]any, error)

func GetFreePort

func GetFreePort() (int, error)

Types

type CA

type CA struct {
	PrivKey     *ecdsa.PrivateKey
	Certificate *x509.Certificate
	// contains filtered or unexported fields
}

func NewCA

func NewCA(privKey *ecdsa.PrivateKey, cert *x509.Certificate) *CA

func NewRootCA

func NewRootCA(CN string, validity time.Duration) (*CA, error)

func (*CA) IssueCertificate

func (ca *CA) IssueCertificate(opts ...CertificateBuilderOption) (*x509.Certificate, error)

type CertificateBuilder

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

func NewCertificateBuilder

func NewCertificateBuilder(opts ...CertificateBuilderOption) *CertificateBuilder

func (*CertificateBuilder) Build

func (cb *CertificateBuilder) Build() (*x509.Certificate, error)

type CertificateBuilderOption

type CertificateBuilderOption func(*CertificateBuilder)

func WithDNSNames

func WithDNSNames(names []string) CertificateBuilderOption

func WithEMailAddresses

func WithEMailAddresses(addresses []string) CertificateBuilderOption

func WithExtendedKeyUsage

func WithExtendedKeyUsage(usage x509.ExtKeyUsage) CertificateBuilderOption

func WithExtension

func WithExtension(extension pkix.Extension) CertificateBuilderOption

func WithExtraExtension

func WithExtraExtension(extension pkix.Extension) CertificateBuilderOption

func WithGeneratedSubjectKeyID

func WithGeneratedSubjectKeyID() CertificateBuilderOption

func WithIPAddresses

func WithIPAddresses(addresses []net.IP) CertificateBuilderOption

func WithIsCA

func WithIsCA() CertificateBuilderOption

func WithIssuer

func WithIssuer(key any, cert *x509.Certificate) CertificateBuilderOption

func WithKeyUsage

func WithKeyUsage(keyUsage x509.KeyUsage) CertificateBuilderOption

func WithSelfSigned

func WithSelfSigned() CertificateBuilderOption

func WithSerialNumber

func WithSerialNumber(SN *big.Int) CertificateBuilderOption

func WithSignaturePrivKey

func WithSignaturePrivKey(key any) CertificateBuilderOption

func WithSubject

func WithSubject(name pkix.Name) CertificateBuilderOption

func WithSubjectKeyID

func WithSubjectKeyID(skid []byte) CertificateBuilderOption

func WithURIs

func WithURIs(uris []*url.URL) CertificateBuilderOption

func WithValidity

func WithValidity(notBefore time.Time, duration time.Duration) CertificateBuilderOption

type EndEntity

type EndEntity struct {
	Certificate *x509.Certificate
	PrivKey     any
}

type PatchedOSExit

type PatchedOSExit struct {
	Called bool
	Code   int
	// contains filtered or unexported fields
}

func PatchOSExit

func PatchOSExit(t *testing.T, mockOSExitImpl func(int)) (*PatchedOSExit, error)

type TestingLog

type TestingLog struct {
	testing.TB
	// contains filtered or unexported fields
}

func (*TestingLog) CollectedLog

func (t *TestingLog) CollectedLog() string

func (*TestingLog) Log

func (t *TestingLog) Log(args ...interface{})

func (*TestingLog) Logf

func (t *TestingLog) Logf(format string, args ...interface{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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