haraldtest

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package haraldtest provides utilities for testing harald.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EchoChamber

func EchoChamber(t *testing.T) string

EchoChamber starts a new listener on a random port on the loopback address and returns the address it is listening on. The listener is only active for the first connection that is established to it. Any data received on the connection is sent back through it.

Types

type CA

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

func NewCertificateAuthority

func NewCertificateAuthority(t *testing.T) *CA

func (*CA) Certificate

func (ca *CA) Certificate() *x509.Certificate

func (*CA) NewClientCertificate

func (ca *CA) NewClientCertificate(t *testing.T) (cert []byte, key []byte)

NewClientCertificate returns a new certificate and private key encoded as PEM. The certificate is valid and signed by the CA it is called on. The result can directly be passed to tls.X509KeyPair.

func (*CA) NewServerCertificate

func (ca *CA) NewServerCertificate(t *testing.T) (cert []byte, key []byte)

NewServerCertificate returns a new certificate and private key encoded as PEM. The certificate is valid and signed by the CA it is called on. The result can directly be passed to tls.X509KeyPair.

func (*CA) PEM

func (ca *CA) PEM() []byte

Jump to

Keyboard shortcuts

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