testcert

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package testcert makes a throwaway self-signed certificate for TLS tests. The certificate is valid for 127.0.0.1, ::1 and localhost. Tests in http/ and grpcws/ share it, so it imports nothing from servicekit.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cert

type Cert struct {
	// CertFile and KeyFile are PEM files in the test's temp dir.
	CertFile, KeyFile string
	// Pair is the loaded certificate, for a server tls.Config.
	Pair tls.Certificate
	// Pool trusts only this certificate, for a client tls.Config.
	Pool *x509.CertPool
}

Cert is a self-signed certificate and the ways a test needs to use it.

func New

func New(t testing.TB) Cert

New makes a certificate and writes it under t.TempDir(). It fails the test on any error.

Jump to

Keyboard shortcuts

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